VulkanEngine 0.1
Graphics engine using Vulkan
Loading...
Searching...
No Matches
VulkanEngine::Window Class Referenceabstract

Provides an abstract interface for window implementations. More...

#include <Window.h>

Inheritance diagram for VulkanEngine::Window:
VulkanEngine::GLFWWindow

Public Member Functions

 Window (uint32_t _width, uint32_t _height, const std::string &_title, bool _full_screen)
 
 ~Window ()
 Desctructor.
 
virtual bool initialize (bool invisible=false)=0
 
virtual const std::vector< const char * > getRequiredVulkanInstanceExtensions () const =0
 
virtual vk::SurfaceKHR getVkSurface ()=0
 
virtual std::shared_ptr< MouseInputgetMouseInput () const
 Get a MouseInfo instance which retrieves values from this Window instance.
 
virtual std::shared_ptr< KeyboardInputgetKeyboardInput () const
 Get keyboard input instance for this window.
 
virtual void update ()=0
 Do anything needed to update the window.
 
virtual bool shouldClose ()=0
 
virtual void setWidth (uint32_t _width)
 
virtual void setHeight (uint32_t _height)
 
virtual void setTitle (const std::string &new_title)
 
uint32_t getWidth () const
 
uint32_t getHeight () const
 
uint32_t getFramebufferWidth () const
 
uint32_t getFramebufferHeight () const
 
const std::string & getTitle () const
 
bool isFullScreen () const
 
bool sizeHasChanged () const
 

Protected Member Functions

void mousePositionCallback (double xpos, double ypos)
 
void mouseScrollCallback (double xoffset, double yoffset)
 
void mouseButtonPressedCallback (bool left_pressed, bool right_pressed, bool middle_pressed)
 Callback which gets the current status of mouse buttons.
 
void keyboardButtonPressedCallback (int scancode, const KeyboardInput::KeyInfo &key_info)
 

Protected Attributes

uint32_t width
 The current width of the window.
 
uint32_t height
 The current height of the window.
 
uint32_t framebuffer_width
 The width of the window's framebuffer.
 
uint32_t framebuffer_height
 The height of the window's framebuffer.
 
std::string title
 The title of the window.
 
bool full_screen
 Whether or not the window is set to full screen.
 
bool size_changed
 
std::shared_ptr< MouseInputmouse_input
 The MouseInput instance connected to this Window.
 
std::shared_ptr< KeyboardInputkeyboard_input
 The KeyboardInput instance connect to this Window.
 

Detailed Description

Provides an abstract interface for window implementations.

Constructor & Destructor Documentation

◆ Window()

VulkanEngine::Window::Window ( uint32_t  _width,
uint32_t  _height,
const std::string &  _title,
bool  _full_screen 
)

Contructor.

Parameters
_widthThe desired initial width of the window.
_heightThe desired initial height of the window.
_titleThe title of the window.
_full_screenIf true the window will be initialized to full screen.

Member Function Documentation

◆ getFramebufferHeight()

uint32_t VulkanEngine::Window::getFramebufferHeight ( ) const
Returns
The width of the window's framebuffer.

◆ getFramebufferWidth()

uint32_t VulkanEngine::Window::getFramebufferWidth ( ) const
Returns
The width of the window's framebuffer.

◆ getHeight()

uint32_t VulkanEngine::Window::getHeight ( ) const
Returns
The height of the window.

◆ getRequiredVulkanInstanceExtensions()

virtual const std::vector< const char * > VulkanEngine::Window::getRequiredVulkanInstanceExtensions ( ) const
pure virtual
Returns
A list of vulkan extensions required by the underlying windowing system.

Implemented in VulkanEngine::GLFWWindow.

◆ getTitle()

const std::string & VulkanEngine::Window::getTitle ( ) const
Returns
The window's title.

◆ getVkSurface()

virtual vk::SurfaceKHR VulkanEngine::Window::getVkSurface ( )
pure virtual

Create and return a vk::SurfaceKHR instance.

Parameters
instanceThe vk::Instance to create the surface for.
Returns
The created vk::SurfaceKHR.

Implemented in VulkanEngine::GLFWWindow.

◆ getWidth()

uint32_t VulkanEngine::Window::getWidth ( ) const
Returns
The width of the window.

◆ initialize()

virtual bool VulkanEngine::Window::initialize ( bool  invisible = false)
pure virtual

Initialize the window.

Returns
True on success.

Implemented in VulkanEngine::GLFWWindow.

◆ isFullScreen()

bool VulkanEngine::Window::isFullScreen ( ) const
Returns
True if the window is in full screen mode.

◆ mousePositionCallback()

void VulkanEngine::Window::mousePositionCallback ( double  xpos,
double  ypos 
)
protected

Callback which sets the current position of the mouse

Parameters
xposThe x position of the mouse
yposThe y position of the mouse

◆ mouseScrollCallback()

void VulkanEngine::Window::mouseScrollCallback ( double  xoffset,
double  yoffset 
)
protected

Callback which sets the current scroll offset of the mouse

Parameters
xoffsetThe scroll offset along x
yoffsetThe scroll offset along y

◆ setHeight()

void VulkanEngine::Window::setHeight ( uint32_t  _height)
virtual

Sets the height of the window.

Parameters
_heightThe desired height.

Reimplemented in VulkanEngine::GLFWWindow.

◆ setTitle()

void VulkanEngine::Window::setTitle ( const std::string &  new_title)
virtual

Set window title.

Parameters
new_titleThe new window title.

Reimplemented in VulkanEngine::GLFWWindow.

◆ setWidth()

void VulkanEngine::Window::setWidth ( uint32_t  _width)
virtual

Sets the width of the window.

Parameters
_widthThe desired width.

Reimplemented in VulkanEngine::GLFWWindow.

◆ shouldClose()

virtual bool VulkanEngine::Window::shouldClose ( )
pure virtual
Returns
True if the window should close.

Implemented in VulkanEngine::GLFWWindow.

◆ sizeHasChanged()

bool VulkanEngine::Window::sizeHasChanged ( ) const
Returns
True if the size has changed.

◆ update()

virtual void VulkanEngine::Window::update ( )
pure virtual

Do anything needed to update the window.

Implemented in VulkanEngine::GLFWWindow.

Member Data Documentation

◆ size_changed

bool VulkanEngine::Window::size_changed
protected

If true the window or framebuffer size has changed. Reset when calling sizeHasChanged().


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