Avara3D 0.2.0
C++ API reference
a3d::Window Class Reference

RenderContext for interactive desktop and web rendering. More...

#include <a3d/render/context/Window.h>

Inheritance diagram for a3d::Window:
[legend]

Public Member Functions

 Window (const math::uvec2 &size, bool fullScreen, bool enableHighDPI=true, Antialiasing antialiasing=Antialiasing::None)
 Creates a rendering window and its rendering resources. More...
 
void open ()
 Shows the window and begins accepting normal window callbacks. More...
 
void close ()
 Closes the window and releases pointer capture. More...
 
bool isOpen () const
 Returns whether the Window has been opened and not subsequently closed. More...
 
std::string title () const
 Returns the window title; web builds currently return an empty string. More...
 
void title (const std::string &title)
 Sets the window title. More...
 
math::uvec2 size () const
 Returns the window size in platform window coordinates. More...
 
void size (const math::uvec2 &size)
 Sets the window size in platform window coordinates. More...
 
math::uvec2 position () const
 Returns the window position in screen coordinates. More...
 
void position (const math::uvec2 &pos)
 Sets the window position in screen coordinates. More...
 
void center ()
 Centers the window on its current monitor when supported by the platform. More...
 
bool hidden () const
 Returns whether the window is explicitly hidden. More...
 
void hidden (bool hidden)
 Shows or hides the window. More...
 
bool cursorCaptured () const
 Returns whether pointer input is captured by the window. More...
 
void cursorCaptured (bool captured)
 Captures or releases pointer input. More...
 
bool cursorHidden () const
 Returns whether the pointer is requested to be hidden when not captured. More...
 
void cursorHidden (bool hidden)
 Shows or hides the pointer when pointer capture is disabled. More...
 
bool highDPIEnabled () const
 Returns whether high-DPI rendering was requested when the Window was created. More...
 
bool vSyncEnabled () const override
 Returns whether vertical synchronization is enabled. More...
 
void vSyncEnabled (bool enabled) override
 Enables or disables vertical synchronization when supported. More...
 
- Public Member Functions inherited from a3d::RenderContext
virtual bool vSyncEnabled () const =0
 Returns whether presentation synchronization is enabled for this context. More...
 
virtual void vSyncEnabled (bool enabled)=0
 Enables or disables presentation synchronization when supported by the concrete context. More...
 
Antialiasing antialiasing () const
 Returns the antialiasing mode selected when the rendering target was created. More...
 
std::unique_ptr< Imagesnapshot () const
 Captures the current framebuffer into a new Image at framebuffer resolution. More...
 
VisualWorldvisualWorld () const
 Returns the attached VisualWorld, or nullptr if none is attached. More...
 

Static Public Member Functions

static std::unique_ptr< DesktopInputContextInputContext ()
 Creates the DesktopInputContext implementation used by Window. More...
 

Additional Inherited Members

- Public Types inherited from a3d::RenderContext
enum class  Antialiasing : uint8_t {
  None = 0 , Msaa2X = 2 , Msaa4X = 4 , Msaa8X = 8 ,
  Msaa16X = 16
}
 Selects multisample antialiasing requested for the rendering target. More...
 

Detailed Description

RenderContext for interactive desktop and web rendering.

On desktop, Window represents a native application window. On web builds, it represents an HTML canvas backed by WebGL. A3D uses the page's "#canvas" element for browser-specific rendering and input integration.

Definition at line 36 of file Window.h.

Constructor & Destructor Documentation

◆ Window()

a3d::Window::Window ( const math::uvec2 size,
bool  fullScreen,
bool  enableHighDPI = true,
Antialiasing  antialiasing = Antialiasing::None 
)

Creates a rendering window and its rendering resources.

For a windowed context, size specifies the initial window size. Full-screen windows use the primary monitor's current video mode. High-DPI and antialiasing requests are applied when supported by the platform.

Exceptions
std::runtime_errorif the window/context initialization fails.

Member Function Documentation

◆ center()

void a3d::Window::center ( )

Centers the window on its current monitor when supported by the platform.

◆ close()

void a3d::Window::close ( )

Closes the window and releases pointer capture.

◆ cursorCaptured() [1/2]

bool a3d::Window::cursorCaptured ( ) const

Returns whether pointer input is captured by the window.

◆ cursorCaptured() [2/2]

void a3d::Window::cursorCaptured ( bool  captured)

Captures or releases pointer input.

Capturing locks pointer motion to the window and hides the pointer. Releasing capture restores the state requested by cursorHidden().

◆ cursorHidden() [1/2]

bool a3d::Window::cursorHidden ( ) const

Returns whether the pointer is requested to be hidden when not captured.

◆ cursorHidden() [2/2]

void a3d::Window::cursorHidden ( bool  hidden)

Shows or hides the pointer when pointer capture is disabled.

◆ hidden() [1/2]

bool a3d::Window::hidden ( ) const

Returns whether the window is explicitly hidden.

◆ hidden() [2/2]

void a3d::Window::hidden ( bool  hidden)

Shows or hides the window.

◆ highDPIEnabled()

bool a3d::Window::highDPIEnabled ( ) const

Returns whether high-DPI rendering was requested when the Window was created.

◆ InputContext()

static std::unique_ptr< DesktopInputContext > a3d::Window::InputContext ( )
static

Creates the DesktopInputContext implementation used by Window.

◆ isOpen()

bool a3d::Window::isOpen ( ) const

Returns whether the Window has been opened and not subsequently closed.

◆ open()

void a3d::Window::open ( )

Shows the window and begins accepting normal window callbacks.

Exceptions
std::runtime_errorif the Window has no VisualWorld attached to a Scene.

◆ position() [1/2]

math::uvec2 a3d::Window::position ( ) const

Returns the window position in screen coordinates.

◆ position() [2/2]

void a3d::Window::position ( const math::uvec2 pos)

Sets the window position in screen coordinates.

◆ size() [1/2]

math::uvec2 a3d::Window::size ( ) const

Returns the window size in platform window coordinates.

◆ size() [2/2]

void a3d::Window::size ( const math::uvec2 size)

Sets the window size in platform window coordinates.

◆ title() [1/2]

std::string a3d::Window::title ( ) const

Returns the window title; web builds currently return an empty string.

◆ title() [2/2]

void a3d::Window::title ( const std::string &  title)

Sets the window title.

◆ vSyncEnabled() [1/2]

bool a3d::Window::vSyncEnabled ( ) const
overridevirtual

Returns whether vertical synchronization is enabled.

Implements a3d::RenderContext.

◆ vSyncEnabled() [2/2]

void a3d::Window::vSyncEnabled ( bool  enabled)
overridevirtual

Enables or disables vertical synchronization when supported.

Browser presentation timing is controlled by the browser main loop; web builds report VSync enabled and do not support disabling it.

Implements a3d::RenderContext.


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