KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::WindowsWindow Class Reference
Inheritance diagram for Karma::WindowsWindow:
Collaboration diagram for Karma::WindowsWindow:

Public Member Functions

 WindowsWindow (const WindowProps &props)
 
virtual void OnUpdate () override
 Pure virtual function for calls in each loop.
 
virtual bool OnResize (WindowResizeEvent &event) override
 Pure virtual function called when Window resize happens.
 
unsigned int GetWidth () const override
 A pure virtual getter for Width of the Window.
 
unsigned int GetHeight () const override
 Pure virtual getter for the Height of the Window.
 
void SetEventCallback (const EventCallbackFn &callback) override
 Setting a function, Application::OnEvent, to be called when a Karma Event happens, detected by GLFW Window like so.
 
virtual void * GetNativeWindow () const override
 Pure virtual getter for the native (GLFW) Window handle.
 
void SetVSync (bool enabled) override
 Pure virtual function for VSync.
 
bool IsVSync () const override
 Pure virtual function for VSync status.
 
GLFWwindow * GetHandle () const
 
- Public Member Functions inherited from Karma::Window
virtual ~Window ()
 A virtual destructor for the Window.
 

Additional Inherited Members

- Public Types inherited from Karma::Window
using EventCallbackFn = std::function<void(Event&)>
 A data structure for use in Window::SetEventCallback.
 
- Static Public Member Functions inherited from Karma::Window
static WindowCreate (const WindowProps &props=WindowProps())
 Platform based, implemented function for Window creation.
 

Member Function Documentation

◆ GetHeight()

unsigned int Karma::WindowsWindow::GetHeight ( ) const
inlineoverridevirtual

Pure virtual getter for the Height of the Window.

Since
Karma 1.0.0

Implements Karma::Window.

◆ GetNativeWindow()

virtual void * Karma::WindowsWindow::GetNativeWindow ( ) const
inlineoverridevirtual

Pure virtual getter for the native (GLFW) Window handle.

Since
Karma 1.0.0

Implements Karma::Window.

◆ GetWidth()

unsigned int Karma::WindowsWindow::GetWidth ( ) const
inlineoverridevirtual

A pure virtual getter for Width of the Window.

Since
Karma 1.0.0

Implements Karma::Window.

◆ IsVSync()

bool Karma::WindowsWindow::IsVSync ( ) const
overridevirtual

Pure virtual function for VSync status.

Since
Karma 1.0.0

Implements Karma::Window.

◆ OnResize()

bool Karma::WindowsWindow::OnResize ( WindowResizeEvent & event)
overridevirtual

Pure virtual function called when Window resize happens.

See also
Application::OnWindowResize
Since
Karma 1.0.0

Implements Karma::Window.

◆ OnUpdate()

void Karma::WindowsWindow::OnUpdate ( )
overridevirtual

Pure virtual function for calls in each loop.

See also
Application::Run()
Since
Karma 1.0.0

Implements Karma::Window.

◆ SetEventCallback()

void Karma::WindowsWindow::SetEventCallback ( const EventCallbackFn & callback)
inlineoverridevirtual

Setting a function, Application::OnEvent, to be called when a Karma Event happens, detected by GLFW Window like so.

SetGLFWCallbacks(GLFWwindow* glfwWindow)
{
//
// @param GLFWwindow the window whose sizecallback is desired
// @param GLFWwindowsizefun the function pointer that gets called whenever
// window size changes. The Cherno uses something what is
// known as lambda. I don't quite understand the relation
// between function pointer and lambda.
//
glfwSetWindowSizeCallback(glfwWindow, [](GLFWwindow* window, int width, int height)
{
WindowData& data = *(WindowData*)glfwGetWindowUserPointer(window);
data.Width = width;
data.Height = height;
WindowResizeEvent event(width, height);
data.EventCallback(event);// <-- This is translated to Application::OnEvent(event)
});
}
Event triggered when Window is resized.
Definition ApplicationEvent.h:22

Setting the listener basically.

Parameters
callbackThe function to be called
See also
Application::Application()
Since
Karma 1.0.0

Implements Karma::Window.

◆ SetVSync()

void Karma::WindowsWindow::SetVSync ( bool enabled)
overridevirtual

Pure virtual function for VSync.

Since
Karma 1.0.0

Implements Karma::Window.


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