Brenta Engine 1.2
Loading...
Searching...
No Matches
brenta::window Class Reference

Window subsystem. More...

#include <window.hpp>

Inheritance diagram for brenta::window:
brenta::subsystem

Data Structures

class  builder
 
struct  config
 

Public Member Functions

std::expected< void, subsystem::error > initialize () override
 
std::expected< void, subsystem::error > terminate () override
 
std::string name () override
 Returns the name of the sybsystem.
 
bool is_initialized () override
 Returns true if the subsystem is initialized.
 
- Public Member Functions inherited from brenta::subsystem

Static Public Member Functions

static brenta::windowinstance ()
 Get a static instance of the window.
 
static int get_width ()
 
static int get_height ()
 
static bool should_close ()
 
static bool is_key_pressed (int key)
 
static float get_time ()
 
static GLFWwindow * get_window ()
 
static GLFWglproc get_proc_address ()
 Get the OpenGL function pointer.
 
static void set_mouse_callback (GLFWcursorposfun callback)
 
static void set_size_callback (GLFWframebuffersizefun callback)
 
static void set_mouse_pos_callback (GLFWcursorposfun callback)
 
static void set_key_callback (GLFWkeyfun callback)
 
static void set_mouse_capture (bool is_captured)
 
static void set_width_height (int width, int height)
 
static void close ()
 
static void swap_buffers ()
 Swap the front and back buffers.
 
static void poll_events ()
 Poll all pending events.
 

Static Public Attributes

static const std::string subsystem_name = "window"
 
static const window::config default_config
 
static window::config init_config = window::default_config
 

Additional Inherited Members

- Public Types inherited from brenta::subsystem
using error = std::string
 

Detailed Description

Window 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 28 of file window.hpp.

Member Function Documentation

◆ close()

void window::close ( )
static

Definition at line 193 of file window.cpp.

◆ get_height()

int window::get_height ( )
static

Definition at line 162 of file window.cpp.

◆ get_proc_address()

GLFWglproc window::get_proc_address ( )
static

Get the OpenGL function pointer.

Returns
OpenGL function pointer

Definition at line 152 of file window.cpp.

◆ get_time()

float window::get_time ( )
static

Definition at line 142 of file window.cpp.

◆ get_width()

int window::get_width ( )
static

Definition at line 157 of file window.cpp.

◆ get_window()

GLFWwindow * window::get_window ( )
static

Definition at line 147 of file window.cpp.

◆ initialize()

std::expected< void, subsystem::error > window::initialize ( )
overridevirtual

Implements brenta::subsystem.

Definition at line 42 of file window.cpp.

◆ instance()

window & window::instance ( )
static

Get a static instance of the window.

Definition at line 119 of file window.cpp.

◆ is_initialized()

bool window::is_initialized ( )
overridevirtual

Returns true if the subsystem is initialized.

Implements brenta::subsystem.

Definition at line 110 of file window.cpp.

◆ is_key_pressed()

bool window::is_key_pressed ( int key)
static

Definition at line 137 of file window.cpp.

◆ name()

std::string window::name ( )
overridevirtual

Returns the name of the sybsystem.

Implements brenta::subsystem.

Definition at line 105 of file window.cpp.

◆ poll_events()

void window::poll_events ( )
static

Poll all pending events.

Definition at line 203 of file window.cpp.

◆ set_key_callback()

void window::set_key_callback ( GLFWkeyfun callback)
static

Definition at line 217 of file window.cpp.

◆ set_mouse_callback()

void window::set_mouse_callback ( GLFWcursorposfun callback)
static

Definition at line 167 of file window.cpp.

◆ set_mouse_capture()

void window::set_mouse_capture ( bool is_captured)
static

Definition at line 179 of file window.cpp.

◆ set_mouse_pos_callback()

void window::set_mouse_pos_callback ( GLFWcursorposfun callback)
static

Definition at line 222 of file window.cpp.

◆ set_size_callback()

void window::set_size_callback ( GLFWframebuffersizefun callback)
static

Definition at line 172 of file window.cpp.

◆ set_width_height()

void window::set_width_height ( int width,
int height )
static

Definition at line 130 of file window.cpp.

◆ should_close()

bool window::should_close ( )
static

Definition at line 125 of file window.cpp.

◆ swap_buffers()

void window::swap_buffers ( )
static

Swap the front and back buffers.

Having two buffers is done to avoid flickering.

Definition at line 198 of file window.cpp.

◆ terminate()

std::expected< void, subsystem::error > window::terminate ( )
overridevirtual

Implements brenta::subsystem.

Definition at line 93 of file window.cpp.

Field Documentation

◆ default_config

const window::config window::default_config
static
Initial value:
= {
800,
600,
"Brenta Engine",
false,
false,
false,
false,
}

Definition at line 36 of file window.hpp.

◆ init_config

window::config window::init_config = window::default_config
static

Definition at line 37 of file window.hpp.

◆ subsystem_name

const std::string window::subsystem_name = "window"
static

Definition at line 35 of file window.hpp.


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