OpenBarnyard
 
Loading...
Searching...
No Matches
T2Window_SDL.cpp
Go to the documentation of this file.
1#include "ToshiPCH.h"
2#include "T2Window_SDL.h"
4
5//-----------------------------------------------------------------------------
6// Enables memory debugging.
7// Note: Should be the last include!
8//-----------------------------------------------------------------------------
10
12
13TBOOL T2Window::Create( T2Render* a_pRender, const TCHAR* a_szTitle )
14{
15 m_pRender = a_pRender;
16 m_pWindow = SDL_CreateWindow(
17 a_szTitle,
18 SDL_WINDOWPOS_CENTERED,
19 SDL_WINDOWPOS_CENTERED,
20 0,
21 0,
22 SDL_WINDOW_SHOWN
23#ifdef TRENDERINTERFACE_GL
24 | SDL_WINDOW_OPENGL
25#endif
26 );
27
28 m_iWidth = -1;
29 m_iHeight = -1;
30
31 return m_pWindow != TNULL;
32}
33
35{
36 SDL_Event event;
37
38 while ( SDL_PollEvent( &event ) )
39 {
40 if ( m_pListener )
41 {
42 if ( m_pListener->OnEvent( event ) )
43 continue;
44 }
45
46 if ( event.type == SDL_EventType::SDL_QUIT )
47 {
49 }
50 }
51}
52
53void T2Window::SetFullscreen( TBOOL a_bFullScreen )
54{
55 SDL_SetWindowFullscreen( m_pWindow, a_bFullScreen ? SDL_WINDOW_FULLSCREEN : 0 );
56}
57
58void T2Window::SetPosition( TINT a_iX, TINT a_iY, TINT a_iWidth, TINT a_iHeight )
59{
60 SDL_SetWindowPosition( m_pWindow, a_iX, a_iY );
61 SDL_SetWindowSize( m_pWindow, a_iWidth, a_iHeight );
62
63 m_iWidth = a_iWidth;
64 m_iHeight = a_iHeight;
65}
66
#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
#define TFALSE
Definition Typedefs.h:24
bool TBOOL
Definition Typedefs.h:6
void Update()
TBOOL Create(T2Render *a_pRender, const TCHAR *a_szTitle)
void SetFullscreen(TBOOL a_bFullScreen)
void SetPosition(TINT a_iX, TINT a_iY, TINT a_iWidth, TINT a_iHeight)
static void Throw(const T &a_rData)