CSharpWrap.txt 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. Classes that need C# wrappers:
  2. Math (Instead of a wrapper create actual C# classes, but which map 1-1 with C++ code so we can move them through C++/C# boundaries):
  3. -Vector2
  4. -Vector3
  5. -Vector4
  6. -Matrix3
  7. -Matrix4
  8. -Quaternion
  9. -Rect
  10. -Int2
  11. -Color
  12. Resources:
  13. - Mesh
  14. - Texture
  15. - Font
  16. - Material
  17. - GpuProgram
  18. - Technique
  19. - Shader
  20. - DepthStencil/Blend/Rasterizer/Sampler state
  21. Core objects:
  22. - RenderTarget
  23. - RenderWindow
  24. - RenderTexture
  25. - MultiRenderTexture
  26. - SceneObject
  27. - Component
  28. - plus specific components Camera, Renderable, maybe others
  29. - (later ofc ability to derive custom C# components)
  30. GUI:
  31. - EditorWindow
  32. - GUIWidget
  33. - GUILabel/GUIButton/GUIToggle/GUIInputBox/GUITexture...
  34. - GUILayoutX/GUILayoutY/GUILayoutOptions
  35. - GUISkin/GUIElementStyle
  36. Systems:
  37. - Resources
  38. - Importer
  39. - Application (startUp/shutDown)
  40. - Cursor
  41. - Debug
  42. - Input
  43. - Time
  44. -----------------
  45. // TODO - I might need to call this
  46. retval = mono_jit_exec (domain, assembly, argc - 1, argv + 1);
  47. to call a Main function in the assembly
  48. -----------------
  49. For EditorWindow, add a new class in BansheeEditor, which pretty much does the job of EditorWidget::open
  50. - Except it creates an empty widget. (It will also create a window, but in C++ code)
  51. - All the window docking/undocking moving/resizing is done in C++
  52. - EditorWindow only has a reference to EditorWidget
  53. -----------------
  54. Implementation steps:
  55. - Get EditorApplication finished and make the main window open from C#
  56. - Add support for Resources
  57. - Importer - Likely invisible for outside world
  58. - Resources.Save/Load - Will likely need some kind of an AssetManager for all imported assets
  59. - Texture, Mesh, Font, Shader, Material
  60. - Before this I will also probably require all the basic classes like Vector3, etc.
  61. - Emulate current CamelotClient tests in C#
  62. -----------------
  63. But which ones will I need initially?
  64. - [EditorApplication] - Entry point. Creates a MainEditorWindow
  65. - [EditorWindow] (Scene, Project, Hierarchy, etc.)
  66. - show()/hide()
  67. - [MainEditorWindow]
  68. - Slight variation of EditorWindow as there can be only one of them
  69. - Contains [TitleBar], [DockManager]
  70. - When adding GUI elements I need to make it easy to add game GUI elements,
  71. but also make a distinction and make it possible to add editor GUI elements.
  72. - Each EditorWindow contains a [GUIWidget] (created by default)
  73. - This GUIWIdget is created specially with EditorWindow as its target
  74. - GUIWidget is also a Component which can be used for rendering to Game view
  75. - All game GUIWidgets are created with Game render target as their target
  76. - [GameObject], [Component]
  77. - Need something to add GUIWidget to
  78. - I need to have [Application] running within EditorApplication
  79. - So when I remove EditorApplication everything runs as normal
  80. - How to make the distinction?
  81. - Application needs to render to RenderTarget when in editor, and have its own window when standalone
  82. - When in Editor, EditorApplication will call application and tell it to create a render target
  83. - When published I will have a Game class, which will also call Application and run it in a window
  84. - Certain components should only exists in editor (Like Scene camera, gizmos and etc.)
  85. - Add a flag to GameObjects like in Unity, that can hide the object in Hierarchy, or make it not save
  86. - Editor objects would be hidden and would not save with the level, which would make publishing work
  87. - GUIWidget
  88. - [GUILayoutX], [GUILayoutY], [GUIArea], [GUISpace], [GUIFlexibleSpace]
  89. - [GUIElement]
  90. - [GUILabel], [GUIButton], etc.
  91. - TODO: GUISkin? - Will I need to create interface for textures and resource loading/importing as well? Probably
  92. ----------------
  93. Eventually make all math classes templates that work on both doubles and floats. (Very low priority)
  94. ----------------------------
  95. EditorGUI - NOT a component
  96. - Internally just a GUIWidget
  97. - has AddArea method
  98. - has main field that points to main Layout
  99. - shares interface with "GUI", which is used for main game window
  100. - has a reference to GUISkin. Default is GUISkin.main
  101. GUIArea
  102. - has layout field
  103. - has AddLayoutX, AddLayoutY
  104. GUILayout
  105. - has AddButton, AddLabel, AddLayoutX, AddLayoutY
  106. GUIButton, GUILabel
  107. - Require GUILayoutOptions, GUIElementStyle upon construction
  108. - Have Destroy() methods
  109. GUIElementStyle
  110. - Requires font
  111. - Requires SpriteTexture
  112. - Create DUMMY font and texture classes for now
  113. GUISkin
  114. - Has pointers to GUIElementStyles for button, label, etc. plus support for custom styles using GetStyle(name), SetStyle(name)
  115. Immediate:
  116. - Implement ScriptGUIBase
  117. - Delete: GUIWidget and ScriptGUIWidget
  118. When loading resources I need to be able to load both project resources and engine ones.
  119. - BuiltinResources can be used for accessing default resources like GUI skin textures and similar
  120. - They're all loaded from a special folder that is set in EditorApplication
  121. Should I make sprite texture a resource?
  122. - Quite probably, and will need to replace any Ptr references with handle references. I want the user
  123. to be able to reference the resource in multiple locations and then he can easily edit the SpriteTexture as needed.
  124. ScriptGUILabel currently accepts a WString, while it should be accepting a HString. Check BsScriptGUILabel
  125. BsApplication::getPrimaryViewport is not implemented
  126. Reconsider making scripts a static library
  127. - The scripts would only have one external header that allows you to start the script engine and load assemblies
  128. - So BansheeEngine script library would be dependant on BansheeEngine
  129. - BansheeEditor script library would be dependant on BansheeEditor, BansheEngine and BansheeEngineScript
  130. - Maybe even make them .dlls? Then BansheeEngine and bansheeeditor doesn't need to know about their includes
  131. IGNORE RESOURCES FOR NOW. When building the GUI make sure that they all temporarily use the native skin
  132. - Later implement GUIBase.skin (and actually implement GUISkin because it's just a dummy for now)
  133. ----------------------------
  134. I want my .exe to be native. Internally it will call MBansheeEngine and MBansheeEditor.
  135. This will allow me to debug and start C++ as usual.
  136. -----------------
  137. Notes:
  138. - I will need RequireComponent[] attribute. This attribute should automatically add the specified class to the wanted
  139. GameObject. This is useful if you suddenly decide your class is now dependant on another, but you would otherwise have to manually
  140. go through all instances of that GameObject in scene and add the required component.
  141. - HOWEVER, a more generic way of doing this (maybe using prefabs) would be useful. Because what happens when a class suddenly becomes
  142. dependant on a resource, or a specific instance of a class? In that case we cannot use RequireComponent.
  143. - Use FrameUpdate[QueueIdx], OnCreate[QueueIdx], OnDestroy[QueueIdx] attributes to signify to the scripting system when to execute
  144. certain methods. QueueIdx allows you to specify the order in which these methods will be called. In Unity you have Awake and Start methods
  145. for initialization, but here you may just specify OnCreate[0] and OnCreate[1].
  146. - I will likely need C++ equivalents of these queues because C++ components will also require such ordering.