Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 968 vs 969 for /trunk/Source Code/Editor/Headers/Editor.h

Diff revisions: vs.
  @@ -32,27 +32,44 @@
32 32 #ifndef _DIVIDE_EDITOR_H_
33 33 #define _DIVIDE_EDITOR_H_
34 34
35 - #include "Core/Headers/NonCopyable.h"
35 + #include "Core/Headers/PlatformContextComponent.h"
36 36 #include "Core/Time/Headers/ProfileTimer.h"
37 37 #include "Platform/Headers/PlatformDefines.h"
38 38 #include "Rendering/Headers/FrameListener.h"
39 + #include "Platform/Input/Headers/InputAggregatorInterface.h"
39 40
41 + struct ImDrawData;
40 42 namespace Divide {
41 43
44 + namespace Attorney {
45 + class EditorWindowManager;
46 + };
47 +
48 + class DisplayWindow;
42 49 class PlatformContext;
43 50 class ImwWindowManagerDivide;
51 + FWD_DECLARE_MANAGED_CLASS(Texture);
52 + FWD_DECLARE_MANAGED_CLASS(ShaderProgram);
53 +
54 + class Editor : public PlatformContextComponent,
55 + public FrameListener,
56 + public Input::InputAggregatorInterface {
57 +
58 + friend class Attorney::EditorWindowManager;
44 59
45 - class Editor : private NonCopyable, public FrameListener {
46 60 public:
47 61 explicit Editor(PlatformContext& context);
48 62 ~Editor();
49 63
50 64 bool init();
51 65 void close();
52 -
66 + void idle();
53 67 void update(const U64 deltaTimeUS);
54 68
55 - protected:
69 + void toggle(const bool state);
70 + bool running() const;
71 +
72 + protected: //frame listener
56 73 bool frameStarted(const FrameEvent& evt);
57 74 bool framePreRenderStarted(const FrameEvent& evt);
58 75 bool framePreRenderEnded(const FrameEvent& evt);
  @@ -60,15 +77,61 @@
60 77 bool framePostRenderStarted(const FrameEvent& evt);
61 78 bool framePostRenderEnded(const FrameEvent& evt);
62 79 bool frameEnded(const FrameEvent& evt);
80 +
81 + public: // input
82 + /// Key pressed: return true if input was consumed
83 + bool onKeyDown(const Input::KeyEvent& key);
84 + /// Key released: return true if input was consumed
85 + bool onKeyUp(const Input::KeyEvent& key);
86 + /// Mouse moved: return true if input was consumed
87 + bool mouseMoved(const Input::MouseEvent& arg);
88 + /// Mouse button pressed: return true if input was consumed
89 + bool mouseButtonPressed(const Input::MouseEvent& arg, Input::MouseButton button);
90 + /// Mouse button released: return true if input was consumed
91 + bool mouseButtonReleased(const Input::MouseEvent& arg, Input::MouseButton button);
92 +
93 + bool joystickButtonPressed(const Input::JoystickEvent &arg, Input::JoystickButton button) override;
94 + bool joystickButtonReleased(const Input::JoystickEvent &arg, Input::JoystickButton button) override;
95 + bool joystickAxisMoved(const Input::JoystickEvent &arg, I8 axis) override;
96 + bool joystickPovMoved(const Input::JoystickEvent &arg, I8 pov) override;
97 + bool joystickSliderMoved(const Input::JoystickEvent &arg, I8 index) override;
98 + bool joystickvector3Moved(const Input::JoystickEvent &arg, I8 index) override;
99 +
100 + protected: // window events
101 + bool OnClose();
102 + void OnFocus(bool bHasFocus);
103 + void OnSize(int iWidth, int iHeight);
104 + void OnUTF8(const char* text);
105 +
106 + protected: // attorney
107 + void renderDrawList(ImDrawData* pDrawData, I64 windowGUID);
108 +
63 109 private:
64 - PlatformContext& _context;
65 110 std::unique_ptr<ImwWindowManagerDivide> _windowManager;
66 111
112 + bool _running;
113 + DisplayWindow* _mainWindow;
114 + Texture_ptr _fontTexture;
115 + ShaderProgram_ptr _imguiProgram;
116 +
67 117 Time::ProfileTimer& _editorTimer;
68 118 Time::ProfileTimer& _editorUpdateTimer;
69 119 Time::ProfileTimer& _editorRenderTimer;
70 120
71 121 }; //Editor
122 +
123 + namespace Attorney {
124 + class EditorWindowManager {
125 + private:
126 + static void renderDrawList(Editor& editor, ImDrawData* pDrawData, I64 windowGUID) {
127 + editor.renderDrawList(pDrawData, windowGUID);
128 + }
129 +
130 + friend class Divide::ImwWindowManagerDivide;
131 + };
132 + };
133 +
134 +
72 135 }; //namespace Divide
73 136
74 137 #endif //_DIVIDE_EDITOR_H_