Nymph Game Engine
Chaiscript based Game Engine
|
Class for graphics system. More...
#include <graphics_system.h>
Public Member Functions | |
GraphicsSystem () | |
~GraphicsSystem () | |
void | initialize (const int width, const int height, std::string name, const bool fullscreen, const WindowExitFunctor &window_exit) |
Initializes the graphics system. More... | |
bool | isInitialized () const noexcept |
Getter to see if system is initialized. More... | |
bool | isRunning () noexcept |
Determines if running. More... | |
void | startRender () |
Starts a render. More... | |
void | stopRender () |
Stops a render. More... | |
void | startFrame () |
Starts a frame. More... | |
void | stopFrame () |
Stops a frame. More... | |
GLFWwindow * | getWindow () const noexcept |
Gets the window. More... | |
int | windowHeight () |
Getter for the window width. More... | |
int | windowWidth () |
Getter for the window height. More... | |
std::string | windowName () const noexcept |
Getter for the window name. More... | |
void | setWindowName (const std::string &name) |
Sets the window name. More... | |
int | addRenderable (std::shared_ptr< Graphics::Renderable > renderable) |
Adds a renderable to the renderable pool. More... | |
bool | removeRenderable (const int id) |
Removes a renderable from the renderable pool. More... | |
int | renderablesCount () |
Returns the number of renderables currently in the system. More... | |
void | setMaxInfluenceLights (const unsigned int number) noexcept |
Sets the maximum number influencing lights. More... | |
unsigned int | getMaxInfluenceLights () const noexcept |
Gets the maximum number of influencing lights. More... | |
void | addLight (std::shared_ptr< Light > light) noexcept |
Adds a light. More... | |
void | removeLight (std::shared_ptr< Light > light) |
Removes a light. More... | |
GLFWwindow * | getCurrentWindow () noexcept |
void | destroy () |
Closes window, and destroys GLFW context. More... | |
Class for graphics system.
Graphics::GraphicsSystem::GraphicsSystem | ( | ) |
Graphics::GraphicsSystem::~GraphicsSystem | ( | ) |
References destroy().
|
noexcept |
int Graphics::GraphicsSystem::addRenderable | ( | std::shared_ptr< Graphics::Renderable > | renderable | ) |
Adds a renderable to the renderable pool.
Added to the pool of renderables that can be rendered during the update loop.
renderable | Shared Pointer to a previously created renderable |
Referenced by generated::getGraphicsSystemModule().
void Graphics::GraphicsSystem::destroy | ( | ) |
Closes window, and destroys GLFW context.
This closes the window created by GLFW and terminates glfw. Initialize must be called to get another window.
Referenced by ~GraphicsSystem().
|
noexcept |
|
noexcept |
Gets the maximum number of influencing lights.
Referenced by generated::getGraphicsSystemModule().
|
noexcept |
void Graphics::GraphicsSystem::initialize | ( | const int | width, |
const int | height, | ||
std::string | name, | ||
const bool | fullscreen, | ||
const WindowExitFunctor & | window_exit | ||
) |
Initializes the graphics system.
This function initializes the graphics system by creating a GLFW based window at the specified size, and having the supplied name as the window title. Max FPS can also be supplied to allow VSYNC.
width | window width in px |
height | window height in px |
name | string containing the name of the window to be built |
max_fps | double containing the max allowed fps. Default 0.0. |
|
noexcept |
Getter to see if system is initialized.
Will return true after initialize() is called.
|
noexcept |
Determines if running.
void Graphics::GraphicsSystem::removeLight | ( | std::shared_ptr< Light > | light | ) |
bool Graphics::GraphicsSystem::removeRenderable | ( | const int | id | ) |
Removes a renderable from the renderable pool.
Removed from the pool of renderables to take it out of the update loop.
id | id integer of renderable to remove |
Referenced by generated::getGraphicsSystemModule().
int Graphics::GraphicsSystem::renderablesCount | ( | ) |
Returns the number of renderables currently in the system.
This returns the number of renderables that have been added to the system, and are ready to be updated and rendered.
Referenced by generated::getGraphicsSystemModule().
|
noexcept |
Sets the maximum number influencing lights.
[in] | number | The number |
Referenced by generated::getGraphicsSystemModule().
void Graphics::GraphicsSystem::setWindowName | ( | const std::string & | name | ) |
Sets the window name.
[in] | name | The name |
Referenced by generated::getGraphicsSystemModule().
void Graphics::GraphicsSystem::startFrame | ( | ) |
Starts a frame.
void Graphics::GraphicsSystem::startRender | ( | ) |
Starts a render.
void Graphics::GraphicsSystem::stopFrame | ( | ) |
Stops a frame.
void Graphics::GraphicsSystem::stopRender | ( | ) |
Stops a render.
int Graphics::GraphicsSystem::windowHeight | ( | ) |
Getter for the window width.
This Pings GLFW to get the width of the window.
Referenced by generated::getGraphicsSystemModule().
|
noexcept |
Getter for the window name.
This will return the name of the window
Referenced by generated::getGraphicsSystemModule().
int Graphics::GraphicsSystem::windowWidth | ( | ) |
Getter for the window height.
This Pings GLFW to get the height of the window.
Referenced by generated::getGraphicsSystemModule().