CSharpWrap.txt 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. Classes that need C# wrappers:
  2. Resources:
  3. - Mesh
  4. - Texture
  5. - Font
  6. - Material
  7. - GpuProgram
  8. - Technique
  9. - Shader
  10. - DepthStencil/Blend/Rasterizer/Sampler state
  11. Core objects:
  12. - RenderTarget
  13. - RenderWindow
  14. - RenderTexture
  15. - MultiRenderTexture
  16. - SceneObject
  17. - Component
  18. - plus specific components Camera, Renderable, maybe others
  19. - (later ofc ability to derive custom C# components)
  20. GUI:
  21. - EditorWindow
  22. - GUIWidget
  23. - GUILabel/GUIButton/GUIToggle/GUIInputBox/GUITexture...
  24. - GUILayoutX/GUILayoutY/GUILayoutOptions
  25. - GUISkin/GUIElementStyle
  26. Systems:
  27. - Resources
  28. - Importer
  29. - Application (startUp/shutDown)
  30. - Cursor
  31. - Debug
  32. - Input
  33. - Time
  34. -----------------
  35. For EditorWindow, add a new class in BansheeEditor, which pretty much does the job of EditorWidget::open
  36. - Except it creates an empty widget. (It will also create a window, but in C++ code)
  37. - All the window docking/undocking moving/resizing is done in C++
  38. - EditorWindow only has a reference to EditorWidget
  39. -----------------
  40. Implementation steps:
  41. - Get EditorApplication finished and make the main window open from C#
  42. - Add support for Resources
  43. - Importer - Likely invisible for outside world
  44. - Resources.Save/Load - Will likely need some kind of an AssetManager for all imported assets
  45. - Texture, Mesh, Font, Shader, Material
  46. - Before this I will also probably require all the basic classes like Vector3, etc.
  47. - Emulate current CamelotClient tests in C#
  48. -----------------
  49. But which ones will I need initially?
  50. - [EditorApplication] - Entry point. Creates a MainEditorWindow
  51. - [EditorWindow] (Scene, Project, Hierarchy, etc.)
  52. - show()/hide()
  53. - [MainEditorWindow]
  54. - Slight variation of EditorWindow as there can be only one of them
  55. - Contains [TitleBar], [DockManager]
  56. - When adding GUI elements I need to make it easy to add game GUI elements,
  57. but also make a distinction and make it possible to add editor GUI elements.
  58. - Each EditorWindow contains a [GUIWidget] (created by default)
  59. - This GUIWIdget is created specially with EditorWindow as its target
  60. - GUIWidget is also a Component which can be used for rendering to Game view
  61. - All game GUIWidgets are created with Game render target as their target
  62. - [GameObject], [Component]
  63. - Need something to add GUIWidget to
  64. - I need to have [Application] running within EditorApplication
  65. - So when I remove EditorApplication everything runs as normal
  66. - How to make the distinction?
  67. - Application needs to render to RenderTarget when in editor, and have its own window when standalone
  68. - When in Editor, EditorApplication will call application and tell it to create a render target
  69. - When published I will have a Game class, which will also call Application and run it in a window
  70. - Certain components should only exists in editor (Like Scene camera, gizmos and etc.)
  71. - Add a flag to GameObjects like in Unity, that can hide the object in Hierarchy, or make it not save
  72. - Editor objects would be hidden and would not save with the level, which would make publishing work
  73. - GUIWidget
  74. - [GUILayoutX], [GUILayoutY], [GUIArea], [GUISpace], [GUIFlexibleSpace]
  75. - [GUIElement]
  76. - [GUILabel], [GUIButton], etc.
  77. - TODO: GUISkin? - Will I need to create interface for textures and resource loading/importing as well? Probably
  78. ----------------
  79. Eventually make all math classes templates that work on both doubles and floats. (Very low priority)
  80. ----------------------------
  81. Implement:
  82. ScrollArea will likely need:
  83. C++/C#: always/never show horz/vert scroll bar
  84. C++/C#: optional styles for scroll bars
  85. C++/C#: scrollTo(pct)
  86. Are GUI element instances kept anywhere? After GUI.Add* is called I think they're lost and destructed?
  87. I should create a handle in C++ code and only release it once Destroy is called?
  88. - Creating a child hierarchy of GUIElements (where each GUIElement holds references to all its children) can work
  89. - Destroy() is then called recursively from parent element
  90. - Each element will then also have "GetNumChildren", and "GetChild" methods
  91. - Also consider adding GUIElement.Move(GUILayout), GUIElement.Move(GUILayout, int position),
  92. GUIElement.Move(int offset)
  93. - GUISkin
  94. - List of properties with all common styles, like .button, .label
  95. - Get/SetStyle methods for custom styles
  96. - GUISkin.main <- default skin
  97. - GUI (Non EditorGUI version)
  98. - Implement C# Font
  99. - Implement C# SpriteTexture
  100. When loading resources I need to be able to load both project resources and engine ones.
  101. - BuiltinResources can be used for accessing default resources like GUI skin textures and similar
  102. - They're all loaded from a special folder that is set in EditorApplication
  103. BsApplication::getPrimaryViewport is not implemented
  104. ----------------------------
  105. I want my .exe to be native. Internally it will call MBansheeEngine and MBansheeEditor.
  106. This will allow me to debug and start C++ as usual.
  107. -----------------
  108. Notes:
  109. - I will need RequireComponent[] attribute. This attribute should automatically add the specified class to the wanted
  110. GameObject. This is useful if you suddenly decide your class is now dependant on another, but you would otherwise have to manually
  111. go through all instances of that GameObject in scene and add the required component.
  112. - HOWEVER, a more generic way of doing this (maybe using prefabs) would be useful. Because what happens when a class suddenly becomes
  113. dependant on a resource, or a specific instance of a class? In that case we cannot use RequireComponent.
  114. - Use FrameUpdate[QueueIdx], OnCreate[QueueIdx], OnDestroy[QueueIdx] attributes to signify to the scripting system when to execute
  115. certain methods. QueueIdx allows you to specify the order in which these methods will be called. In Unity you have Awake and Start methods
  116. for initialization, but here you may just specify OnCreate[0] and OnCreate[1].
  117. - I will likely need C++ equivalents of these queues because C++ components will also require such ordering.