Kale
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
Kale::Window Class Reference

#include <Window.hpp>

Public Member Functions

 Window ()
 
 ~Window ()
 
bool isOpen () const
 
void lockCursor ()
 
void unlockCursor ()
 
void setIcon (const std::string &filePath)
 
Vector2ui getSize () const
 
Vector2f getSizeF () const
 
Vector2ui getFramebufferSize () const
 
const char * getTitle () const
 
void registerEvents (EventHandler *handler)
 
void removeEvents (EventHandler *handler)
 

Protected Member Functions

void create (const char *title)
 
void update ()
 
std::vector< const char * > getInstanceExtensions () const
 
void createWindowSurface (const vk::UniqueInstance &instance, vk::UniqueSurfaceKHR &surface) const
 
void setupGlad () const
 
void swapBuffers () const noexcept
 

Private Attributes

std::list< EventHandler * > eventHandlers
 

Friends

class Vulkan::Core
 
class OpenGL::Core
 
class Application
 

Detailed Description

Definition at line 77 of file Window.hpp.

Constructor & Destructor Documentation

◆ Window()

Kale::Window::Window ( )

Initializes the lower level Windowing API

◆ ~Window()

Kale::Window::~Window ( )

Frees resources of the window

Member Function Documentation

◆ create()

void Kale::Window::create ( const char * title)
protected

Creates a new window. Some Operating systems (IOS/Android/TvOS) only support the creation of a single window

Parameters
titleThe title of the window

◆ createWindowSurface()

void Kale::Window::createWindowSurface ( const vk::UniqueInstance & instance,
vk::UniqueSurfaceKHR & surface ) const
protected

Creates a vulkan window surface given the instance and the surface references

Parameters
instanceThe instance reference
surfaceThe surface reference
Exceptions
Ifthe surface creation failed

◆ getFramebufferSize()

Vector2ui Kale::Window::getFramebufferSize ( ) const

Gets the frame buffer size for canvas creation

◆ getInstanceExtensions()

std::vector< const char * > Kale::Window::getInstanceExtensions ( ) const
protected

Gets the extensions required for VKCreateInfo depending on the windowing API

Returns
The required extensions for the lower level windowing API

◆ getSize()

Vector2ui Kale::Window::getSize ( ) const

Gets the window size

Returns
The window size

◆ getSizeF()

Vector2f Kale::Window::getSizeF ( ) const

Gets the window size

Returns
The window size as a float vector

◆ getTitle()

const char * Kale::Window::getTitle ( ) const

Gets the window title

Returns
The window title

◆ isOpen()

bool Kale::Window::isOpen ( ) const

Thread safe method to check whether or not the window is currently open

Returns
Whether or not the window is open

◆ lockCursor()

void Kale::Window::lockCursor ( )

Locks the cursor to allow for better gameplay

◆ registerEvents()

void Window::registerEvents ( EventHandler * handler)

Starts listening to events, override the functions provided in EventHandler to handle the events

Parameters
handlerThe handler to begin receiving events with

Starts listening to events, override the functions provided in EventHandler to handle the events

Definition at line 24 of file Window.cpp.

◆ removeEvents()

void Window::removeEvents ( EventHandler * handler)

Stops listening to events

Parameters
handlerThe handler to remove from receiving events

Stops listening to events

Definition at line 31 of file Window.cpp.

◆ setIcon()

void Kale::Window::setIcon ( const std::string & filePath)

Sets the window icon to the given image

Parameters
filePathThe window icon to set to

◆ setupGlad()

void Kale::Window::setupGlad ( ) const
protected

Sets up Glad

Exceptions
Ifsetup fails

◆ swapBuffers()

void Kale::Window::swapBuffers ( ) const
protectednoexcept

Uses the windowing API to swap the front and back buffers

◆ unlockCursor()

void Kale::Window::unlockCursor ( )

Unlocks the cursor for menus/etc

◆ update()

void Kale::Window::update ( )
protected

Updates the window

Friends And Related Symbol Documentation

◆ Application

friend class Application
friend

Definition at line 143 of file Window.hpp.

◆ OpenGL::Core

friend class OpenGL::Core
friend

Definition at line 139 of file Window.hpp.

◆ Vulkan::Core

friend class Vulkan::Core
friend

Definition at line 122 of file Window.hpp.

Member Data Documentation

◆ eventHandlers

std::list<EventHandler*> Kale::Window::eventHandlers
private

A linked list of all event listeners for this window

Definition at line 90 of file Window.hpp.


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