Wasabi
Public Member Functions | List of all members
WGLFWWindowAndInputComponent Class Reference
Inheritance diagram for WGLFWWindowAndInputComponent:
WWindowAndInputComponent

Public Member Functions

 WGLFWWindowAndInputComponent (class Wasabi *const app)
 
virtual WError Initialize (int width, int height)
 
virtual bool Loop ()
 
virtual void Cleanup ()
 
virtual void * GetPlatformHandle () const
 
virtual void * GetWindowHandle () const
 
virtual VkSurfaceKHR GetVulkanSurface () const
 
virtual void GetVulkanRequiredExtensions (std::vector< const char * > &extensions)
 
virtual void ShowErrorMessage (std::string error, bool warning=false)
 
virtual void SetWindowTitle (const char *const title)
 
virtual void SetWindowPosition (int x, int y)
 
virtual void SetWindowSize (int width, int height)
 
virtual void MaximizeWindow ()
 
virtual void MinimizeWindow ()
 
virtual uint32_t RestoreWindow ()
 
virtual uint32_t GetWindowWidth (bool framebuffer=true) const
 
virtual uint32_t GetWindowHeight (bool framebuffer=true) const
 
virtual int GetWindowPositionX () const
 
virtual int GetWindowPositionY () const
 
virtual void SetFullScreenState (bool bFullScreen)
 
virtual bool GetFullScreenState () const
 
virtual void SetWindowMinimumSize (int minX, int minY)
 
virtual void SetWindowMaximumSize (int maxX, int maxY)
 
virtual bool MouseClick (W_MOUSEBUTTON button) const
 
virtual double MouseX (W_MOUSEPOSTYPE posT=MOUSEPOS_VIEWPORT, uint32_t vpID=0) const
 
virtual double MouseY (W_MOUSEPOSTYPE posT=MOUSEPOS_VIEWPORT, uint32_t vpID=0) const
 
virtual double MouseZ () const
 
virtual bool MouseInScreen (W_MOUSEPOSTYPE posT=MOUSEPOS_VIEWPORT, uint32_t vpID=0) const
 
virtual void SetMousePosition (double x, double y, W_MOUSEPOSTYPE posT=MOUSEPOS_VIEWPORT)
 
virtual void SetMouseZ (double value)
 
virtual void ShowCursor (bool bShow)
 
virtual void SetCursorMotionMode (bool bEnable)
 
virtual void SetQuitKeys (bool escape=true, bool cmdW=true)
 
virtual bool KeyDown (uint32_t key) const
 
virtual void InsertRawInput (uint32_t key, bool state)
 
- Public Member Functions inherited from WWindowAndInputComponent
 WWindowAndInputComponent (class Wasabi *const app)
 

Additional Inherited Members

- Protected Attributes inherited from WWindowAndInputComponent
class Wasabim_app
 

Member Function Documentation

◆ Cleanup()

virtual void WGLFWWindowAndInputComponent::Cleanup ( )
virtual

Thus function is called by Wasabi before it exists to allow the window component to cleanup its resources. This function must be implemented by a child class.

Implements WWindowAndInputComponent.

◆ GetFullScreenState()

virtual bool WGLFWWindowAndInputComponent::GetFullScreenState ( ) const
virtual

Retrieves the full-screen state of the window, see SetFullScreenState().

Returns
true if the window is in full-screen, false otherwise

Reimplemented from WWindowAndInputComponent.

◆ GetPlatformHandle()

virtual void* WGLFWWindowAndInputComponent::GetPlatformHandle ( ) const
virtual

Retrieves the platform-specific handle needed by Vulkan. For example, on Windows, this must return the HINSTANCE of the application.

Returns
The platform-specific application handle

Implements WWindowAndInputComponent.

◆ GetVulkanRequiredExtensions()

virtual void WGLFWWindowAndInputComponent::GetVulkanRequiredExtensions ( std::vector< const char * > &  extensions)
virtual

Retrieves the Vulkan extensions required to run this window manager.

Parameters
extensionsA vector to be populated with required extensions

Implements WWindowAndInputComponent.

◆ GetVulkanSurface()

virtual VkSurfaceKHR WGLFWWindowAndInputComponent::GetVulkanSurface ( ) const
virtual

Retrieves the Vulkan Surface that can be used to render.

Returns
The created VkSurfaceKHR

Implements WWindowAndInputComponent.

◆ GetWindowHandle()

virtual void* WGLFWWindowAndInputComponent::GetWindowHandle ( ) const
virtual

Retrieves the platform-specific window handle. For example, on Windows, this must return the HWND created by Initialize().

Returns
The platform-specific window handle

Implements WWindowAndInputComponent.

