Brenta Engine 1.1
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 is_mouse_captured=false, const char *title="OpenGL", bool msaa=false, bool vsync=false)
 Initialize the window.
 
static int get_width ()
 Get the width of the window.
 
static int get_height ()
 Get the height of the window.
 
static bool is_window_closed ()
 Check if the window is closed.
 
static bool is_key_pressed (int key)
 Check if a key is pressed.
 
static float get_time ()
 Get the time.
 
static GLFWwindow * get_window ()
 Get the window.
 
static GLFWglproc get_proc_address ()
 Get the OpenGL function pointer.
 
static void set_mouse_callback (GLFWcursorposfun callback)
 Set the mouse callback.
 
static void set_size_callback (GLFWframebuffersizefun callback)
 Set the key callback.
 
static void set_mouse_pos_callback (GLFWcursorposfun callback)
 Set the mouse position callback.
 
static void set_key_callback (GLFWkeyfun callback)
 Set the key callback.
 
static void set_mouse_capture (bool is_captured)
 Set the mouse capture.
 
static void set_close ()
 Set the window close flag.
 
static void swap_buffers ()
 Swap the front and back buffers.
 
static void poll_events ()
 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

◆ get_height()

int screen::get_height ( )
static

Get the height of the window.

Definition at line 110 of file screen.cpp.

◆ get_proc_address()

GLFWglproc screen::get_proc_address ( )
static

Get the OpenGL function pointer.

Returns
OpenGL function pointer

Definition at line 100 of file screen.cpp.

◆ get_time()

float screen::get_time ( )
static

Get the time.

Returns
Time since the start of the program

Definition at line 90 of file screen.cpp.

◆ get_width()

int screen::get_width ( )
static

Get the width of the window.

Returns
Width of the window

Definition at line 105 of file screen.cpp.

◆ get_window()

GLFWwindow * screen::get_window ( )
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 is_mouse_captured = 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
is_mouse_capturedIf 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.

◆ is_key_pressed()

bool screen::is_key_pressed ( 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.

◆ is_window_closed()

bool screen::is_window_closed ( )
static

Check if the window is closed.

Returns
If the window is closed

Definition at line 80 of file screen.cpp.

◆ poll_events()

void screen::poll_events ( )
static

Poll all pending events.

Definition at line 159 of file screen.cpp.

◆ set_close()

void screen::set_close ( )
static

Set the window close flag.

Definition at line 141 of file screen.cpp.

◆ set_key_callback()

void screen::set_key_callback ( GLFWkeyfun callback)
static

Set the key callback.

Parameters
callbackCallback to set

Definition at line 172 of file screen.cpp.

◆ set_mouse_callback()

void screen::set_mouse_callback ( GLFWcursorposfun callback)
static

Set the mouse callback.

Parameters
callbackCallback to set

Definition at line 115 of file screen.cpp.

◆ set_mouse_capture()

void screen::set_mouse_capture ( bool is_captured)
static

Set the mouse capture.

Parameters
isCapturedIf the mouse is captured

Definition at line 127 of file screen.cpp.

◆ set_mouse_pos_callback()

void screen::set_mouse_pos_callback ( GLFWcursorposfun callback)
static

Set the mouse position callback.

Parameters
callbackCallback to set

Definition at line 177 of file screen.cpp.

◆ set_size_callback()

void screen::set_size_callback ( GLFWframebuffersizefun callback)
static

Set the key callback.

Parameters
callbackCallback to set

Definition at line 120 of file screen.cpp.

◆ swap_buffers()

void screen::swap_buffers ( )
static

Swap the front and back buffers.

Having to buffers is done to avoid flickering.

Definition at line 154 of file screen.cpp.

◆ terminate()

void screen::terminate ( )
static

Terminate the window.

Definition at line 146 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: