Nebula
Loading...
Searching...
No Matches
displaydevicebase.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
15#include "core/refcounted.h"
16#include "core/singleton.h"
22#include "util/blob.h"
23#include "coregraphics/window.h"
24
25namespace CoreGraphics
26{
33}
34//------------------------------------------------------------------------------
35namespace Base
36{
38{
41public:
45 virtual ~DisplayDeviceBase();
46
48 bool Open();
50 void Close();
52 bool IsOpen() const;
56 void Reopen();
57
59 void SetVerticalSyncEnabled(bool b);
61 const bool IsVerticalSyncEnabled() const;
62
73
76
81
83 const bool IsFullscreen() const;
84
89
93 const CoreGraphics::WindowId GetWindow(IndexT index) const;
96
97protected:
100
102
104 bool isOpen;
106
109};
110
111//------------------------------------------------------------------------------
114inline bool
116{
117 return this->isOpen;
118}
119
120//------------------------------------------------------------------------------
123inline void
128
129//------------------------------------------------------------------------------
132inline const bool
134{
135 return this->verticalSync;
136}
137
138//------------------------------------------------------------------------------
141inline void
146
147//------------------------------------------------------------------------------
152{
153 return this->adapter;
154}
155
156//------------------------------------------------------------------------------
159inline const bool
161{
162 return this->isFullscreen;
163}
164
165//------------------------------------------------------------------------------
168inline const CoreGraphics::WindowId
170{
171 n_assert(this->windows.Size() > index && index != InvalidIndex);
172 return this->windows[index];
173}
174
175//------------------------------------------------------------------------------
180{
181 return this->windows;
182}
183
184} // namespace Base
185//------------------------------------------------------------------------------
186
Util::Array< CoreGraphics::WindowId > windows
Definition displaydevicebase.h:108
void AttachEventHandler(const Ptr< CoreGraphics::DisplayEventHandler > &h)
attach a display event handler
Definition displaydevicebase.cc:85
bool NotifyEventHandlers(const CoreGraphics::DisplayEvent &e)
notify event handlers about an event
Definition displaydevicebase.cc:112
void RemoveEventHandler(const Ptr< CoreGraphics::DisplayEventHandler > &h)
remove a display event handler
Definition displaydevicebase.cc:98
DisplayDeviceBase()
constructor
Definition displaydevicebase.cc:20
void Close()
close the display
Definition displaydevicebase.cc:54
Util::Array< CoreGraphics::DisplayMode > GetAvailableDisplayModes(CoreGraphics::Adapter::Code adapter, CoreGraphics::PixelFormat::Code pixelFormat)
get available display modes on given adapter
Definition displaydevicebase.cc:138
bool AdapterExists(CoreGraphics::Adapter::Code adapter)
return true if adapter exists
Definition displaydevicebase.cc:174
CoreGraphics::WindowId SetupWindow(const Util::String &title, const Util::String &icon, const CoreGraphics::DisplayMode &displayMode, const CoreGraphics::AntiAliasQuality::Code aa=CoreGraphics::AntiAliasQuality::None)
create a new window
Definition displaydevicebase.cc:203
CoreGraphics::DisplayMode GetCurrentAdapterDisplayMode(CoreGraphics::Adapter::Code adapter)
get current adapter display mode (i.e. the desktop display mode)
Definition displaydevicebase.cc:163
Util::Array< Ptr< CoreGraphics::DisplayEventHandler > > eventHandlers
Definition displaydevicebase.h:107
CoreGraphics::Adapter::Code GetAdapter() const
get display adapter
Definition displaydevicebase.h:151
const bool IsVerticalSyncEnabled() const
get if vertical sync is enabled
Definition displaydevicebase.h:133
bool IsOpen() const
return true if display is currently open
Definition displaydevicebase.h:115
const CoreGraphics::WindowId GetWindow(IndexT index) const
get window using index, where 0 is the default window
Definition displaydevicebase.h:169
bool isOpen
Definition displaydevicebase.h:104
Util::FixedArray< CoreGraphics::Monitor > GetMonitors()
Get list of monitors.
Definition displaydevicebase.cc:194
CoreGraphics::Adapter::Code adapter
Definition displaydevicebase.h:101
bool isFullscreen
Definition displaydevicebase.h:105
const Util::Array< CoreGraphics::WindowId > & GetWindows() const
get all windows as an array
Definition displaydevicebase.h:179
bool verticalSync
Definition displaydevicebase.h:103
void Reopen()
reopens the display device which enables switching from display modes
Definition displaydevicebase.cc:71
__DeclareSingleton(DisplayDeviceBase)
void ProcessWindowMessages()
process window system messages, call this method once per frame
Definition displaydevicebase.cc:128
void SetVerticalSyncEnabled(bool b)
set if vertical sync should be used
Definition displaydevicebase.h:124
void SetAdapter(CoreGraphics::Adapter::Code a)
set display adapter (make sure adapter exists!)
Definition displaydevicebase.h:142
bool SupportsDisplayMode(CoreGraphics::Adapter::Code adapter, const CoreGraphics::DisplayMode &requestedMode)
return true if a given display mode is supported
Definition displaydevicebase.cc:152
const bool IsFullscreen() const
get if a window is running in full screen
Definition displaydevicebase.h:160
bool Open()
open the display
Definition displaydevicebase.cc:42
__DeclareClass(DisplayDeviceBase)
CoreGraphics::AdapterInfo GetAdapterInfo(CoreGraphics::Adapter::Code adapter)
get general info about display adapter
Definition displaydevicebase.cc:184
virtual ~DisplayDeviceBase()
destructor
Definition displaydevicebase.cc:31
The common base class of Nebula.
Definition refcounted.h:38
Code
enum
Definition adapter.h:23
Contains information about a given display adapter.
Definition adapterinfo.h:23
Code
enum
Definition antialiasquality.h:24
@ None
Definition antialiasquality.h:25
Display events are sent by the display device to registered display event handlers.
Definition displayevent.h:24
Describe a fullscreen display mode or window dimensions.
Definition displaymode.h:19
Code
enums
Definition pixelformat.h:26
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Nebula's dynamic array class.
Definition array.h:60
Implements a fixed size one-dimensional array.
Definition fixedarray.h:20
#define n_assert(exp)
Definition debug.h:50
Definition gamecontentserverbase.cc:10
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition accelerationstructure.h:24
Definition displaydevicebase.h:28
SizeT redBits
Definition displaydevicebase.h:30
SizeT width
Definition displaydevicebase.h:29
SizeT refreshRate
Definition displaydevicebase.h:31
SizeT greenBits
Definition displaydevicebase.h:30
SizeT height
Definition displaydevicebase.h:29
SizeT blueBits
Definition displaydevicebase.h:30
Definition window.h:25
Nebula's universal string class.
Definition String.cs:8
static const int InvalidIndex
Definition types.h:47
int SizeT
Definition types.h:42
int IndexT
Definition types.h:41