◆ GetWindowHeight()

virtual uint32_t WGLFWWindowAndInputComponent::GetWindowHeight ( bool  framebuffer = true) const
virtual

Retrieves the height of the client area of the window.

Parameters
framebufferIf true, this function retrieves the height of the frame buffer inside the window. Otherwise it returns the height of the window
Returns
Height of the window's client area, in pixels

Reimplemented from WWindowAndInputComponent.

◆ GetWindowPositionX()

virtual int WGLFWWindowAndInputComponent::GetWindowPositionX ( ) const
virtual

Retrieves the x-coordinate of the window on the screen.

Returns
X-coordinate of the window on the screen

Reimplemented from WWindowAndInputComponent.

◆ GetWindowPositionY()

virtual int WGLFWWindowAndInputComponent::GetWindowPositionY ( ) const
virtual

Retrieves the y-coordinate of the window on the screen.

Returns
Y-coordinate of the window on the screen

Reimplemented from WWindowAndInputComponent.

◆ GetWindowWidth()

virtual uint32_t WGLFWWindowAndInputComponent::GetWindowWidth ( bool  framebuffer = true) const
virtual

Retrieves the width of the client area of the window.

Parameters
framebufferIf true, this function retrieves the width of the frame buffer inside the window. Otherwise it returns the width of the window
Returns
Width of the window's client area, in pixels

Reimplemented from WWindowAndInputComponent.

◆ Initialize()

virtual WError WGLFWWindowAndInputComponent::Initialize ( int  width,
int  height 
)
virtual

Initializes the window component if it is not initialized, otherwise it should resize the window (or equivalent surface) to the new size provided. This function must be implemented by a child class to initialize its resources and create/resize the window (or equivalent surface) for rendering.

Parameters
widthWidth of the window to be created/resized to
heightHeight of the window to be created/resized to
Returns
Error code, see WError.h

Implements WWindowAndInputComponent.

◆ InsertRawInput()

virtual void WGLFWWindowAndInputComponent::InsertRawInput ( uint32_t  key,
bool  state 
)
virtual

Forcefully sets the state of a key.

Parameters
keyKey to set
stateState to set the key to, true being pressed and false being released

Implements WWindowAndInputComponent.

◆ KeyDown()

virtual bool WGLFWWindowAndInputComponent::KeyDown ( uint32_t  key) const
virtual

Checks if a key is currently pressed.

Parameters
keyKey to check
Returns
true if key is pressed, false otherwise

Implements WWindowAndInputComponent.

◆ Loop()

virtual bool WGLFWWindowAndInputComponent::Loop ( )
virtual

This function is called by Wasabi every frame to allow the window component to process any message pump or queue it has. This function must be implemented by a child class to perform any per-frame updates.

Returns
true if the frame should be rendered, false otherwise (if the window is not shown, e.g. minimized, this should return false)

Implements WWindowAndInputComponent.

◆ MaximizeWindow()

virtual void WGLFWWindowAndInputComponent::MaximizeWindow ( )
virtual

Maximizes the window.

Reimplemented from WWindowAndInputComponent.

◆ MinimizeWindow()

virtual void WGLFWWindowAndInputComponent::MinimizeWindow ( )
virtual

Minimizes the window.

Reimplemented from WWindowAndInputComponent.

◆ MouseClick()

virtual bool WGLFWWindowAndInputComponent::MouseClick ( W_MOUSEBUTTON  button) const
virtual

Check if a mouse button is clicked.

Parameters
buttonButton to check
Returns
true if button is clicked, false otherwise

Implements WWindowAndInputComponent.

◆ MouseInScreen()

virtual bool WGLFWWindowAndInputComponent::MouseInScreen ( W_MOUSEPOSTYPE  posT = MOUSEPOS_VIEWPORT,
uint32_t  vpID = 0 
) const
virtual

Checks if the cursor is within the coordinate system posT.

Parameters
posTCoordinate system to check if the cursor is inside
vpIDUnused
Returns
true if the cursor is within the coordinate system posT, false otherwise

Implements WWindowAndInputComponent.

◆ MouseX()

virtual double WGLFWWindowAndInputComponent::MouseX ( W_MOUSEPOSTYPE  posT = MOUSEPOS_VIEWPORT,
uint32_t  vpID = 0 
) const
virtual

Retrieves the x position of the system cursor.

Parameters
posTThe coordinate system which the position should be relative to
vpIDUnused
Returns
The x coordinate of the system cursor, relative to posT

Implements WWindowAndInputComponent.

◆ MouseY()

virtual double WGLFWWindowAndInputComponent::MouseY ( W_MOUSEPOSTYPE  posT = MOUSEPOS_VIEWPORT,
uint32_t  vpID = 0 
) const
virtual

Retrieves the y position of the system cursor.

Parameters
posTThe coordinate system which the position should be relative to
vpIDUnused
Returns
The y coordinate of the system cursor, relative to posT

Implements WWindowAndInputComponent.

◆ MouseZ()

virtual double WGLFWWindowAndInputComponent::MouseZ ( ) const
virtual

Retrieves the current scroll value of the mouse wheel. When the mouse wheel is spun, each tick will increment or decrement this value.

Returns
Current scroll value of the mouse wheel

Implements WWindowAndInputComponent.

◆ RestoreWindow()

virtual uint32_t WGLFWWindowAndInputComponent::RestoreWindow ( )
virtual

Restores the window (if it was minimized, it should make it appear).

Returns
0 if the window was hidden before this call, nonzero otherwise

Reimplemented from WWindowAndInputComponent.

◆ SetCursorMotionMode()

virtual void WGLFWWindowAndInputComponent::SetCursorMotionMode ( bool  bEnable)
virtual

Enables or disables cursor motion mode. In motion mode, the cursor is locked in place, hidden, and all mouse input is made to be relative to that locked position

Implements WWindowAndInputComponent.

◆ SetFullScreenState()

virtual void WGLFWWindowAndInputComponent::SetFullScreenState ( bool  bFullScreen)
virtual

Sets the screen to full-screen or windowed.

Parameters
bFullScreentrue to set the window to full-screen mode, false to set it to windowed mode

Reimplemented from WWindowAndInputComponent.

◆ SetMousePosition()

virtual void WGLFWWindowAndInputComponent::SetMousePosition ( double  x,
double  y,
W_MOUSEPOSTYPE  posT = MOUSEPOS_VIEWPORT 
)
virtual

Sets the cursor position, relative to the rendering viewport.

Parameters
xNew mouse position x
yNew mouse position y
posTThe coordinate system which the position should be relative to

Implements WWindowAndInputComponent.

◆ SetMouseZ()

virtual void WGLFWWindowAndInputComponent::SetMouseZ ( double  value)
virtual

Sets the value of the mouse scroll.

Parameters
valueNew value to set

Implements WWindowAndInputComponent.

◆ SetQuitKeys()

virtual void WGLFWWindowAndInputComponent::SetQuitKeys ( bool  escape = true,
bool  cmdW = true 
)
virtual

Enables or disables closing the application when certain keys are pressed

Parameters
escapeWhether or not to quit when escape is pressed
cmdWWhether or not to quit when cmd-W (Mac) is pressed

Implements WWindowAndInputComponent.

◆ SetWindowMaximumSize()

virtual void WGLFWWindowAndInputComponent::SetWindowMaximumSize ( int  maxX,
int  maxY 
)
virtual

Sets the maximum size the window can have.

Parameters
maxXMaximum width
maxYMaximum height

Reimplemented from WWindowAndInputComponent.

◆ SetWindowMinimumSize()

virtual void WGLFWWindowAndInputComponent::SetWindowMinimumSize ( int  minX,
int  minY 
)
virtual

Sets the minimum size the window can have.

Parameters
minXMinimum width
minYMinimum height

Reimplemented from WWindowAndInputComponent.

◆ SetWindowPosition()

virtual void WGLFWWindowAndInputComponent::SetWindowPosition ( int  x,
int  y 
)
virtual

Sets the position of the window on screen.

Parameters
xNew x-coordinate of the window
yNew y-coordinate of the window

Reimplemented from WWindowAndInputComponent.

◆ SetWindowSize()

virtual void WGLFWWindowAndInputComponent::SetWindowSize ( int  width,
int  height 
)
virtual

Sets the size of the window.

Parameters
widthNew window width
heightNew window height

Reimplemented from WWindowAndInputComponent.

◆ SetWindowTitle()

virtual void WGLFWWindowAndInputComponent::SetWindowTitle ( const char *const  title)
virtual

Sets the title of the window.

Parameters
titleNew title for the window

Reimplemented from WWindowAndInputComponent.

◆ ShowCursor()

virtual void WGLFWWindowAndInputComponent::ShowCursor ( bool  bShow)
virtual

Shows or hides the mouse cursor.

Parameters
bShowWhether to show or hide the cursor

Implements WWindowAndInputComponent.

◆ ShowErrorMessage()

virtual void WGLFWWindowAndInputComponent::ShowErrorMessage ( std::string  error,
bool  warning = false 
)
virtual

Displays a platform-specific error or warning message.

Parameters
errorError message to display
warningwhether or not to show a warning or error

Implements WWindowAndInputComponent.


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