Gamp v0.0.7-36-g24b1eb6
Gamp: Graphics, Audio, Multimedia and Processing
Loading...
Searching...
No Matches
gamp::wt::Window Class Reference

#include <Window.hpp>

Inheritance diagram for gamp::wt::Window:
Collaboration diagram for gamp::wt::Window:

Classes

struct  Private
 

Public Member Functions

 Window (const Window &)=delete
 
 Window (Private, handle_t window_handle, const Recti &window_bounds, handle_t surface_handle, const Vec2i &surface_size)
 Private ctor for single Window::create() method w/o public ctor.
 
 ~Window () noexcept override=default
 Releases this instance.
 
void addKeyListener (const KeyListenerRef &l)
 
void addPointerListener (const PointerListenerRef &l)
 
void addRenderListener (const RenderListenerRef &l)
 
void addWindowListener (const WindowListenerRef &l)
 
void display (const jau::fraction_timespec &when) noexcept
 
void dispose (const jau::fraction_timespec &when) noexcept override
 
void disposedNotify (const jau::fraction_timespec &when) noexcept override
 
void disposeRenderListener (bool clearRenderListener, const jau::fraction_timespec &when) noexcept
 
constexpr bool hasFocus () const noexcept
 
constexpr bool isPointerBLOriented () const noexcept
 Returns true if this window delivers PointerEvent in OpenGL's coordinate system, origin at bottom left.
 
bool isValid () const noexcept override
 
constexpr bool isVisible () const noexcept
 
size_t keyListenerCount () const noexcept
 
const KeyboardTrackerkeyTracker () const noexcept
 
SurfaceRef nativeSurface ()
 Returns the associated Surface of this SurfaceHolder.
 
void notifyKeyPressed (const jau::fraction_timespec &when, VKeyCode keySym, InputModifier keySymMods, uint16_t keyChar) noexcept
 
void notifyKeyReleased (const jau::fraction_timespec &when, VKeyCode keySym, InputModifier keySymMods, uint16_t keyChar) noexcept
 
void notifyPointer (uint16_t type, const jau::fraction_timespec &when, PointerType ptype, uint16_t id, jau::math::Vec2i pos, uint16_t clickCount, InputButton button, jau::math::Vec3f rotation, float rotationScale) noexcept
 
void notifyWindowEvent (uint16_t type, const jau::fraction_timespec &when, bool value=true) noexcept
 
void notifyWindowMoved (const jau::fraction_timespec &when, const jau::math::Vec2i &winPos) noexcept
 
void notifyWindowResize (const jau::fraction_timespec &when, const jau::math::Vec2i &winSize, const jau::math::Vec2i &surfSize) noexcept
 
void operator= (const Window &)=delete
 
size_t pointerListenerCount () const noexcept
 
size_t removeAllKeyListener ()
 
size_t removeAllPointerListener ()
 
size_t removeAllRenderListener ()
 
size_t removeAllWindowListener ()
 
size_t removeKeyListener (const KeyListenerRef &l)
 
size_t removePointerListener (const PointerListenerRef &l)
 
size_t removeRenderListener (const RenderListenerRef &l)
 
size_t removeWindowListener (const WindowListenerRef &l)
 
size_t renderListenerCount () const noexcept
 
const WindowRef shared ()
 
constexpr WindowState state () const noexcept
 
bool surfaceSwap () noexcept override
 Provide a mechanism to utilize custom (pre-) swap surface code.
 
std::string toString () const noexcept
 
constexpr const RectiwindowBounds () const noexcept
 Returns the window client-area top-left position and size excluding insets (window decorations) in window units.
 
constexpr handle_t windowHandle () const noexcept
 Returns the handle to the surface for this NativeSurface.
 
size_t windowListenerCount () const noexcept
 
constexpr Vec2i windowPos () const noexcept
 Returns the window top-lect position of client-area in window units.
 
constexpr Vec2i windowSize () const noexcept
 Returns the window size of the client area excluding insets (window decorations) in window units.
 
- Public Member Functions inherited from gamp::wt::Surface
 Surface (const Surface &)=delete
 
 Surface (Private, handle_t surface_handle, const Vec2i &surface_size)
 Private ctor for single Surface::create() method w/o public ctor.
 
virtual ~Surface () noexcept
 Releases this instance.
 
const Capabilitiescapabilities () const noexcept
 
bool createContext (const gamp::render::RenderProfile &profile, const gamp::render::RenderContextFlags &contextFlags)
 
constexpr bool isBLOriented () const noexcept
 Returns true if this surface is rendered in OpenGL's coordinate system, origin at bottom left.
 
lock_status_t lockSurface ()
 Lock the surface of this native window.
 
void operator= (const Surface &)=delete
 
const gamp::render::RenderContextrenderContext () const noexcept
 
