Wasabi
|
#include <WWindowsWindowAndInputComponent.hpp>
Public Member Functions | |
WWindowsWindowAndInputComponent (class Wasabi *const app) | |
virtual WError | Initialize (int width, int height) |
virtual bool | Loop () |
virtual void | Cleanup () |
HWND | GetWindow () const |
HINSTANCE | GetInstance () const |
void | SetWndProcCallback (LRESULT(CALLBACK *proc)(Wasabi *, HWND, UINT, WPARAM, LPARAM, bool)) |
virtual void * | GetPlatformHandle () const |
virtual void * | GetWindowHandle () const |
virtual VkSurfaceKHR | GetVulkanSurface () const |
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) |
![]() | |
WWindowAndInputComponent (class Wasabi *const app) | |
virtual void | GetVulkanRequiredExtensions (std::vector< const char * > &extensions)=0 |
Friends | |
LRESULT CALLBACK | hMainWndProc (HWND hWnd, uint32_t msg, WPARAM wParam, LPARAM lParam) |
Additional Inherited Members | |
![]() | |
class Wasabi * | m_app |
Creating an instance of this class creates the following engine parameters:
|
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.
|
virtual |
Retrieves the full-screen state of the window, see SetFullScreenState().
Reimplemented from WWindowAndInputComponent.
HINSTANCE WWindowsWindowAndInputComponent::GetInstance | ( | ) | const |
Retrieves the Windows application instance handle (HINSTANCE).
|
virtual |
Retrieves the platform-specific handle needed by Vulkan. For example, on Windows, this must return the HINSTANCE of the application.
Implements WWindowAndInputComponent.
|
virtual |
Retrieves the Vulkan Surface that can be used to render.
Implements WWindowAndInputComponent.
HWND WWindowsWindowAndInputComponent::GetWindow | ( | ) | const |
Retrieves the window (HWND) handle.
|
virtual |
Retrieves the platform-specific window handle. For example, on Windows, this must return the HWND created by Initialize().
Implements WWindowAndInputComponent.
|
virtual |
Retrieves the height of the client area of the window.
framebuffer | If true, this function retrieves the height of the frame buffer inside the window. Otherwise it returns the height of the window |
Reimplemented from WWindowAndInputComponent.
|
virtual |
Retrieves the x-coordinate of the window on the screen.
Reimplemented from WWindowAndInputComponent.
|
virtual |
Retrieves the y-coordinate of the window on the screen.
Reimplemented from WWindowAndInputComponent.
|
virtual |
Retrieves the width of the client area of the window.
framebuffer | If true, this function retrieves the width of the frame buffer inside the window. Otherwise it returns the width of the window |
Reimplemented from WWindowAndInputComponent.
|
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.
width | Width of the window to be created/resized to |
height | Height of the window to be created/resized to |
Implements WWindowAndInputComponent.
|
virtual |
Forcefully sets the state of a key.
key | Key to set |
state | State to set the key to, true being pressed and false being released |
Implements WWindowAndInputComponent.
|
virtual |
Checks if a key is currently pressed.
key | Key to check |
Implements WWindowAndInputComponent.
|
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.
Implements WWindowAndInputComponent.
|
virtual |
Maximizes the window.
Reimplemented from WWindowAndInputComponent.
|
virtual |
Minimizes the window.
Reimplemented from WWindowAndInputComponent.
|
virtual |
Check if a mouse button is clicked.
button | Button to check |
Implements WWindowAndInputComponent.
|
virtual |
Checks if the cursor is within the coordinate system posT.
posT | Coordinate system to check if the cursor is inside |
vpID | Unused |
Implements WWindowAndInputComponent.
|
virtual |
Retrieves the x position of the system cursor.
posT | The coordinate system which the position should be relative to |
vpID | Unused |
Implements WWindowAndInputComponent.
|
virtual |
Retrieves the y position of the system cursor.
posT | The coordinate system which the position should be relative to |
vpID | Unused |
Implements WWindowAndInputComponent.
|
virtual |
Retrieves the current scroll value of the mouse wheel. When the mouse wheel is spun, each tick will increment or decrement this value.
Implements WWindowAndInputComponent.
|
virtual |
Restores the window (if it was minimized, it should make it appear).
Reimplemented from WWindowAndInputComponent.
|
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.
|
virtual |
Sets the screen to full-screen or windowed.
bFullScreen | true to set the window to full-screen mode, false to set it to windowed mode |
Reimplemented from WWindowAndInputComponent.
|
virtual |
Sets the cursor position, relative to the rendering viewport.
x | New mouse position x |
y | New mouse position y |
posT | The coordinate system which the position should be relative to |
Implements WWindowAndInputComponent.
|
virtual |
Sets the value of the mouse scroll.
value | New value to set |
Implements WWindowAndInputComponent.
|
virtual |
Enables or disables closing the application when certain keys are pressed
escape | Whether or not to quit when escape is pressed |
cmdW | Whether or not to quit when cmd-W (Mac) is pressed |
Implements WWindowAndInputComponent.
|
virtual |
Sets the maximum size the window can have.
maxX | Maximum width |
maxY | Maximum height |
Reimplemented from WWindowAndInputComponent.
|
virtual |
Sets the minimum size the window can have.
minX | Minimum width |
minY | Minimum height |
Reimplemented from WWindowAndInputComponent.
|
virtual |
Sets the position of the window on screen.
x | New x-coordinate of the window |
y | New y-coordinate of the window |
Reimplemented from WWindowAndInputComponent.
|
virtual |
Sets the size of the window.
width | New window width |
height | New window height |
Reimplemented from WWindowAndInputComponent.
|
virtual |
Sets the title of the window.
title | New title for the window |
Reimplemented from WWindowAndInputComponent.
void WWindowsWindowAndInputComponent::SetWndProcCallback | ( | LRESULT(CALLBACK *proc)(Wasabi *, HWND, UINT, WPARAM, LPARAM, bool) | ) |
Assigns a function to intercept window procedure callbacks. This callback will be called once before the default handler is run by Wasabi and once after.
proc | A function pointer which will be called given the Wasabi instance, window proc arguments and a boolean set to true on the pre-processing call and false on the second, after-processing call |
|
virtual |
Shows or hides the mouse cursor.
bShow | Whether to show or hide the cursor |
Implements WWindowAndInputComponent.
|
virtual |
Displays a platform-specific error or warning message.
error | Error message to display |
warning | whether or not to show a warning or error |
Implements WWindowAndInputComponent.