Ocular Engine
Window.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_RENDERER_WINDOW__H__
19 #define __H__OCULAR_RENDERER_WINDOW__H__
20 
21 #include "Object.hpp"
22 #include "WindowManager.hpp"
23 #include "WindowDisplay.hpp"
24 #include "WindowDescriptor.hpp"
25 #include "Events/AEventListener.hpp"
26 
27 #include <string>
28 
29 //------------------------------------------------------------------------------------------
30 
35 namespace Ocular
36 {
37  namespace Graphics
38  {
39  class RenderTexture;
40  class DepthTexture;
41  }
42 
47  namespace Core
48  {
49  class RenderContext;
50 
60  class AWindow : public Object, public AEventListener
61  {
62  friend class WindowManager;
63  public:
64 
75  AWindow(WindowDescriptor const& descriptor);
76 
77  virtual ~AWindow();
78 
79  virtual bool onEvent(std::shared_ptr<AEvent> event) override;
80 
81  //--------------------------------------------
82 
91  void resize(uint32_t width, uint32_t height);
92 
97 
102  void setDescriptor(WindowDescriptor const& descriptor);
103 
107  bool hasFocus() const;
108 
113 
126  void setRenderTexture(Graphics::RenderTexture* renderTexture);
127 
132 
145  void setDepthTexture(Graphics::DepthTexture* depthTexture);
146 
151  virtual void showCursor(bool show);
152 
157  void* getOSPointer() const;
158 
159  protected:
160 
164  virtual void open() = 0;
165 
169  virtual void update(uint64_t time) = 0;
170 
174  virtual void close() = 0;
175 
176  //----------------------------------------------------------
177 
178  WindowDescriptor m_Descriptor;
179 
180  Graphics::RenderTexture* m_RenderTexture;
181  Graphics::DepthTexture* m_DepthTexture;
182 
183  void* m_OSPointer;
184 
185  private:
186  };
187  }
191 }
196 //------------------------------------------------------------------------------------------
197 
198 #endif
Definition: WindowManager.hpp:50
void setDepthTexture(Graphics::DepthTexture *depthTexture)
Definition: Window.cpp:143
void setRenderTexture(Graphics::RenderTexture *renderTexture)
Definition: Window.cpp:127
A special texture that stores high precision depth information for each pixel.
Definition: DepthTexture.hpp:41
A special texture that can be rendered directly to.
Definition: RenderTexture.hpp:41
Definition: WindowDescriptor.hpp:78
Definition: AEventListener.hpp:43
AWindow(WindowDescriptor const &descriptor)
Definition: Window.cpp:34
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
Graphics::RenderTexture * getRenderTexture()
Definition: Window.cpp:122
void * getOSPointer() const
Definition: Window.cpp:159
Definition: Window.hpp:60
virtual void update(uint64_t time)=0
void resize(uint32_t width, uint32_t height)
Definition: Window.cpp:83
void setDescriptor(WindowDescriptor const &descriptor)
Definition: Window.cpp:117
virtual void open()=0
Graphics::DepthTexture * getDepthTexture()
Definition: Window.cpp:138
virtual bool onEvent(std::shared_ptr< AEvent > event) override
Definition: Window.cpp:63
bool hasFocus() const
virtual void close()=0
WindowDescriptor getDescriptor() const
Definition: Window.cpp:112
Base class of all representable Ocular constructs.
Definition: Object.hpp:44
virtual void showCursor(bool show)
Definition: Window.cpp:154