Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Divide::DisplayWindow Class Referencefinal

#include <DisplayWindow.h>

+ Inheritance diagram for Divide::DisplayWindow:

Classes

struct  UserData
 
struct  WindowEventArgs
 

Public Types

using EventListener = DELEGATE< bool, const WindowEventArgs & >
 

Public Member Functions

virtual ~DisplayWindow () override
 
 DisplayWindow (WindowManager &parent, PlatformContext &context)
 
ErrorCode init (U32 windowFlags, WindowType initialType, const WindowDescriptor &descriptor)
 
ErrorCode destroyWindow ()
 
SDL_WindowgetRawWindow () const noexcept
 
I32 currentDisplayIndex () const noexcept
 
bool isHovered () const noexcept
 
bool hasFocus () const noexcept
 
bool minimized () const noexcept
 
void minimized (bool state) noexcept
 
bool maximized () const noexcept
 
void maximized (bool state) noexcept
 
bool hidden () const noexcept
 
void hidden (bool state) noexcept
 
bool decorated () const noexcept
 
void decorated (bool state) noexcept
 
bool fullscreen () const noexcept
 
void changeType (WindowType newType)
 
void changeToPreviousType ()
 
void opacity (U8 opacity) noexcept
 
U8 prevOpacity () const noexcept
 
bool setDimensions (U16 width, U16 height)
 width and height get adjusted to the closest supported value
 
bool setDimensions (vec2< U16 > dimensions)
 
void centerWindowPosition ()
 Centering is also easier via SDL.
 
void bringToFront () const noexcept
 
vec2< U16getDimensions () const noexcept
 
vec2< U16getPreviousDimensions () const noexcept
 
Rect< I32getBorderSizes () const noexcept
 
vec2< U16getDrawableSize () const noexcept
 
vec2< I32getPosition (bool global=false, bool offset=false) const
 
void setPosition (I32 x, I32 y, bool global=false, bool offset=false)
 Window positioning is handled by SDL.
 
void setPosition (vec2< I32 > position, bool global=false)
 
const char * title () const noexcept
 
template<typename... Args>
void title (const char *format, Args &&...args) noexcept
 
WindowHandle handle () const noexcept
 
void addEventListener (WindowEvent windowEvent, const EventListener &listener)
 
void clearEventListeners (WindowEvent windowEvent)
 
void notifyListeners (WindowEvent event, const WindowEventArgs &args)
 
void destroyCbk (const DELEGATE< void > &destroyCbk)
 
Rect< I32windowViewport () const noexcept
 
const Rect< I32 > & renderingViewport () const noexcept
 
void renderingViewport (const Rect< I32 > &viewport) noexcept
 
bool grabState () const noexcept
 
void grabState (bool state) const noexcept
 
bool onSDLEvent (SDL_Event event) override
 
GFX::CommandBufferQueuegetCurrentCommandBufferQueue ()
 
 PROPERTY_R (U32, initialDisplay, 0u)
 The display on which this window was initially created on.
 
 PROPERTY_R (U32, flags, 0u)
 
 PROPERTY_R (WindowType, type, WindowType::COUNT)
 
 PROPERTY_R (U8, opacity, U8_MAX)
 
 PROPERTY_R (Uint32, windowID, 0u)
 
 PROPERTY_RW (UserData, userData)
 
 POINTER_R (DisplayWindow, parentWindow, nullptr)
 
- Public Member Functions inherited from Divide::GUIDWrapper
 GUIDWrapper () noexcept
 
 GUIDWrapper (const GUIDWrapper &old) noexcept
 
 GUIDWrapper (GUIDWrapper &&old) noexcept
 
virtual ~GUIDWrapper ()=default
 
FORCE_INLINE I64 getGUID () const noexcept
 
GUIDWrapperoperator= (const GUIDWrapper &old)=delete
 
GUIDWrapperoperator= (GUIDWrapper &&other)=delete
 
- Public Member Functions inherited from Divide::PlatformContextComponent
 PlatformContextComponent (PlatformContext &context) noexcept
 
virtual ~PlatformContextComponent ()=default
 
PlatformContextcontext () noexcept
 
const PlatformContextcontext () const noexcept
 
- Public Member Functions inherited from Divide::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=default
 
NonCopyableoperator= (NonCopyable &&)=default
 
- Public Member Functions inherited from Divide::SDLEventListener
 SDLEventListener () noexcept
 
virtual ~SDLEventListener ()
 
virtual bool onSDLEvent (SDL_Event event)=0
 
U64 listenerID () const noexcept
 

Private Types

using EventListeners = vector< DELEGATE< bool, WindowEventArgs > >
 

Private Member Functions

