Pyrogenesis  trunk
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
CVideoMode Class Reference

#include <VideoMode.h>

Classes

class  CCursor
 

Public Member Functions

 CVideoMode ()
 
 ~CVideoMode ()
 
bool InitSDL ()
 Initialise the video mode, for use in an SDL-using application. More...
 
bool InitNonSDL ()
 Initialise parts of the video mode, for use in Atlas (which uses wxWidgets instead of SDL for GL). More...
 
void Shutdown ()
 Shut down after InitSDL/InitNonSDL, so that they can be used again. More...
 
bool CreateBackendDevice (const bool createSDLContext)
 Creates a backend device. More...
 
bool ResizeWindow (int w, int h)
 Resize the SDL window and associated graphics stuff to the new size. More...
 
void Rescale (float scale)
 Set scale and tell dependent compoenent to recompute sizes. More...
 
bool SetFullscreen (bool fullscreen)
 Switch to fullscreen or windowed mode. More...
 
bool IsInFullscreen () const
 Returns true if window runs in fullscreen mode. More...
 
bool ToggleFullscreen ()
 Switch between fullscreen and windowed mode. More...
 
void UpdatePosition (int x, int y)
 Update window position, to restore later if necessary (SDL2 only). More...
 
int GetXRes () const
 
int GetYRes () const
 
int GetBPP () const
 
bool IsVSyncEnabled () const
 
int GetDesktopXRes () const
 
int GetDesktopYRes () const
 
int GetDesktopBPP () const
 
int GetDesktopFreq () const
 
float GetScale () const
 
SDL_WindowGetWindow ()
 
void SetWindowIcon ()
 
void SetCursor (const CStrW &name)
 
void ResetCursor ()
 
Renderer::Backend::IDeviceGetBackendDevice ()
 

Static Public Member Functions

static void UpdateRenderer (int w, int h)
 Update the graphics code to start drawing to the new size. More...
 

Private Member Functions

void ReadConfig ()
 
int GetBestBPP ()
 
bool SetVideoMode (int w, int h, int bpp, bool fullscreen)
 
bool TryCreateBackendDevice (SDL_Window *window)
 
void DowngradeBackendSettingAfterCreationFailure ()
 

Private Attributes

bool m_IsInitialised = false
 Remember whether Init has been called. More...
 
SDL_Windowm_Window = nullptr
 
int m_PreferredW = 0
 
int m_PreferredH = 0
 
int m_PreferredBPP = 0
 
int m_PreferredFreq = 0
 
float m_Scale = 1.0f
 
int m_ConfigW = 0
 
int m_ConfigH = 0
 
int m_ConfigBPP = 0
 
int m_ConfigDisplay = 0
 
bool m_ConfigEnableHiDPI = false
 
bool m_ConfigVSync = false
 
bool m_ConfigFullscreen = false
 
int m_WindowedW
 
int m_WindowedH
 
int m_WindowedX
 
int m_WindowedY
 
bool m_IsFullscreen = false
 
int m_CurrentW
 
int m_CurrentH
 
int m_CurrentBPP
 
std::unique_ptr< CCursorm_Cursor
 
Renderer::Backend::Backend m_Backend = Renderer::Backend::Backend::GL
 
std::unique_ptr< Renderer::Backend::IDevicem_BackendDevice
 

Constructor & Destructor Documentation

◆ CVideoMode()

CVideoMode::CVideoMode ( )

◆ ~CVideoMode()

CVideoMode::~CVideoMode ( )
default

Member Function Documentation

◆ CreateBackendDevice()

bool CVideoMode::CreateBackendDevice ( const bool  createSDLContext)

Creates a backend device.

Also we use wxWidgets in Atlas so we don't need to create one for that case.

◆ DowngradeBackendSettingAfterCreationFailure()

void CVideoMode::DowngradeBackendSettingAfterCreationFailure ( )
private

◆ GetBackendDevice()

Renderer::Backend::IDevice* CVideoMode::GetBackendDevice ( )
inline

◆ GetBestBPP()

int CVideoMode::GetBestBPP ( )
private

◆ GetBPP()

int CVideoMode::GetBPP ( ) const

◆ GetDesktopBPP()

int CVideoMode::GetDesktopBPP ( ) const

◆ GetDesktopFreq()

int CVideoMode::GetDesktopFreq ( ) const

◆ GetDesktopXRes()

int CVideoMode::GetDesktopXRes ( ) const

◆ GetDesktopYRes()

int CVideoMode::GetDesktopYRes ( ) const

◆ GetScale()

float CVideoMode::GetScale ( ) const

◆ GetWindow()

SDL_Window * CVideoMode::GetWindow ( )

