OpenBarnyard
 
Loading...
Searching...
No Matches
T2Window_SDL.h
Go to the documentation of this file.
1#pragma once
3
4#include <SDL/SDL.h>
5
7
8class T2Render;
9
10//-----------------------------------------------------------------------------
11// Note: This is a custom class which is not the same as the one used in TOSHI 2.0
12// since it was never actually used in any games but in some tools like TXSViewer which
13// is not publicly available, so it's not possible to match this class.
14//-----------------------------------------------------------------------------
16{
17public:
19 {
20 public:
21 virtual TBOOL OnEvent( const SDL_Event& a_rEvent ) = 0;
22 };
23
24public:
25 T2Window() = default;
26 ~T2Window() = default;
27
28 TBOOL Create( T2Render* a_pRender, const TCHAR* a_szTitle );
29 void Update();
30
31 void SetFullscreen( TBOOL a_bFullScreen );
32 void SetPosition( TINT a_iX, TINT a_iY, TINT a_iWidth, TINT a_iHeight );
33
34 void SetListener( EventListener* a_pListener ) { m_pListener = a_pListener; }
35 SDL_Window* GetNativeWindow() const { return m_pWindow; }
36
37 TINT GetWidth() const { return m_iWidth; }
38 TINT GetHeight() const { return m_iHeight; }
39
40private:
41 SDL_Window* m_pWindow = TNULL;
42 EventListener* m_pListener;
43 T2Render* m_pRender;
44
45 TINT m_iWidth;
46 TINT m_iHeight;
47};
48
Rendering system interface for the Toshi engine.
#define TOSHI_NAMESPACE_START
Definition Defines.h:47
#define TOSHI_NAMESPACE_END
Definition Defines.h:50
char TCHAR
Definition Typedefs.h:20
#define TNULL
Definition Typedefs.h:23
int TINT
Definition Typedefs.h:7
bool TBOOL
Definition Typedefs.h:6
void Update()
~T2Window()=default
TINT GetHeight() const
TBOOL Create(T2Render *a_pRender, const TCHAR *a_szTitle)
void SetFullscreen(TBOOL a_bFullScreen)
TINT GetWidth() const
SDL_Window * GetNativeWindow() const
T2Window()=default
void SetPosition(TINT a_iX, TINT a_iY, TINT a_iWidth, TINT a_iHeight)
void SetListener(EventListener *a_pListener)
virtual TBOOL OnEvent(const SDL_Event &a_rEvent)=0