void restore () noexcept
 
void handleChangeWindowType (WindowType newWindowType)
 
void updateDrawableSize () noexcept
 

Private Attributes

std::array< EventListeners, to_base(WindowEvent::COUNT)> _eventListeners
 
DELEGATE< void > _destroyCbk
 
FColour4 _clearColour
 
Rect< I32_renderingViewport
 
vec2< U16_prevDimensions
 
vec2< U16_drawableSize
 
WindowManager_parent
 
SDL_Window_sdlWindow = nullptr
 
WindowType _previousType = WindowType::COUNT
 
U8 _prevOpacity = 255u
 
std::array< GFX::CommandBufferQueue, Config::MAX_FRAMES_IN_FLIGHT_commandBufferQueues
 
bool _internalMoveEvent = false
 Did we generate the window move event?
 
bool _internalResizeEvent = false
 

Static Private Attributes

static I64 s_cursorWindowGUID
 

Additional Inherited Members

- Static Public Member Functions inherited from Divide::GUIDWrapper
static I64 generateGUID () noexcept
 
- Protected Member Functions inherited from Divide::NonCopyable
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 
- Protected Attributes inherited from Divide::GUIDWrapper
const I64 _guid
 
- Protected Attributes inherited from Divide::PlatformContextComponent
PlatformContext_context
 

Detailed Description

Definition at line 103 of file DisplayWindow.h.

Member Typedef Documentation

◆ EventListener

Definition at line 124 of file DisplayWindow.h.

◆ EventListeners

Definition at line 225 of file DisplayWindow.h.

Constructor & Destructor Documentation

◆ ~DisplayWindow()

Divide::DisplayWindow::~DisplayWindow ( )
overridevirtual

Definition at line 26 of file DisplayWindow.cpp.

◆ DisplayWindow()

Divide::DisplayWindow::DisplayWindow ( WindowManager parent,
PlatformContext context 
)

Definition at line 16 of file DisplayWindow.cpp.

Member Function Documentation

◆ addEventListener()

void Divide::DisplayWindow::addEventListener ( WindowEvent  windowEvent,
const EventListener listener 
)
inline

Definition at line 106 of file DisplayWindow.inl.

◆ bringToFront()

void Divide::DisplayWindow::bringToFront ( ) const
noexcept

Definition at line 339 of file DisplayWindow.cpp.

◆ centerWindowPosition()

void Divide::DisplayWindow::centerWindowPosition ( )

Centering is also easier via SDL.

Definition at line 344 of file DisplayWindow.cpp.

◆ changeToPreviousType()

void Divide::DisplayWindow::changeToPreviousType ( )
inline

Definition at line 96 of file DisplayWindow.inl.

◆ changeType()

void Divide::DisplayWindow::changeType ( WindowType  newType)
inline

Definition at line 91 of file DisplayWindow.inl.

◆ clearEventListeners()

void Divide::DisplayWindow::clearEventListeners ( WindowEvent  windowEvent)
inline

Definition at line 111 of file DisplayWindow.inl.

◆ currentDisplayIndex()

I32 Divide::DisplayWindow::currentDisplayIndex ( ) const
noexcept

Definition at line 244 of file DisplayWindow.cpp.

◆ decorated() [1/2]

bool Divide::DisplayWindow::decorated ( ) const
inlinenoexcept

Definition at line 81 of file DisplayWindow.inl.

◆ decorated() [2/2]

void Divide::DisplayWindow::decorated ( bool  state)
noexcept

Definition at line 348 of file DisplayWindow.cpp.

◆ destroyCbk()

void Divide::DisplayWindow::destroyCbk ( const DELEGATE< void > &  destroyCbk)
inline

Definition at line 116 of file DisplayWindow.inl.

◆ destroyWindow()

ErrorCode Divide::DisplayWindow::destroyWindow ( )

Definition at line 36 of file DisplayWindow.cpp.

◆ fullscreen()

bool Divide::DisplayWindow::fullscreen ( ) const
inlinenoexcept

Definition at line 45 of file DisplayWindow.inl.

◆ getBorderSizes()

Rect< I32 > Divide::DisplayWindow::getBorderSizes ( ) const
noexcept

Definition at line 250 of file DisplayWindow.cpp.

◆ getCurrentCommandBufferQueue()

GFX::CommandBufferQueue & Divide::DisplayWindow::getCurrentCommandBufferQueue ( )

Definition at line 518 of file DisplayWindow.cpp.

◆ getDimensions()

vec2< U16 > Divide::DisplayWindow::getDimensions ( ) const
noexcept

Definition at line 507 of file DisplayWindow.cpp.

◆ getDrawableSize()