gamp::render::RenderContextrenderContext () noexcept
 
bool setSwapInterval (int v) noexcept
 Returns true if swap interval could be set with the native toolkit post createContext().
 
const SurfaceRef shared ()
 
constexpr handle_t surfaceHandle () const noexcept
 Returns the handle to the surface for this NativeSurface.
 
constexpr const Vec2isurfaceSize () const noexcept
 Returns the surface size of the client area excluding insets (window decorations) in pixel units.
 
constexpr int swapInterval () const noexcept
 Returns desired or determined swap interval.
 
std::string toString () const noexcept
 
void unlockSurface ()
 Unlock the surface of this native window.
 

Static Public Member Functions

static WindowRef create (const char *title, int wwidth, int wheight, bool verbose=false)
 Create an new instance using a native windowing toolkit.
 
static WindowRef wrapNative (handle_t window_handle, const Recti &window_bounds, handle_t surface_handle, const Vec2i &surface_size)
 Create an new instance, wrapping the native windowing toolkit's handle/resources.
 
- Static Public Member Functions inherited from gamp::wt::Surface
static SurfaceRef create (handle_t surface_handle, const Vec2i &surface_size)
 
static gamp::render::RenderContextPtr createContext (const wt::SurfaceRef &surface, const gamp::render::RenderProfile &profile, const gamp::render::RenderContextFlags &contextFlags, gamp::render::RenderContext *shareWith) noexcept
 
static constexpr bool is_locked (const lock_status_t ls) noexcept
 

Protected Member Functions

void setFocused (bool v) noexcept
 
void setVisible (bool v) noexcept
 
void setWindowBounds (const Recti &r) noexcept
 
void setWindowPos (const Vec2i &sz) noexcept
 
void setWindowSize (const Vec2i &sz) noexcept
 
- Protected Member Functions inherited from gamp::wt::Surface
virtual lock_status_t nativeSurfaceLock () noexcept
 
virtual void nativeSurfaceUnlock () noexcept
 
void setSurfaceSize (const Vec2i &sz) noexcept
 
template<typename ChildT>
std::shared_ptr< ChildT > shared_from_base ()
 

Additional Inherited Members

- Public Types inherited from gamp::wt::Surface
enum class  lock_status_t : uint16_t { unlocked , not_ready , locked_changed , locked_same }
 
- Static Public Attributes inherited from gamp::wt::Surface
static constexpr const jau::fraction_i64 TIMEOUT = 5_s
 

Detailed Description

Definition at line 132 of file Window.hpp.

Constructor & Destructor Documentation

◆ Window() [1/2]

gamp::wt::Window::Window ( Private ,
handle_t window_handle,
const Recti & window_bounds,
handle_t surface_handle,
const Vec2i & surface_size )
inline

Private ctor for single Window::create() method w/o public ctor.

Definition at line 182 of file Window.hpp.

Here is the caller graph for this function:

◆ Window() [2/2]

gamp::wt::Window::Window ( const Window & )
delete

◆ ~Window()

gamp::wt::Window::~Window ( )
overridedefaultnoexcept

Releases this instance.

Member Function Documentation

◆ setWindowBounds()

void gamp::wt::Window::setWindowBounds ( const Recti & r)
inlineprotectednoexcept

Definition at line 150 of file Window.hpp.

◆ setWindowPos()

void gamp::wt::Window::setWindowPos ( const Vec2i & sz)
inlineprotectednoexcept

Definition at line 151 of file Window.hpp.

◆ setWindowSize()

void gamp::wt::Window::setWindowSize ( const Vec2i & sz)
inlineprotectednoexcept

Definition at line 152 of file Window.hpp.

◆ setFocused()

void gamp::wt::Window::setFocused ( bool v)
inlineprotectednoexcept

Definition at line 153 of file Window.hpp.

◆ setVisible()

void gamp::wt::Window::setVisible ( bool v)
inlineprotectednoexcept

Definition at line 154 of file Window.hpp.

◆ wrapNative()

static WindowRef gamp::wt::Window::wrapNative ( handle_t window_handle,
const Recti & window_bounds,
handle_t surface_handle,
const Vec2i & surface_size )
inlinestatic

Create an new instance, wrapping the native windowing toolkit's handle/resources.

Must be driven by a native toolkit implementation, see create() below.

See also
create()

Definition at line 199 of file Window.hpp.

Here is the caller graph for this function:

◆ create()

WindowRef Window::create ( const char * title,
int wwidth,
int wheight,
bool verbose = false )
static

Create an new instance using a native windowing toolkit.

See also
wrapNative()

Definition at line 195 of file gamp_sdl2.cpp.

Here is the caller graph for this function:

◆ operator=()

void gamp::wt::Window::operator= ( const Window & )
delete

◆ nativeSurface()

