Changeset View
Changeset View
Standalone View
Standalone View
source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
| Context not available. | |||||
| struct wmWindowManager; | struct wmWindowManager; | ||||
| /** | /** | ||||
| * 2D Blender device context abstraction. | * 2D Blender device context abstraction. | ||||
| * The connection from 3d rendercontext to 2d Blender surface embedding. | * The connection from 3d rendercontext to 2d Blender surface embedding. | ||||
| */ | */ | ||||
| class KX_BlenderCanvas : public RAS_ICanvas | class KX_BlenderCanvas : public RAS_ICanvas | ||||
| { | { | ||||
| private: | private: | ||||
| /** | /** Rect that defines the area used for rendering, | ||||
| * Rect that defines the area used for rendering, | * relative to the context | ||||
| * relative to the context */ | */ | ||||
| RAS_Rect m_displayarea; | RAS_Rect m_displayarea; | ||||
| int m_viewport[4]; | int m_viewport[4]; | ||||
| wmWindowManager *m_wm; | |||||
| wmWindow *m_win; | |||||
| RAS_Rect m_area_rect; | |||||
| ARegion *m_ar; | |||||
| public: | public: | ||||
| /* Construct a new canvas. | /* Construct a new canvas. | ||||
| * | * | ||||
| * \param area The Blender ARegion to run the game within. | * \param area The Blender ARegion to run the game within. | ||||
| */ | */ | ||||
| KX_BlenderCanvas(struct wmWindowManager *wm, struct wmWindow* win, RAS_Rect &rect, struct ARegion* ar); | KX_BlenderCanvas(RAS_IRasterizer *rasty, wmWindowManager *wm, wmWindow *win, RAS_Rect &rect, ARegion *ar); | ||||
| ~KX_BlenderCanvas(); | virtual ~KX_BlenderCanvas(); | ||||
| void | |||||
| Init( | |||||
| ); | |||||
| void | |||||
| SwapBuffers( | |||||
| ); | |||||
| void | |||||
| SetSwapInterval( | |||||
| int interval | |||||
| ); | |||||
| bool | |||||
| GetSwapInterval( | |||||
| int &intervalOut | |||||
| ); | |||||
| void GetDisplayDimensions(int &width, int &height); | |||||
| void | |||||
| ResizeWindow( | |||||
| int width, | |||||
| int height | |||||
| ); | |||||
| void | |||||
| SetFullScreen( | |||||
| bool enable | |||||
| ); | |||||
| bool | |||||
| GetFullScreen(); | |||||
| void | |||||
| BeginFrame( | |||||
| ); | |||||
| void | |||||
| EndFrame( | |||||
| ); | |||||
| void | |||||
| ClearColor( | |||||
| float r, | |||||
| float g, | |||||
| float b, | |||||
| float a | |||||
| ); | |||||
| void | |||||
| ClearBuffer( | |||||
| int type | |||||
| ); | |||||
| int | |||||
| GetWidth( | |||||
| ) const; | |||||
| int | |||||
| GetHeight( | |||||
| ) const; | |||||
| int | |||||
| GetMouseX(int x | |||||
| ); | |||||
| int | |||||
| GetMouseY(int y | |||||
| ); | |||||
| float | |||||
| GetMouseNormalizedX(int x | |||||
| ); | |||||
| float | |||||
| GetMouseNormalizedY(int y | |||||
| ); | |||||
| const | |||||
| RAS_Rect & | |||||
| GetDisplayArea( | |||||
| ) const { | |||||
| return m_displayarea; | |||||
| }; | |||||
| void | |||||
| SetDisplayArea(RAS_Rect *rect | |||||
| ) { | |||||
| m_displayarea= *rect; | |||||
| }; | |||||
| RAS_Rect & | |||||
| GetWindowArea( | |||||
| ); | |||||
| void | |||||
| SetViewPort( | |||||
| int x1, int y1, | |||||
| int x2, int y2 | |||||
| ); | |||||
| void | |||||
| UpdateViewPort( | |||||
| int x1, int y1, | |||||
| int x2, int y2 | |||||
| ); | |||||
| const int* | |||||
| GetViewPort(); | |||||
| void | |||||
| SetMouseState( | |||||
| RAS_MouseState mousestate | |||||
| ); | |||||
| void | |||||
| SetMousePosition( | |||||
| int x, | |||||
| int y | |||||
| ); | |||||
| void | |||||
| MakeScreenShot( | |||||
| const char* filename | |||||
| ); | |||||
| bool | |||||
| BeginDraw( | |||||
| ); | |||||
| void | |||||
| EndDraw( | |||||
| ); | |||||
| private: | virtual void Init(); | ||||
| /** Blender area the game engine is running within */ | |||||
| struct wmWindowManager *m_wm; | virtual void SwapBuffers(); | ||||
| struct wmWindow* m_win; | virtual void SetSwapInterval(int interval); | ||||
| RAS_Rect m_frame_rect; | virtual bool GetSwapInterval(int &intervalOut); | ||||
| RAS_Rect m_area_rect; | |||||
| int m_area_left; | virtual void GetDisplayDimensions(int &width, int &height); | ||||
| int m_area_top; | virtual void ResizeWindow(int width, int height); | ||||
| virtual void Resize(int width, int height); | |||||
| virtual void SetFullScreen(bool enable); | |||||
| virtual bool GetFullScreen(); | |||||
| virtual void BeginFrame(); | |||||
| virtual void EndFrame(); | |||||
| virtual int GetWidth() const; | |||||
| virtual int GetHeight() const; | |||||
| virtual void ConvertMousePosition(int x, int y, int &r_x, int &r_y, bool screen); | |||||
| virtual float GetMouseNormalizedX(int x); | |||||
| virtual float GetMouseNormalizedY(int y); | |||||
| virtual const RAS_Rect &GetDisplayArea() const; | |||||
| virtual void SetDisplayArea(RAS_Rect *rect); | |||||
| virtual RAS_Rect &GetWindowArea(); | |||||
| virtual void SetViewPort(int x1, int y1, int x2, int y2); | |||||
| virtual void UpdateViewPort(int x1, int y1, int x2, int y2); | |||||
| virtual const int *GetViewPort(); | |||||
| virtual void SetMouseState(RAS_MouseState mousestate); | |||||
| virtual void SetMousePosition(int x, int y); | |||||
| virtual void MakeScreenShot(const std::string& filename); | |||||
| virtual void BeginDraw(); | |||||
| virtual void EndDraw(); | |||||
| #ifdef WITH_CXX_GUARDEDALLOC | #ifdef WITH_CXX_GUARDEDALLOC | ||||
| MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_BlenderCanvas") | MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_BlenderCanvas") | ||||
| #endif | #endif | ||||
| }; | }; | ||||
| #endif /* __KX_BLENDERCANVAS_H__ */ | #endif // __KX_BLENDERCANVAS_H__ | ||||
| Context not available. | |||||