◆ GetXRes()

int CVideoMode::GetXRes ( ) const

◆ GetYRes()

int CVideoMode::GetYRes ( ) const

◆ InitNonSDL()

bool CVideoMode::InitNonSDL ( )

Initialise parts of the video mode, for use in Atlas (which uses wxWidgets instead of SDL for GL).

◆ InitSDL()

bool CVideoMode::InitSDL ( )

Initialise the video mode, for use in an SDL-using application.

◆ IsInFullscreen()

bool CVideoMode::IsInFullscreen ( ) const

Returns true if window runs in fullscreen mode.

◆ IsVSyncEnabled()

bool CVideoMode::IsVSyncEnabled ( ) const

◆ ReadConfig()

void CVideoMode::ReadConfig ( )
private

◆ Rescale()

void CVideoMode::Rescale ( float  scale)

Set scale and tell dependent compoenent to recompute sizes.

◆ ResetCursor()

void CVideoMode::ResetCursor ( )

◆ ResizeWindow()

bool CVideoMode::ResizeWindow ( int  w,
int  h 
)

Resize the SDL window and associated graphics stuff to the new size.

◆ SetCursor()

void CVideoMode::SetCursor ( const CStrW &  name)

◆ SetFullscreen()

bool CVideoMode::SetFullscreen ( bool  fullscreen)

Switch to fullscreen or windowed mode.

◆ SetVideoMode()

bool CVideoMode::SetVideoMode ( int  w,
int  h,
int  bpp,
bool  fullscreen 
)
private

◆ SetWindowIcon()

void CVideoMode::SetWindowIcon ( )

◆ Shutdown()

void CVideoMode::Shutdown ( )

Shut down after InitSDL/InitNonSDL, so that they can be used again.

◆ ToggleFullscreen()

bool CVideoMode::ToggleFullscreen ( )

Switch between fullscreen and windowed mode.

◆ TryCreateBackendDevice()

bool CVideoMode::TryCreateBackendDevice ( SDL_Window window)
private

◆ UpdatePosition()

void CVideoMode::UpdatePosition ( int  x,
int  y 
)

Update window position, to restore later if necessary (SDL2 only).

◆ UpdateRenderer()

void CVideoMode::UpdateRenderer ( int  w,
int  h 
)
static

Update the graphics code to start drawing to the new size.

This should be called after the GL context has been resized. This can also be used when the GL context is managed externally, not via SDL.

Member Data Documentation

◆ m_Backend

◆ m_BackendDevice

std::unique_ptr<Renderer::Backend::IDevice> CVideoMode::m_BackendDevice
private

◆ m_ConfigBPP

int CVideoMode::m_ConfigBPP = 0
private

◆ m_ConfigDisplay

int CVideoMode::m_ConfigDisplay = 0
private

◆ m_ConfigEnableHiDPI

bool CVideoMode::m_ConfigEnableHiDPI = false
private

◆ m_ConfigFullscreen

bool CVideoMode::m_ConfigFullscreen = false
private

◆ m_ConfigH

int CVideoMode::m_ConfigH = 0
private

◆ m_ConfigVSync

bool CVideoMode::m_ConfigVSync = false
private

◆ m_ConfigW

int CVideoMode::m_ConfigW = 0
private

◆ m_CurrentBPP

int CVideoMode::m_CurrentBPP
private

◆ m_CurrentH

int CVideoMode::m_CurrentH
private

◆ m_CurrentW

int CVideoMode::m_CurrentW
private

◆ m_Cursor

std::unique_ptr<CCursor> CVideoMode::m_Cursor
private

◆ m_IsFullscreen

bool CVideoMode::m_IsFullscreen = false
private

◆ m_IsInitialised

bool CVideoMode::m_IsInitialised = false
private

Remember whether Init has been called.

(This isn't used for anything important, just for verifying that the callers call our methods in the right order.)

◆ m_PreferredBPP

int CVideoMode::m_PreferredBPP = 0
private

◆ m_PreferredFreq

int CVideoMode::m_PreferredFreq = 0
private

◆ m_PreferredH

int CVideoMode::m_PreferredH = 0
private

◆ m_PreferredW

int CVideoMode::m_PreferredW = 0
private

◆ m_Scale

float CVideoMode::m_Scale = 1.0f
private

◆ m_Window

SDL_Window* CVideoMode::m_Window = nullptr
private

◆ m_WindowedH

int CVideoMode::m_WindowedH
private

◆ m_WindowedW

int CVideoMode::m_WindowedW
private

◆ m_WindowedX

int CVideoMode::m_WindowedX
private

◆ m_WindowedY

int CVideoMode::m_WindowedY
private

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