SurfaceRef gamp::wt::Window::nativeSurface ( )
inline

Returns the associated Surface of this SurfaceHolder.

Returns this instance, which is-a Surface.

Definition at line 226 of file Window.hpp.

Here is the caller graph for this function:

◆ shared()

const WindowRef gamp::wt::Window::shared ( )
inline

Definition at line 227 of file Window.hpp.

Here is the caller graph for this function:

◆ windowPos()

Vec2i gamp::wt::Window::windowPos ( ) const
inlineconstexprnoexcept

Returns the window top-lect position of client-area in window units.

Definition at line 230 of file Window.hpp.

◆ windowSize()

Vec2i gamp::wt::Window::windowSize ( ) const
inlineconstexprnoexcept

Returns the window size of the client area excluding insets (window decorations) in window units.

Definition at line 233 of file Window.hpp.

Here is the caller graph for this function:

◆ windowBounds()

const Recti & gamp::wt::Window::windowBounds ( ) const
inlineconstexprnoexcept

Returns the window client-area top-left position and size excluding insets (window decorations) in window units.

Definition at line 236 of file Window.hpp.

Here is the caller graph for this function:

◆ isPointerBLOriented()

bool gamp::wt::Window::isPointerBLOriented ( ) const
inlineconstexprnoexcept

Returns true if this window delivers PointerEvent in OpenGL's coordinate system, origin at bottom left.

Otherwise returns false, i.e. origin at top left.

Default impl. is isBLOriented(), i.e. true for OpenGL bottom-left coordinate system.

See also
isBLOriented()

Definition at line 247 of file Window.hpp.

Here is the caller graph for this function:

◆ windowHandle()

handle_t gamp::wt::Window::windowHandle ( ) const
inlineconstexprnoexcept

Returns the handle to the surface for this NativeSurface.

The surface handle should be set/update by lockSurface(), where unlockSurface() is not allowed to modify it. After unlockSurface() it is no more guaranteed that the surface handle is still valid.

The surface handle shall reflect the platform one for all drawable surface operations, e.g. opengl, swap-buffer.

On X11 this returns an entity of type Window, since there is no differentiation of surface and window there.
On Microsoft Windows this returns an entity of type HDC.

Definition at line 264 of file Window.hpp.

Here is the caller graph for this function:

◆ isValid()

bool gamp::wt::Window::isValid ( ) const
inlineoverridevirtualnoexcept

Reimplemented from gamp::wt::Surface.

Definition at line 265 of file Window.hpp.

Here is the caller graph for this function:

◆ state()

WindowState gamp::wt::Window::state ( ) const
inlineconstexprnoexcept

Definition at line 267 of file Window.hpp.

◆ hasFocus()

bool gamp::wt::Window::hasFocus ( ) const
inlineconstexprnoexcept

Definition at line 268 of file Window.hpp.

◆ isVisible()

bool gamp::wt::Window::isVisible ( ) const
inlineconstexprnoexcept

Definition at line 269 of file Window.hpp.

◆ display()

void gamp::wt::Window::display ( const jau::fraction_timespec & when)
noexcept

Definition at line 78 of file gamp_wt.cpp.

◆ surfaceSwap()

bool Window::surfaceSwap ( )
overridevirtualnoexcept

Provide a mechanism to utilize custom (pre-) swap surface code.

This method is called before the render toolkit (e.g. JOGL) swaps the buffer/surface if double buffering is enabled.

The implementation may itself apply the swapping, in which case true shall be returned.

Returns
true if this method completed swapping the surface, otherwise false, in which case eg the GLDrawable implementation has to swap the code.

Reimplemented from gamp::wt::Surface.

Definition at line 205 of file gamp_sdl2_gl.cpp.

◆ notifyWindowEvent()

void gamp::wt::Window::notifyWindowEvent ( uint16_t type,
const jau::fraction_timespec & when,
bool value = true )
inlinenoexcept

Definition at line 278 of file Window.hpp.

Here is the caller graph for this function:

◆ notifyWindowResize()

void gamp::wt::Window::notifyWindowResize ( const jau::fraction_timespec & when,
const jau::math::Vec2i & winSize,
const jau::math::Vec2i & surfSize )
inlinenoexcept

Definition at line 281 of file Window.hpp.

Here is the caller graph for this function:

◆ notifyWindowMoved()

void gamp::wt::Window::notifyWindowMoved ( const jau::fraction_timespec & when,
const jau::math::Vec2i & winPos )
inlinenoexcept

Definition at line 287 of file Window.hpp.

Here is the caller graph for this function:

◆ addWindowListener()

void gamp::wt::Window::addWindowListener ( const WindowListenerRef & l)
inline

Definition at line 294 of file Window.hpp.

Here is the caller graph for this function:

◆ removeWindowListener()

