Rise
The Vieneo Province
Toggle main menu visibility
Loading...
Searching...
No Matches
Window11.h
Go to the documentation of this file.
1
#pragma once
2
#include "
DrawContext11.h
"
3
#include <functional>
4
5
namespace
Rendering
6
{
7
struct
WindowOptions11
8
{
9
HINSTANCE
instance
=
nullptr
;
10
std::wstring
title
=L
"Rise: The Vieneo Province"
;
11
UINT
width
=1280,
height
=720,
samples
=1;
12
bool
debugLayer
=
false
,
warp
=
false
,
visible
=
true
;
13
bool
borderless
=
false
,
centered
=
false
;
14
bool
vsync
=
true
;
15
};
16
// The game owns its callbacks and data. This host owns Win32, presentation,
17
// resize/minimize and device recreation without a DXUT message loop.
18
class
Window11
19
{
20
public
:
21
struct
Callbacks
22
{
23
std::function<
HRESULT
()>
create
;
24
std::function<
HRESULT
(UINT,UINT)>
resize
;
25
std::function<
void
()>
releaseSizeDependent
;
26
std::function<
void
()>
destroy
;
27
// Called only after a successful, visible presentation.
28
std::function<
HRESULT
()>
presented
;
29
std::function<
void
(
double
,
float
)>
move
;
30
std::function<
HRESULT
(
double
,
float
)>
draw
;
31
std::function<LRESULT(HWND,UINT,WPARAM,LPARAM,
bool
&)>
message
;
32
std::function<
void
(UINT,
bool
,
bool
)>
keyboard
;
33
std::function<
void
(
const
std::string&,
HRESULT
)>
report
;
34
};
35
HRESULT
Create
(
const
WindowOptions11
&
options
,
Callbacks
callbacks
);
36
int
Run
();
37
HRESULT
Frame
();
38
HRESULT
Resize
(UINT
width
,UINT
height
);
39
HRESULT
RecreateDevice
();
40
HRESULT
SetFullscreen
(
bool
value);
41
HRESULT
SetSamples
(UINT samples);
42
void
SetVSync
(
bool
value){
options
.
vsync
=value;}
43
bool
VSync
()
const
{
return
options
.
vsync
;}
44
void
Close
(
int
result=0);
45
// Detach game callbacks while retaining the device for remaining
46
// game-owned resources. Destroy completes device teardown afterward.
47
void
StopCallbacksAndWindow
();
48
void
Destroy
();
49
~Window11
(){
Destroy
();}
50
HWND
Handle
()
const
{
return
window
;}
51
Device11
&
Device
() {
return
device
;}
52
DrawContext11
&
Draws
() {
return
draws
;}
53
bool
Fullscreen
()
const
{
return
fullscreen
;}
54
bool
Recovering
()
const
{
return
recovering
;}
55
bool
Suspended
()
const
{
return
minimized
||
device
.
Suspended
();}
56
double
Time
()
const
;
57
void
ResetFrameClock
(){QueryPerformanceCounter(&
previous
);}
58
void
ResetClock
(){QueryPerformanceCounter(&
started
);
previous
=
started
;
fpsStart
=0;
frames
=0;
fps
=0;}
59
float
FPS
()
const
{
return
fps
;}
60
const
std::string&
Status
()
const
{
return
status
;}
61
private
:
62
static
LRESULT CALLBACK
Procedure
(HWND,UINT,WPARAM,LPARAM);
63
LRESULT
Message
(HWND,UINT,WPARAM,LPARAM);
64
HRESULT
CreateDevice
();
65
HRESULT
Failure
(
const
char
* operation,
HRESULT
result);
66
WindowOptions11
options
;
67
Callbacks
callbacks
;
68
HWND
window
=
nullptr
;
69
Device11
device
;
70
DrawContext11
draws
;
71
LARGE_INTEGER
frequency
{},
started
{},
previous
{};
72
double
fpsStart
=0;
73
unsigned
frames
=0;
74
float
fps
=0;
75
UINT
width
=0,
height
=0;
76
int
exitCode
=0;
77
bool
initialized
=
false
,
running
=
false
,
minimized
=
false
,
fullscreen
=
false
,
creating
=
false
,
inFrame
=
false
,
occluded
=
false
;
78
bool
callbacksLive
=
false
,
recovering
=
false
;
79
std::string
status
;
80
};
81
}
HRESULT
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
DrawContext11.h
Message
Definition
Message.h:14
Rendering::Device11
Definition
Device11.h:39
Rendering::Device11::Suspended
bool Suspended() const
Definition
Device11.h:73
Rendering::DrawContext11
Definition
DrawContext11.h:23
Rendering::Window11
Definition
Window11.h:19
Rendering::Window11::Time
double Time() const
Definition
Window11.cpp:19
Rendering::Window11::started
LARGE_INTEGER started
Definition
Window11.h:71
Rendering::Window11::Run
int Run()
Definition
Window11.cpp:199
Rendering::Window11::width
UINT width
Definition
Window11.h:75
Rendering::Window11::Failure
HRESULT Failure(const char *operation, HRESULT result)
Definition
Window11.cpp:13
Rendering::Window11::Draws
DrawContext11 & Draws()
Definition
Window11.h:52
Rendering::Window11::frames
unsigned frames
Definition
Window11.h:73
Rendering::Window11::Recovering
bool Recovering() const
Definition
Window11.h:54
Rendering::Window11::Frame
HRESULT Frame()
Definition
Window11.cpp:129
Rendering::Window11::inFrame
bool inFrame
Definition
Window11.h:77
Rendering::Window11::recovering
bool recovering
Definition
Window11.h:78
Rendering::Window11::StopCallbacksAndWindow
void StopCallbacksAndWindow()
Definition
Window11.cpp:220
Rendering::Window11::Fullscreen
bool Fullscreen() const
Definition
Window11.h:53
Rendering::Window11::initialized
bool initialized
Definition
Window11.h:77
Rendering::Window11::Create
HRESULT Create(const WindowOptions11 &options, Callbacks callbacks)
Definition
Window11.cpp:24
Rendering::Window11::draws
DrawContext11 draws
Definition
Window11.h:70
Rendering::Window11::SetSamples
HRESULT SetSamples(UINT samples)
Definition
Window11.cpp:90
Rendering::Window11::height
UINT height
Definition
Window11.h:75
Rendering::Window11::options
WindowOptions11 options
Definition
Window11.h:66
Rendering::Window11::SetVSync
void SetVSync(bool value)
Definition
Window11.h:42
Rendering::Window11::Resize
HRESULT Resize(UINT width, UINT height)
Definition
Window11.cpp:74
Rendering::Window11::FPS
float FPS() const
Definition
Window11.h:59
Rendering::Window11::minimized
bool minimized
Definition
Window11.h:77
Rendering::Window11::fps
float fps
Definition
Window11.h:74
Rendering::Window11::Handle
HWND Handle() const
Definition
Window11.h:50
Rendering::Window11::VSync
bool VSync() const
Definition
Window11.h:43
Rendering::Window11::Procedure
static LRESULT CALLBACK Procedure(HWND, UINT, WPARAM, LPARAM)
Definition
Window11.cpp:238
Rendering::Window11::Status
const std::string & Status() const
Definition
Window11.h:60
Rendering::Window11::status
std::string status
Definition
Window11.h:79
Rendering::Window11::running
bool running
Definition
Window11.h:77
Rendering::Window11::device
Device11 device
Definition
Window11.h:69
Rendering::Window11::fullscreen
bool fullscreen
Definition
Window11.h:77
Rendering::Window11::Suspended
bool Suspended() const
Definition
Window11.h:55
Rendering::Window11::callbacksLive
bool callbacksLive
Definition
Window11.h:78
Rendering::Window11::previous
LARGE_INTEGER previous
Definition
Window11.h:71
Rendering::Window11::window
HWND window
Definition
Window11.h:68
Rendering::Window11::callbacks
Callbacks callbacks
Definition
Window11.h:67
Rendering::Window11::frequency
LARGE_INTEGER frequency
Definition
Window11.h:71
Rendering::Window11::creating
bool creating
Definition
Window11.h:77
Rendering::Window11::occluded
bool occluded
Definition
Window11.h:77
Rendering::Window11::ResetClock
void ResetClock()
Definition
Window11.h:58
Rendering::Window11::ResetFrameClock
void ResetFrameClock()
Definition
Window11.h:57
Rendering::Window11::SetFullscreen
HRESULT SetFullscreen(bool value)
Definition
Window11.cpp:120
Rendering::Window11::~Window11
~Window11()
Definition
Window11.h:49
Rendering::Window11::Device
Device11 & Device()
Definition
Window11.h:51
Rendering::Window11::CreateDevice
HRESULT CreateDevice()
Definition
Window11.cpp:61
Rendering::Window11::RecreateDevice
HRESULT RecreateDevice()
Definition
Window11.cpp:105
Rendering::Window11::fpsStart
double fpsStart
Definition
Window11.h:72
Rendering::Window11::Close
void Close(int result=0)
Definition
Window11.cpp:216
Rendering::Window11::Destroy
void Destroy()
Definition
Window11.cpp:234
Rendering::Window11::exitCode
int exitCode
Definition
Window11.h:76
Rendering
Definition
AdDiagnostics11.cpp:16
void
typedef void(S_CALLTYPE *SteamAPIWarningMessageHook_t)(int
Rendering::Window11::Callbacks
Definition
Window11.h:22
Rendering::Window11::Callbacks::resize
std::function< HRESULT(UINT, UINT)> resize
Definition
Window11.h:24
Rendering::Window11::Callbacks::destroy
std::function< void()> destroy
Definition
Window11.h:26
Rendering::Window11::Callbacks::move
std::function< void(double, float)> move
Definition
Window11.h:29
Rendering::Window11::Callbacks::message
std::function< LRESULT(HWND, UINT, WPARAM, LPARAM, bool &)> message
Definition
Window11.h:31
Rendering::Window11::Callbacks::presented
std::function< HRESULT()> presented
Definition
Window11.h:28
Rendering::Window11::Callbacks::report
std::function< void(const std::string &, HRESULT)> report
Definition
Window11.h:33
Rendering::Window11::Callbacks::create
std::function< HRESULT()> create
Definition
Window11.h:23
Rendering::Window11::Callbacks::keyboard
std::function< void(UINT, bool, bool)> keyboard
Definition
Window11.h:32
Rendering::Window11::Callbacks::releaseSizeDependent
std::function< void()> releaseSizeDependent
Definition
Window11.h:25
Rendering::Window11::Callbacks::draw
std::function< HRESULT(double, float)> draw
Definition
Window11.h:30
Rendering::WindowOptions11
Definition
Window11.h:8
Rendering::WindowOptions11::samples
UINT samples
Definition
Window11.h:11
Rendering::WindowOptions11::height
UINT height
Definition
Window11.h:11
Rendering::WindowOptions11::warp
bool warp
Definition
Window11.h:12
Rendering::WindowOptions11::vsync
bool vsync
Definition
Window11.h:14
Rendering::WindowOptions11::visible
bool visible
Definition
Window11.h:12
Rendering::WindowOptions11::borderless
bool borderless
Definition
Window11.h:13
Rendering::WindowOptions11::instance
HINSTANCE instance
Definition
Window11.h:9
Rendering::WindowOptions11::centered
bool centered
Definition
Window11.h:13
Rendering::WindowOptions11::debugLayer
bool debugLayer
Definition
Window11.h:12
Rendering::WindowOptions11::width
UINT width
Definition
Window11.h:11
Rendering::WindowOptions11::title
std::wstring title
Definition
Window11.h:10
Rendering
Window11.h
Generated on
for Rise by
1.18.0