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

#include <ADisplayModes_Win.h>

Inheritance diagram for ADisplayModes_Win:

Classes

struct  Mode
 

Public Member Functions

 TDECLARE_CLASS (ADisplayModes_Win, Toshi::TObject)
 
 ADisplayModes_Win ()=default
 
void Initialise ()
 
TBOOL IsModeExists (const TUINT32 &a_rWidth, const TUINT32 &a_rHeight, const TUINT32 &a_rColourDepth)
 

Detailed Description

Definition at line 4 of file ADisplayModes_Win.h.

Constructor & Destructor Documentation

◆ ADisplayModes_Win()

ADisplayModes_Win::ADisplayModes_Win ( )
default

Member Function Documentation

◆ Initialise()

void ADisplayModes_Win::Initialise ( )

Definition at line 16 of file ADisplayModes_Win.cpp.

17{
18 auto pRenderer = TSTATICCAST( TRenderD3DInterface, TRenderInterface::GetSingleton() );
19 auto pAdapterList = pRenderer->GetAdapterList();
20
21 T2_FOREACH( *pAdapterList, pAdapter )
22 {
23 auto uiNumSupportedDevices = pAdapter->GetNumSupportedDevices();
24 auto pModeList = pAdapter->GetModeList();
25
26 T2_FOREACH( *pModeList, pMode )
27 {
28 for ( TUINT32 i = 0; i < uiNumSupportedDevices; i++ )
29 {
30 auto pDevice = pMode->GetDevice( i );
31
32 if ( !pDevice->IsSoftware() )
33 {
34 if ( !pDevice->GetMode()->Is32Bit() && !pDevice->GetMode()->Is16Bit() )
35 {
36 continue;
37 }
38
39 auto uiWidth = pDevice->GetMode()->GetWidth();
40 auto uiHeight = pDevice->GetMode()->GetHeight();
41
42 if ( uiWidth == ( uiHeight / 3 ) * 4 || // 4:3
43 uiHeight == ( uiWidth / 3 ) * 4 || // 4:3
44 uiWidth == ( uiHeight / 4 ) * 5 || // 5:4
45 uiWidth == ( uiHeight / 5 ) * 4 || // 4:5
46 uiWidth == ( uiHeight / 9 ) * 16 || // 16:9
47 uiWidth == ( uiHeight / 10 ) * 16 ) // 16:10
48 {
49 if ( ( 640 <= uiWidth && 480 <= uiHeight ) || // 4:3
50 ( 1280 <= uiWidth && 1024 <= uiHeight ) || // 5:4
51 ( 1024 <= uiWidth && 1280 <= uiHeight ) || // 4:5
52 ( 1280 <= uiWidth && 720 <= uiHeight ) || // 16:9
53 ( 1440 <= uiWidth && 900 <= uiHeight ) ) // 16:10
54 {
55 if ( pDevice->GetMode()->Is16Bit() )
56 {
57 if ( !IsModeExists( uiWidth, uiHeight, 16 ) )
58 {
59 m_Modes.PushBack( { .m_uiWidth = uiWidth, .m_uiHeight = uiHeight, .m_uiColourDepth = 16 } );
60 }
61 }
62
63 if ( pDevice->GetMode()->Is32Bit() )
64 {
65 if ( !IsModeExists( uiWidth, uiHeight, 32 ) )
66 {
67 m_Modes.PushBack( { .m_uiWidth = uiWidth, .m_uiHeight = uiHeight, .m_uiColourDepth = 32 } );
68 }
69 }
70 }
71 }
72 }
73 }
74 }
75 }
76}
#define TSTATICCAST(POINTERTYPE, VALUE)
Definition Defines.h:69
#define T2_FOREACH(vecName, iteratorName)
Definition T2Iterator.h:4
uint32_t TUINT32
Definition Typedefs.h:13
static TFORCEINLINE TRenderInterface * GetSingleton()
Definition TSingleton.h:49
TBOOL IsModeExists(const TUINT32 &a_rWidth, const TUINT32 &a_rHeight, const TUINT32 &a_rColourDepth)

◆ IsModeExists()

TBOOL ADisplayModes_Win::IsModeExists ( const TUINT32 & a_rWidth,
const TUINT32 & a_rHeight,
const TUINT32 & a_rColourDepth )

Definition at line 78 of file ADisplayModes_Win.cpp.

79{
80 T2_FOREACH( m_Modes, it )
81 {
82 if ( it->m_uiWidth == a_rWidth && it->m_uiHeight == a_rHeight && it->m_uiColourDepth == a_rColourDepth )
83 {
84 return TTRUE;
85 }
86 }
87
88 return TFALSE;
89}
#define TFALSE
Definition Typedefs.h:24
#define TTRUE
Definition Typedefs.h:25

◆ TDECLARE_CLASS()

ADisplayModes_Win::TDECLARE_CLASS ( ADisplayModes_Win ,
Toshi::TObject  )

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