Rise
The Vieneo Province
Toggle main menu visibility
Loading...
Searching...
No Matches
Screen.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
Page.h
"
4
5
class
Screen
6
{
7
//Logger* logger;
8
//D3D10_VIEWPORT viewport;
9
//DeviceObject* pDevice;
10
//ID3DX10Font* pFont = nullptr;
11
//ID3D10RasterizerState* state = nullptr;
12
int
lastPage
= -1;
13
HRESULT
hr
= 0;
14
Bus
*
bus
;
15
char
*
vdat
;
16
17
public
:
18
/*
19
RiseMath::Matrix matProjection;
20
RiseMath::Matrix matView;
21
bool initialized = false;*/
22
UINT
currentPage
= 0;
23
24
// config items
25
std::string
name
;
26
bool
bypassVdat
=
false
;
27
std::vector<Page>
pages
;
28
29
int
width
= 0;
30
int
height
= 0;
31
int
x
= 0;
32
int
y
= 0;
33
RECT
rect
= RECT();
34
35
bool
Render
()
36
{
37
// @todo we want to add effects for values between 1 and 126 like color weirdness, blocks, weird fonts, etc
38
if
(!
bypassVdat
&& *
vdat
<= 0)
39
return
false
;
40
41
if
(
currentPage
>=
pages
.size())
42
throw
std::exception(
"Tried to render a current page that is outside of the pages collection!"
);
43
44
pages
.at(
currentPage
).Render();
45
46
return
true
;
47
}
48
49
~Screen
()
50
{
51
pages
.clear();
52
}
53
54
bool
HandleKeyPress
(
short
key,
bool
shift)
55
{
56
if
(
currentPage
>=
pages
.size())
57
throw
std::exception(
"Tried to handle keypress for current page that is outside of the pages collection!"
);
58
return
pages
.at(
currentPage
).HandleKeyPress(key, shift);
59
}
60
61
bool
UpdateKeyRepeat
(
const
unsigned
char
* keys,
bool
shift,
float
elapsed)
62
{
63
if
(
currentPage
>=
pages
.size())
return
false
;
64
return
pages
.at(
currentPage
).UpdateKeyRepeat(
65
bypassVdat
|| *
vdat
> 0 ? keys :
nullptr
, shift, elapsed);
66
}
67
68
void
FrameMove
(
float
fElapsed)
69
{
70
Rendering::ProfileCpuScope11
screenTiming(
"Screen"
,
name
.c_str());
71
if
(
currentPage
>=
pages
.size())
72
throw
std::exception(
"Tried to frameMove a current page that is outside of the pages collection!"
);
73
pages
.at(
currentPage
).FrameMove(fElapsed);
74
}
75
76
bool
ChangePage
(
const
std::string& pageName)
77
{
78
for
(UINT i = 0; i <
pages
.size(); i++)
79
{
80
if
(
pages
.at(i).name == pageName)
81
{
82
ChangePage
(i);
83
return
true
;
84
}
85
}
86
return
false
;
87
}
88
89
void
OnPageChange
(
bool
sendUpdate =
true
)
90
{
91
pages
.at(
currentPage
).OnPageChanged();
92
93
if
(!sendUpdate)
94
return
;
95
96
Command
command;
97
command.
name
=
"UpdateMfdPage"
;
98
command.
ivalues
[0] =
currentPage
;
99
command.
ivalues
[1] =
lastPage
;
100
bus
->
commandStream
.emplace_back(command);
101
}
102
103
void
ChangePage
(UINT i)
104
{
105
if
(
currentPage
== i)
106
return
;
// no change
107
108
if
(i < 0 || i >=
pages
.size())
109
throw
std::exception(
"Tried to ChangePage using a current page that is outside of the pages collection!"
);
110
111
lastPage
=
currentPage
;
112
currentPage
= i;
113
114
OnPageChange
(
false
);
115
}
116
117
void
RestorePage
()
118
{
119
if
(
lastPage
!= -1)
120
{
121
currentPage
=
lastPage
;
122
lastPage
= -1;
123
if
(
currentPage < 0 || currentPage >
=
pages
.size())
124
throw
std::exception(
"Tried to RestorePage on a current page that is outside of the pages collection!"
);
125
OnPageChange
();
126
}
127
}
128
129
Screen
()
130
{
131
bus
=
nullptr
;
132
vdat
=
nullptr
;
133
}
134
135
Screen
(
Bus
* prmBus,
char
* prmVdat)
136
{
137
bus
= prmBus;
138
vdat
= prmVdat;
139
}
140
};
HRESULT
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
Page.h
Bus
Definition
Bus.h:20
Bus::commandStream
std::vector< Command > commandStream
Definition
Bus.h:442
Rendering::ProfileCpuScope11
Definition
FrameProfiler11.h:697
Screen::name
std::string name
Definition
Screen.h:25
Screen::Screen
Screen(Bus *prmBus, char *prmVdat)
Definition
Screen.h:135
Screen::y
int y
Definition
Screen.h:32
Screen::bypassVdat
bool bypassVdat
Definition
Screen.h:26
Screen::~Screen
~Screen()
Definition
Screen.h:49
Screen::width
int width
Definition
Screen.h:29
Screen::Render
bool Render()
Definition
Screen.h:35
Screen::height
int height
Definition
Screen.h:30
Screen::vdat
char * vdat
Definition
Screen.h:15
Screen::x
int x
Definition
Screen.h:31
Screen::ChangePage
void ChangePage(UINT i)
Definition
Screen.h:103
Screen::bus
Bus * bus
Definition
Screen.h:14
Screen::rect
RECT rect
Definition
Screen.h:33
Screen::HandleKeyPress
bool HandleKeyPress(short key, bool shift)
Definition
Screen.h:54
Screen::FrameMove
void FrameMove(float fElapsed)
Definition
Screen.h:68
Screen::pages
std::vector< Page > pages
Definition
Screen.h:27
Screen::hr
HRESULT hr
Definition
Screen.h:13
Screen::lastPage
int lastPage
Definition
Screen.h:12
Screen::currentPage
UINT currentPage
Definition
Screen.h:22
Screen::UpdateKeyRepeat
bool UpdateKeyRepeat(const unsigned char *keys, bool shift, float elapsed)
Definition
Screen.h:61
Screen::RestorePage
void RestorePage()
Definition
Screen.h:117
Screen::Screen
Screen()
Definition
Screen.h:129
Screen::ChangePage
bool ChangePage(const std::string &pageName)
Definition
Screen.h:76
Screen::OnPageChange
void OnPageChange(bool sendUpdate=true)
Definition
Screen.h:89
Command
Definition
Command.h:6
Command::ivalues
int ivalues[2]
Definition
Command.h:21
Command::name
std::string name
Definition
Command.h:11
Displays
Screen.h
Generated on
for Rise by
1.18.0