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
25//------------------------------------------------------------------------------
26namespace Base
27{
29{
32public:
36 virtual ~DisplayDeviceBase();
37
39 bool Open();
41 void Close();
43 bool IsOpen() const;
47 void Reopen();
48
50 void SetVerticalSyncEnabled(bool b);
52 const bool IsVerticalSyncEnabled() const;
53
64
69
71 const bool IsFullscreen() const;
72
77
87 const CoreGraphics::WindowId GetWindow(IndexT index) const;
92
93protected:
96
98
100 bool isOpen;
102
106};
107
108//------------------------------------------------------------------------------
111inline bool
113{
114 return this->isOpen;
115}
116
117//------------------------------------------------------------------------------
120inline void
125
126//------------------------------------------------------------------------------
129inline const bool
131{
132 return this->verticalSync;
133}
134
135//------------------------------------------------------------------------------
138inline void
143
144//------------------------------------------------------------------------------
149{
150 return this->adapter;
151}
152
153//------------------------------------------------------------------------------
156inline const bool
158{
159 return this->isFullscreen;
160}
161
162//------------------------------------------------------------------------------
167{
168 if (this->windows.Size() >= 1) return this->windows[0];
169 else return NULL;
170}
171
172//------------------------------------------------------------------------------
175inline const CoreGraphics::WindowId
177{
178 return this->currentWindow;
179}
180
181//------------------------------------------------------------------------------
184inline const CoreGraphics::WindowId
186{
187 n_assert(this->windows.Size() > index && index != InvalidIndex);
188 return this->windows[index];
189}
190
191//------------------------------------------------------------------------------
196{
197 return this->windows;
198}
199
200} // namespace Base
201//------------------------------------------------------------------------------
202
A DisplayDevice object represents the display where the RenderDevice presents the rendered frame.
Definition displaydevicebase.h:29
Util::Array< CoreGraphics::WindowId > windows
Definition displaydevicebase.h:105
CoreGraphics::WindowId GetMainWindow() const
get the 'main' window, if none exists, returns NULL
Definition displaydevicebase.h:166
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
CoreGraphics::WindowId currentWindow
Definition displaydevicebase.h:104
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:194
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:103
CoreGraphics::Adapter::Code GetAdapter() const
get display adapter
Definition displaydevicebase.h:148
const bool IsVerticalSyncEnabled() const
get if vertical sync is enabled
Definition displaydevicebase.h:130
const CoreGraphics::WindowId GetCurrentWindow() const
get the current window
Definition displaydevicebase.h:176
CoreGraphics::WindowId EmbedWindow(const Util::Blob &windowData)
create a window from one created by another window system
Definition displaydevicebase.cc:214
bool IsOpen() const
return true if display is currently open
Definition displaydevicebase.h:112
const CoreGraphics::WindowId GetWindow(IndexT index) const
get window using index, where 0 is the default window
Definition displaydevicebase.h:185
bool isOpen
Definition displaydevicebase.h:100
CoreGraphics::Adapter::Code adapter
Definition displaydevicebase.h:97
bool isFullscreen
Definition displaydevicebase.h:101
const Util::Array< CoreGraphics::WindowId > & GetWindows() const
get all windows as an array
Definition displaydevicebase.h:195
bool verticalSync
Definition displaydevicebase.h:99
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:121
void SetAdapter(CoreGraphics::Adapter::Code a)
set display adapter (make sure adapter exists!)
Definition displaydevicebase.h:139
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:157
bool Open()
open the display
Definition displaydevicebase.cc:42
__DeclareClass(DisplayDeviceBase)
void MakeWindowCurrent(const CoreGraphics::WindowId id)
make ID the current one
Definition displaydevicebase.cc:228
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
const SizeT Size() const
get number of elements in array
Definition array.h:880
The Util::Blob class encapsulates a chunk of raw memory into a C++ object which can be copied,...
Definition blob.h:22
#define n_assert(exp)
Definition debug.h:50
Definition gamecontentserverbase.cc:10
Definition window.h:25
Nebula's universal string class.
Definition string.h:50
static const int InvalidIndex
Definition types.h:54
int IndexT
Definition types.h:48