Closed Twinklebear closed 11 years ago
Mouse interaction note: Because the UIManager doesn't apply a transform of the mouse into scene space it's what's used to determine clicks on Entities that are outside the scene. If the EntityManager and UIManager are to be rolled into one, the EntityManager will need to determine when is appropriate to apply the mouse transform.
Ie. if mouse clicked outside of scene space, don't apply any transforms. This will cause another issue though, if you click in the "scene physical area" ie. the top left corner of the window where the scene's untransformed physics are running you'll click a scene entity.
Instead I think the mouse coordinates should stay absolute and the collision boxes for in-scene Entities should be transformed to window-space when checking for clicks.
What's the difference between an entity and a ui element?
UI Elements are drawn without the camera offset, so this should be changed instead to be a flag that can be set to draw with/without the offset. Besides that, no difference, it's just a child of EntityManager that ignores the camera offsets. That's why I want to roll these two back together since it doesn't make sense for them to be separate things.
I'm a bit unsure as to why i decided to split them initially haha.
I've removed the UIObjectManager, now entities are distinguished by the flag mUI, checked and set via IsUiElement() and IsUiElement(true). You can also enable/disable rendering of an entity with the mRender flag, via Render() and Render(true)
A note though, since for now some entities draw themselves via the script (should be changed) you must check if the camera will be null before drawing if you plan to test switching between ui element and not ui element (see player.lua)
I think these classes should be merged into one, and then a function OnGUI should be implemented to draw things without any camera offsets to be called last in the draw order. So anything drawn in this function call will be drawn on top of everything and in window-space. This would in turn eliminate the need for a UIManager.