Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Graphics::GraphicsSystem Class Reference

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...
 

Detailed Description

Class for graphics system.

Constructor & Destructor Documentation

Graphics::GraphicsSystem::GraphicsSystem ( )
Graphics::GraphicsSystem::~GraphicsSystem ( )

References destroy().

Member Function Documentation

void Graphics::GraphicsSystem::addLight ( std::shared_ptr< Light light)
noexcept

Adds a light.

Parameters
[in]lightThe light

Referenced by generated::getGraphicsSystemModule().

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.

Parameters
renderableShared Pointer to a previously created renderable
Returns
id integer of the 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().

GLFWwindow * Graphics::GraphicsSystem::getCurrentWindow ( )
noexcept
unsigned int Graphics::GraphicsSystem::getMaxInfluenceLights ( ) const
noexcept

Gets the maximum number of influencing lights.

Returns
The maximum influence lights.

Referenced by generated::getGraphicsSystemModule().

GLFWwindow * Graphics::GraphicsSystem::getWindow ( ) const
noexcept

Gets the window.

Returns
The window.

Referenced by Engine::setup().

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.

Parameters
widthwindow width in px
heightwindow height in px
namestring containing the name of the window to be built
max_fpsdouble containing the max allowed fps. Default 0.0.
bool Graphics::GraphicsSystem::isInitialized ( ) const
noexcept

Getter to see if system is initialized.

Will return true after initialize() is called.

Returns
true if initialized() has been called, false otherwise
bool Graphics::GraphicsSystem::isRunning ( )
noexcept

Determines if running.

Returns
True if running, False otherwise.
void Graphics::GraphicsSystem::removeLight ( std::shared_ptr< Light light)

Removes a light.

Parameters
[in]lightThe light

Referenced by generated::getGraphicsSystemModule().

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.

Parameters
idid integer of renderable to remove
Returns
true if successful, false if it didn't exist

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.

Returns
integer representing number of renderables in the system

Referenced by generated::getGraphicsSystemModule().

void Graphics::GraphicsSystem::setMaxInfluenceLights ( const unsigned int  number)
noexcept

Sets the maximum number influencing lights.

Parameters
[in]numberThe number

Referenced by generated::getGraphicsSystemModule().

void Graphics::GraphicsSystem::setWindowName ( const std::string &  name)

Sets the window name.

Parameters
[in]nameThe 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.

Returns
integer denoting pixel width of window

Referenced by generated::getGraphicsSystemModule().

std::string Graphics::GraphicsSystem::windowName ( ) const
noexcept

Getter for the window name.

This will return the name of the window

Returns
a string that is 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.

Returns
integer denoting pixel height of window

Referenced by generated::getGraphicsSystemModule().


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