BsSceneEditorWidget.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsEditorWidget.h"
  4. #include "BsServiceLocator.h"
  5. namespace BansheeEngine
  6. {
  7. class SceneEditorWidget : public EditorWidget<SceneEditorWidget>
  8. {
  9. public:
  10. SceneEditorWidget(const ConstructPrivately& dummy, EditorWidgetContainer& parentContainer);
  11. virtual ~SceneEditorWidget();
  12. virtual void _update();
  13. static SceneEditorWidget* instance();
  14. static SceneEditorWidget* open();
  15. static void close();
  16. static const String& getTypeName();
  17. const HCamera& getSceneCamera() const { return mCamera; }
  18. protected:
  19. void doOnResized(UINT32 width, UINT32 height);
  20. void doOnParentChanged();
  21. void determineParentWindow();
  22. void updateRenderTexture(UINT32 width, UINT32 height);
  23. void render(const Viewport* viewport, DrawList& drawList);
  24. bool toSceneViewPos(const Vector2I& screenPos, Vector2I& scenePos);
  25. /**
  26. * @brief Called whenever a pointer (e.g. mouse cursor) is moved.
  27. */
  28. void onPointerMoved(const PointerEvent& event);
  29. /**
  30. * @brief Called whenever a pointer button (e.g. mouse button) is released.
  31. */
  32. void onPointerReleased(const PointerEvent& event);
  33. /**
  34. * @brief Called whenever a pointer button (e.g. mouse button) is pressed.
  35. */
  36. void onPointerPressed(const PointerEvent& event);
  37. private:
  38. static SceneEditorWidget* Instance;
  39. RenderWindowPtr mParentWindow;
  40. RenderTexturePtr mSceneRenderTarget;
  41. GUIRenderTexture* mGUIRenderTexture;
  42. HCamera mCamera;
  43. GameObjectHandle<SceneCameraController> mCameraController;
  44. SceneGrid* mSceneGrid;
  45. bool mLeftButtonPressed;
  46. HEvent mRenderCallback;
  47. HEvent mOnPointerMovedConn;
  48. HEvent mOnPointerPressedConn;
  49. HEvent mOnPointerReleasedConn;
  50. };
  51. }