size_t gamp::wt::Window::removeWindowListener ( const WindowListenerRef & l)
inline

Definition at line 295 of file Window.hpp.

◆ removeAllWindowListener()

size_t gamp::wt::Window::removeAllWindowListener ( )
inline

Definition at line 296 of file Window.hpp.

◆ windowListenerCount()

size_t gamp::wt::Window::windowListenerCount ( ) const
inlinenoexcept

Definition at line 297 of file Window.hpp.

Here is the caller graph for this function:

◆ keyTracker()

const KeyboardTracker & gamp::wt::Window::keyTracker ( ) const
inlinenoexcept

Definition at line 302 of file Window.hpp.

Here is the caller graph for this function:

◆ notifyKeyPressed()

void gamp::wt::Window::notifyKeyPressed ( const jau::fraction_timespec & when,
VKeyCode keySym,
InputModifier keySymMods,
uint16_t keyChar )
inlinenoexcept

Definition at line 304 of file Window.hpp.

Here is the caller graph for this function:

◆ notifyKeyReleased()

void gamp::wt::Window::notifyKeyReleased ( const jau::fraction_timespec & when,
VKeyCode keySym,
InputModifier keySymMods,
uint16_t keyChar )
inlinenoexcept

Definition at line 307 of file Window.hpp.

Here is the caller graph for this function:

◆ addKeyListener()

void gamp::wt::Window::addKeyListener ( const KeyListenerRef & l)
inline

Definition at line 310 of file Window.hpp.

Here is the caller graph for this function:

◆ removeKeyListener()

size_t gamp::wt::Window::removeKeyListener ( const KeyListenerRef & l)
inline

Definition at line 311 of file Window.hpp.

Here is the caller graph for this function:

◆ removeAllKeyListener()

size_t gamp::wt::Window::removeAllKeyListener ( )
inline

Definition at line 312 of file Window.hpp.

◆ keyListenerCount()

size_t gamp::wt::Window::keyListenerCount ( ) const
inlinenoexcept

Definition at line 313 of file Window.hpp.

Here is the caller graph for this function:

◆ notifyPointer()

void gamp::wt::Window::notifyPointer ( uint16_t type,
const jau::fraction_timespec & when,
PointerType ptype,
uint16_t id,
jau::math::Vec2i pos,
uint16_t clickCount,
InputButton button,
jau::math::Vec3f rotation,
float rotationScale )
inlinenoexcept

Definition at line 318 of file Window.hpp.

Here is the caller graph for this function:

◆ addPointerListener()

void gamp::wt::Window::addPointerListener ( const PointerListenerRef & l)
inline

Definition at line 324 of file Window.hpp.

Here is the caller graph for this function:

◆ removePointerListener()

size_t gamp::wt::Window::removePointerListener ( const PointerListenerRef & l)
inline

Definition at line 325 of file Window.hpp.

Here is the caller graph for this function:

◆ removeAllPointerListener()

size_t gamp::wt::Window::removeAllPointerListener ( )
inline

Definition at line 326 of file Window.hpp.

◆ pointerListenerCount()

size_t gamp::wt::Window::pointerListenerCount ( ) const
inlinenoexcept

Definition at line 327 of file Window.hpp.

◆ addRenderListener()

void gamp::wt::Window::addRenderListener ( const RenderListenerRef & l)
inline

Definition at line 333 of file Window.hpp.

Here is the caller graph for this function:

◆ removeRenderListener()

size_t gamp::wt::Window::removeRenderListener ( const RenderListenerRef & l)
inline

Definition at line 335 of file Window.hpp.

◆ removeAllRenderListener()

size_t gamp::wt::Window::removeAllRenderListener ( )
inline

Definition at line 340 of file Window.hpp.

◆ renderListenerCount()

size_t gamp::wt::Window::renderListenerCount ( ) const
inlinenoexcept

Definition at line 346 of file Window.hpp.

◆ disposeRenderListener()

void gamp::wt::Window::disposeRenderListener ( bool clearRenderListener,
const jau::fraction_timespec & when )
noexcept

Definition at line 129 of file gamp_wt.cpp.

Here is the caller graph for this function:

◆ disposedNotify()

void gamp::wt::Window::disposedNotify ( const jau::fraction_timespec & when)
inlineoverridevirtualnoexcept

Reimplemented from gamp::wt::Surface.

Definition at line 350 of file Window.hpp.

◆ dispose()

void gamp::wt::Window::dispose ( const jau::fraction_timespec & when)
inlineoverridevirtualnoexcept

Reimplemented from gamp::wt::Surface.

Definition at line 355 of file Window.hpp.

Here is the caller graph for this function:

◆ toString()

std::string gamp::wt::Window::toString ( ) const
noexcept

Definition at line 145 of file gamp_wt.cpp.

Here is the caller graph for this function:

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