vec2< U16 > Divide::DisplayWindow::getDrawableSize ( ) const
noexcept

Definition at line 259 of file DisplayWindow.cpp.

◆ getPosition()

vec2< I32 > Divide::DisplayWindow::getPosition ( bool  global = false,
bool  offset = false 
) const

Definition at line 327 of file DisplayWindow.cpp.

◆ getPreviousDimensions()

vec2< U16 > Divide::DisplayWindow::getPreviousDimensions ( ) const
noexcept

Definition at line 453 of file DisplayWindow.cpp.

◆ getRawWindow()

SDL_Window * Divide::DisplayWindow::getRawWindow ( ) const
inlinenoexcept

Definition at line 40 of file DisplayWindow.inl.

◆ grabState() [1/2]

bool Divide::DisplayWindow::grabState ( ) const
noexcept

Definition at line 410 of file DisplayWindow.cpp.

◆ grabState() [2/2]

void Divide::DisplayWindow::grabState ( bool  state) const
noexcept

Definition at line 414 of file DisplayWindow.cpp.

◆ handle()

WindowHandle Divide::DisplayWindow::handle ( ) const
noexcept

Definition at line 105 of file DisplayWindow.cpp.

◆ handleChangeWindowType()

void Divide::DisplayWindow::handleChangeWindowType ( WindowType  newWindowType)
private

Changing from one window type to another should also change display dimensions and position

Definition at line 418 of file DisplayWindow.cpp.

◆ hasFocus()

bool Divide::DisplayWindow::hasFocus ( ) const
inlinenoexcept

Definition at line 61 of file DisplayWindow.inl.

◆ hidden() [1/2]

bool Divide::DisplayWindow::hidden ( ) const
inlinenoexcept

Definition at line 86 of file DisplayWindow.inl.

◆ hidden() [2/2]

void Divide::DisplayWindow::hidden ( bool  state)
noexcept

Definition at line 355 of file DisplayWindow.cpp.

◆ init()

ErrorCode Divide::DisplayWindow::init ( U32  windowFlags,
WindowType  initialType,
const WindowDescriptor descriptor 
)

Definition at line 52 of file DisplayWindow.cpp.

◆ isHovered()

bool Divide::DisplayWindow::isHovered ( ) const
inlinenoexcept

Definition at line 56 of file DisplayWindow.inl.

◆ maximized() [1/2]

bool Divide::DisplayWindow::maximized ( ) const
inlinenoexcept

Definition at line 76 of file DisplayWindow.inl.

◆ maximized() [2/2]

void Divide::DisplayWindow::maximized ( bool  state)
noexcept

Definition at line 394 of file DisplayWindow.cpp.

◆ minimized() [1/2]

bool Divide::DisplayWindow::minimized ( ) const
inlinenoexcept

Definition at line 71 of file DisplayWindow.inl.

◆ minimized() [2/2]

void Divide::DisplayWindow::minimized ( bool  state)
noexcept

Definition at line 378 of file DisplayWindow.cpp.

◆ notifyListeners()

void Divide::DisplayWindow::notifyListeners ( WindowEvent  event,
const WindowEventArgs args 
)

Definition at line 112 of file DisplayWindow.cpp.

◆ onSDLEvent()

bool Divide::DisplayWindow::onSDLEvent ( SDL_Event  event)
overridevirtual

Implements Divide::SDLEventListener.

Definition at line 133 of file DisplayWindow.cpp.

◆ opacity()

void Divide::DisplayWindow::opacity ( U8  opacity)
noexcept

Definition at line 301 of file DisplayWindow.cpp.

◆ POINTER_R()

Divide::DisplayWindow::POINTER_R ( DisplayWindow  ,
parentWindow  ,
nullptr   
)

◆ prevOpacity()

U8 Divide::DisplayWindow::prevOpacity ( ) const
inlinenoexcept

Definition at line 66 of file DisplayWindow.inl.

◆ PROPERTY_R() [1/5]

Divide::DisplayWindow::PROPERTY_R ( U32  ,
flags  ,
0u   
)

◆ PROPERTY_R() [2/5]

Divide::DisplayWindow::PROPERTY_R ( U32  ,
initialDisplay  ,
0u   
)

The display on which this window was initially created on.

◆ PROPERTY_R() [3/5]

Divide::DisplayWindow::PROPERTY_R ( U8  ,
opacity  ,
U8_MAX   
)

◆ PROPERTY_R() [4/5]

Divide::DisplayWindow::PROPERTY_R ( Uint32  ,
windowID  ,
0u   
)

◆ PROPERTY_R() [5/5]

Divide::DisplayWindow::PROPERTY_R ( WindowType  ,
type  ,
WindowType::COUNT   
)

