OpenBarnyard
 
Loading...
Searching...
No Matches
T2Window Class Reference

#include <T2Window_SDL.h>

Classes

class  EventListener
 

Public Member Functions

 T2Window ()=default
 
 ~T2Window ()=default
 
TBOOL Create (T2Render *a_pRender, const TCHAR *a_szTitle)
 
void Update ()
 
void SetFullscreen (TBOOL a_bFullScreen)
 
void SetPosition (TINT a_iX, TINT a_iY, TINT a_iWidth, TINT a_iHeight)
 
void SetListener (EventListener *a_pListener)
 
SDL_Window * GetNativeWindow () const
 
TINT GetWidth () const
 
TINT GetHeight () const
 

Detailed Description

Definition at line 15 of file T2Window_SDL.h.

Constructor & Destructor Documentation

◆ T2Window()

T2Window::T2Window ( )
default

◆ ~T2Window()

T2Window::~T2Window ( )
default

Member Function Documentation

◆ Create()

TBOOL T2Window::Create ( T2Render * a_pRender,
const TCHAR * a_szTitle )

Definition at line 13 of file T2Window_SDL.cpp.

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}
#define TNULL
Definition Typedefs.h:23

◆ GetHeight()

TINT T2Window::GetHeight ( ) const
inline

Definition at line 38 of file T2Window_SDL.h.

38{ return m_iHeight; }

◆ GetNativeWindow()

SDL_Window * T2Window::GetNativeWindow ( ) const
inline

Definition at line 35 of file T2Window_SDL.h.

35{ return m_pWindow; }

◆ GetWidth()

TINT T2Window::GetWidth ( ) const
inline

Definition at line 37 of file T2Window_SDL.h.

37{ return m_iWidth; }

◆ SetFullscreen()

void T2Window::SetFullscreen ( TBOOL a_bFullScreen)

Definition at line 53 of file T2Window_SDL.cpp.

54{
55 SDL_SetWindowFullscreen( m_pWindow, a_bFullScreen ? SDL_WINDOW_FULLSCREEN : 0 );
56}

◆ SetListener()

void T2Window::SetListener ( EventListener * a_pListener)
inline

Definition at line 34 of file T2Window_SDL.h.

34{ m_pListener = a_pListener; }

◆ SetPosition()

void T2Window::SetPosition ( TINT a_iX,
TINT a_iY,
TINT a_iWidth,
TINT a_iHeight )

Definition at line 58 of file T2Window_SDL.cpp.

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}

◆ Update()

void T2Window::Update ( )

Definition at line 34 of file T2Window_SDL.cpp.

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}
#define TFALSE
Definition Typedefs.h:24
static void Throw(const T &a_rData)

The documentation for this class was generated from the following files: