OpenBarnyard
 
Loading...
Searching...
No Matches
ADisplayModes_Win.cpp
Go to the documentation of this file.
1#include "pch.h"
2#include "ADisplayModes_Win.h"
3
5
6//-----------------------------------------------------------------------------
7// Enables memory debugging.
8// Note: Should be the last include!
9//-----------------------------------------------------------------------------
10#include <Core/TMemoryDebugOn.h>
11
13
15
17{
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}
77
78TBOOL ADisplayModes_Win::IsModeExists( const TUINT32& a_rWidth, const TUINT32& a_rHeight, const TUINT32& a_rColourDepth )
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 TSTATICCAST(POINTERTYPE, VALUE)
Definition Defines.h:69
#define TOSHI_NAMESPACE_USING
Definition Defines.h:46
#define T2_FOREACH(vecName, iteratorName)
Definition T2Iterator.h:4
#define TDEFINE_CLASS(...)
Definition TObject.h:120
uint32_t TUINT32
Definition Typedefs.h:13
#define TFALSE
Definition Typedefs.h:24
#define TTRUE
Definition Typedefs.h:25
bool TBOOL
Definition Typedefs.h:6
DirectX 8 implementation of the render interface Handles DirectX 8 specific rendering functionality a...
static TFORCEINLINE TRenderInterface * GetSingleton()
Definition TSingleton.h:49
TBOOL IsModeExists(const TUINT32 &a_rWidth, const TUINT32 &a_rHeight, const TUINT32 &a_rColourDepth)