◆ PROPERTY_RW()

Divide::DisplayWindow::PROPERTY_RW ( UserData  ,
userData   
)

◆ renderingViewport() [1/2]

const Rect< I32 > & Divide::DisplayWindow::renderingViewport ( ) const
inlinenoexcept

Definition at line 127 of file DisplayWindow.inl.

◆ renderingViewport() [2/2]

void Divide::DisplayWindow::renderingViewport ( const Rect< I32 > &  viewport)
noexcept

Definition at line 514 of file DisplayWindow.cpp.

◆ restore()

void Divide::DisplayWindow::restore ( )
privatenoexcept

Definition at line 371 of file DisplayWindow.cpp.

◆ setDimensions() [1/2]

bool Divide::DisplayWindow::setDimensions ( U16  width,
U16  height 
)

width and height get adjusted to the closest supported value

Definition at line 460 of file DisplayWindow.cpp.

◆ setDimensions() [2/2]

bool Divide::DisplayWindow::setDimensions ( vec2< U16 dimensions)

Definition at line 503 of file DisplayWindow.cpp.

◆ setPosition() [1/2]

void Divide::DisplayWindow::setPosition ( I32  x,
I32  y,
bool  global = false,
bool  offset = false 
)

Window positioning is handled by SDL.

Definition at line 309 of file DisplayWindow.cpp.

◆ setPosition() [2/2]

void Divide::DisplayWindow::setPosition ( vec2< I32 position,
bool  global = false 
)
inline

Definition at line 51 of file DisplayWindow.inl.

◆ title() [1/2]

const char * Divide::DisplayWindow::title ( ) const
inlinenoexcept

Definition at line 101 of file DisplayWindow.inl.

◆ title() [2/2]

template<typename... Args>
void Divide::DisplayWindow::title ( const char *  format,
Args &&...  args 
)
noexcept

Definition at line 133 of file DisplayWindow.inl.

◆ updateDrawableSize()

void Divide::DisplayWindow::updateDrawableSize ( )
privatenoexcept

Definition at line 264 of file DisplayWindow.cpp.

◆ windowViewport()

Rect< I32 > Divide::DisplayWindow::windowViewport ( ) const
inlinenoexcept

Definition at line 121 of file DisplayWindow.inl.

Member Data Documentation

◆ _clearColour

FColour4 Divide::DisplayWindow::_clearColour
private

Definition at line 228 of file DisplayWindow.h.

◆ _commandBufferQueues

std::array<GFX::CommandBufferQueue, Config::MAX_FRAMES_IN_FLIGHT> Divide::DisplayWindow::_commandBufferQueues
private

Definition at line 240 of file DisplayWindow.h.

◆ _destroyCbk

DELEGATE<void> Divide::DisplayWindow::_destroyCbk
private

Definition at line 227 of file DisplayWindow.h.

◆ _drawableSize

vec2<U16> Divide::DisplayWindow::_drawableSize
private

Definition at line 232 of file DisplayWindow.h.

◆ _eventListeners

std::array<EventListeners, to_base(WindowEvent::COUNT)> Divide::DisplayWindow::_eventListeners
private

Definition at line 226 of file DisplayWindow.h.

◆ _internalMoveEvent

bool Divide::DisplayWindow::_internalMoveEvent = false
private

Did we generate the window move event?

Definition at line 242 of file DisplayWindow.h.

◆ _internalResizeEvent

bool Divide::DisplayWindow::_internalResizeEvent = false
private

Definition at line 243 of file DisplayWindow.h.

◆ _parent

WindowManager& Divide::DisplayWindow::_parent
private

Definition at line 234 of file DisplayWindow.h.

◆ _prevDimensions

vec2<U16> Divide::DisplayWindow::_prevDimensions
private

Definition at line 231 of file DisplayWindow.h.

◆ _previousType

WindowType Divide::DisplayWindow::_previousType = WindowType::COUNT
private

Definition at line 237 of file DisplayWindow.h.

◆ _prevOpacity

U8 Divide::DisplayWindow::_prevOpacity = 255u
private

Definition at line 238 of file DisplayWindow.h.

◆ _renderingViewport

Rect<I32> Divide::DisplayWindow::_renderingViewport
private

Definition at line 229 of file DisplayWindow.h.

◆ _sdlWindow

SDL_Window* Divide::DisplayWindow::_sdlWindow = nullptr
private

Definition at line 235 of file DisplayWindow.h.

◆ s_cursorWindowGUID

I64 Divide::DisplayWindow::s_cursorWindowGUID
staticprivate

Definition at line 245 of file DisplayWindow.h.


The documentation for this class was generated from the following files: