AireEngine
A 3D Open-World Game Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Aire::Window Class Reference

#include <window.h>

Public Member Functions

 Window (int width, int height, const char *title, bool fullscreen=false)
 
 Window (const Window &)=delete
 
Windowoperator= (const Window &)=delete
 
GLFWwindowgetInternalPtr ()
 
const chargetTitle () const
 
IOHandlergetIOHandler () const
 
int getWidth () const
 
int getHeight () const
 
void getFramebufferSize (int &width, int &height) const
 
float getAspectRatio () const
 
bool isFullscreen () const
 
bool isMinimized () const
 
bool shouldClose () const
 
bool toggleFullscreen ()
 
void attachIOHandler (IOHandler &handler)
 
void setAsCurrentRenderWindow ()
 
void update ()
 Perform buffer swap and poll for I/O events.
 
void close ()
 Close the window.
 
 ~Window ()
 Destroy the window. If this is the last window, terminate GLFW.
 

Detailed Description

A wrapper class over a GLFWwindow. Creating a new window also creates the associated OpenGL context, so all OpenGL calls must be made after the window is created!

Multiple windows supported in theory but stability not guaranteed.

Constructor & Destructor Documentation

◆ Window()

Window::Window ( int width,
int height,
const char * title,
bool fullscreen = false )

Create a new window object and set up the associated OpenGL context. The context is set as current automatically, so subsequent OpenGL commands will be affecting the last created window. On resize, OpenGL viewport gets resized automatically.

Parameters
widthThe width of the window in GLFW screen coordinates.
heightThe height of the window in GLFW screen coordinates.
titleThe title of the window.
fullscreenTrue if the window should be created in fullscreen mode. In that case, the width and height parameters will come in effect only when switching to windowed mode.

Member Function Documentation

◆ attachIOHandler()

void Window::attachIOHandler ( IOHandler & handler)

Attach the specified IOHandler to this window. The handler will be used to handle key and mouse events.

Parameters
handlerThe new IO handler.

◆ getAspectRatio()

float Aire::Window::getAspectRatio ( ) const
inline

Calculate the aspect ration of the window (width/height).

Returns
The window's aspect ratio defined as width/height.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFramebufferSize()

void Aire::Window::getFramebufferSize ( int & width,
int & height ) const
inline

Get the size of the window in pixels. This is guaranteed to match OpenGL's requirements for glViewport().

Parameters
widthAn OUT parameter that will be set to the window's width in pixels.
heightAn OUT parameter that will be set to the window's height in pixels.
Here is the caller graph for this function:

◆ getHeight()

int Aire::Window::getHeight ( ) const
inline
Returns
The height of the window in GLFW screen coordinates.
Here is the caller graph for this function:

◆ getInternalPtr()

GLFWwindow * Aire::Window::getInternalPtr ( )
inline
Returns
The internal GLFWwindow handle
Here is the caller graph for this function:

◆ getIOHandler()

IOHandler * Aire::Window::getIOHandler ( ) const
inline
Returns
The attached IOHandler

◆ getTitle()

const char * Aire::Window::getTitle ( ) const
inline
Returns
The window title

◆ getWidth()

int Aire::Window::getWidth ( ) const
inline
Returns
The width of the window in GLFW screen coordinates.
Here is the caller graph for this function:

◆ isFullscreen()

bool Aire::Window::isFullscreen ( ) const
inline
Returns
True if the window is in fullscreen mode and false otherwise.

◆ isMinimized()

bool Aire::Window::isMinimized ( ) const
inline
Returns
True if the window is minimized (iconified) and false otherwise.
Here is the caller graph for this function:

◆ setAsCurrentRenderWindow()

void Aire::Window::setAsCurrentRenderWindow ( )
inline

Specify that this is the window used for rendering. All subsequent OpenGL commands will be relative to the context of this window.

◆ shouldClose()

bool Aire::Window::shouldClose ( ) const
inline
Returns
True if the window is about to be closed.

◆ toggleFullscreen()

bool Window::toggleFullscreen ( )

Toggle fullscreen mode on/off.

Returns
True if fullscreen is turned on and false otherwise.
Here is the caller graph for this function:

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