Brenta Engine 1.0
Loading...
Searching...
No Matches
Brenta::Screen Class Reference

Screen subsystem. More...

#include <screen.hpp>

Static Public Member Functions

static void Init (int SCR_WIDTH, int SCR_HEIGHT, bool isMouseCaptured=false, const char *title="OpenGL", bool msaa=false, bool vsync=false)
 Initialize the window.
 
static int GetWidth ()
 Get the width of the window.
 
static int GetHeight ()
 Get the height of the window.
 
static bool isWindowClosed ()
 Check if the window is closed.
 
static bool isKeyPressed (int key)
 Check if a key is pressed.
 
static float GetTime ()
 Get the time.
 
static GLFWwindow * GetWindow ()
 Get the window.
 
static GLFWglproc GetProcAddress ()
 Get the OpenGL function pointer.
 
static void SetMouseCallback (GLFWcursorposfun callback)
 Set the mouse callback.
 
static void SetSizeCallback (GLFWframebuffersizefun callback)
 Set the key callback.
 
static void SetMousePosCallback (GLFWcursorposfun callback)
 Set the mouse position callback.
 
static void SetKeyCallback (GLFWkeyfun callback)
 Set the key callback.
 
static void SetMouseCapture (bool isCaptured)
 Set the mouse capture.
 
static void SetClose ()
 Set the window close flag.
 
static void SwapBuffers ()
 Swap the front and back buffers.
 
static void PollEvents ()
 Poll all pending events.
 
static void Terminate ()
 Terminate the window.
 

Static Public Attributes

static int WIDTH
 Width of the window.
 
static int HEIGHT
 Height of the window.
 
static GLFWwindow * window
 Pointer to the window.
 

Detailed Description

Screen subsystem.

This class is used to create a window and handle all the events related to the window. This class provides methods to initialize the window, get the window size, check if a key is pressed, get the time since the start of the program, and more.

Definition at line 47 of file screen.hpp.

Member Function Documentation

◆ GetHeight()

int Screen::GetHeight ( )
static

Get the height of the window.

Definition at line 110 of file screen.cpp.

◆ GetProcAddress()

GLFWglproc Screen::GetProcAddress ( )
static

Get the OpenGL function pointer.

Returns
OpenGL function pointer

Definition at line 100 of file screen.cpp.

◆ GetTime()

float Screen::GetTime ( )
static

Get the time.

Returns
Time since the start of the program

Definition at line 90 of file screen.cpp.

◆ GetWidth()

int Screen::GetWidth ( )
static

Get the width of the window.

Returns
Width of the window

Definition at line 105 of file screen.cpp.

◆ GetWindow()

GLFWwindow * Screen::GetWindow ( )
static

Get the window.

Returns
Window

Definition at line 95 of file screen.cpp.

◆ Init()

void Screen::Init ( int SCR_WIDTH,
int SCR_HEIGHT,
bool isMouseCaptured = false,
const char * title = "OpenGL",
bool msaa = false,
bool vsync = false )
static

Initialize the window.

This method initializes the window with the given width and height, and sets the title of the window. The window is created with the given parameters.

Parameters
SCR_WIDTHWidth of the window
SCR_HEIGHTHeight of the window
isMouseCapturedIf the mouse is captured
titleTitle of the window
msaaIf multisampling is enabled
vsyncIf vertical synchronization is enabled

Definition at line 42 of file screen.cpp.

◆ isKeyPressed()

bool Screen::isKeyPressed ( int key)
static

Check if a key is pressed.

Parameters
keyKey to check
Returns
If the key is pressed

Definition at line 85 of file screen.cpp.

◆ isWindowClosed()

bool Screen::isWindowClosed ( )
static

Check if the window is closed.

Returns
If the window is closed

Definition at line 80 of file screen.cpp.

◆ PollEvents()

void Screen::PollEvents ( )
static

Poll all pending events.

Definition at line 158 of file screen.cpp.

◆ SetClose()

void Screen::SetClose ( )
static

Set the window close flag.

Definition at line 142 of file screen.cpp.

◆ SetKeyCallback()

void Screen::SetKeyCallback ( GLFWkeyfun callback)
static

Set the key callback.

Parameters
callbackCallback to set

Definition at line 171 of file screen.cpp.

◆ SetMouseCallback()

void Screen::SetMouseCallback ( GLFWcursorposfun callback)
static

Set the mouse callback.

Parameters
callbackCallback to set

Definition at line 115 of file screen.cpp.

◆ SetMouseCapture()

void Screen::SetMouseCapture ( bool isCaptured)
static

Set the mouse capture.

Parameters
isCapturedIf the mouse is captured

Definition at line 127 of file screen.cpp.

◆ SetMousePosCallback()

void Screen::SetMousePosCallback ( GLFWcursorposfun callback)
static

Set the mouse position callback.

Parameters
callbackCallback to set

Definition at line 176 of file screen.cpp.

◆ SetSizeCallback()

void Screen::SetSizeCallback ( GLFWframebuffersizefun callback)
static

Set the key callback.

Parameters
callbackCallback to set

Definition at line 120 of file screen.cpp.

◆ SwapBuffers()

void Screen::SwapBuffers ( )
static

Swap the front and back buffers.

Having to buffers is done to avoid flickering.

Definition at line 153 of file screen.cpp.

◆ Terminate()

void Screen::Terminate ( )
static

Terminate the window.

Definition at line 147 of file screen.cpp.

Field Documentation

◆ HEIGHT

int Screen::HEIGHT
static

Height of the window.

Definition at line 57 of file screen.hpp.

◆ WIDTH

int Screen::WIDTH
static

Width of the window.

Definition at line 53 of file screen.hpp.

◆ window

GLFWwindow * Screen::window
static

Pointer to the window.

Definition at line 61 of file screen.hpp.


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