BARE2D
BARE2D Namespace Reference

Namespaces

 LuaFunctions
 

Data Structures

class  App
 
class  Attribute
 
class  AttributeBase
 The AttributeBase class only exists for some templating acrobatics reasons (as an abstract base class for Attribute) More...
 
class  AudioManager
 
class  BARECEGUI
 
class  BasicRenderer
 
class  BumpyGlyph
 This is a glyph, but with bumpmap (for lighting etc.). More...
 
class  BumpyRenderer
 This is a BasicRenderer, but it includes the usage of bumpmaps. This can be useful for lighting. Has an additional uniform bumpmapSampler (sampler2D). More...
 
class  Cache
 This is a skeleton cache class. This can only be used by the ResourceManager or other classes who actually maintain proper pointer ownership. More...
 
class  Camera2D
 The basic camera for a 2D world. There are two spaces - the Worldspace and the Viewspace. The Worldspace is standard for all cameras, it is the 'gameworld' space. The Viewspace is the subspace of the worldspace. It is what the camera captures. Scale is zoom factor. NOT resolution scalar. More...
 
class  CameraState
 Holds some basic information that the camera holds in a state. More...
 
struct  CEGUIContextWrapper
 
class  CharacterGlyph
 Represents a render glyph, modified for fonts! More...
 
struct  Circle
 
class  Colour
 An RGBA 8-bit colour value. More...
 
class  DebugRenderer
 
class  FBORenderer
 The FBORenderer represents and manages an entire FrameBufferObject. This allows one to draw entire scenes first to a texture, then perform some operations on that texture, then draw that texture to the screen. Shaders have uniforms projectionMatrix (mat4), colourTexture (sampler2D), and depthTexture (sampler2D) More...
 
class  Filesystem
 
class  Font
 Essentially just a wrapper for the SDL TTF_Font type. More...
 
class  FontRenderer
 The FontRenderer... renders fonts. It is just a very basic extension of the BasicRenderer, so it works the same. More...
 
class  GLContext
 
class  GLContextManager
 
class  Glyph
 The glyph represents a renderbatch's primitive data, which is created from each draw call in the basic renderer. More...
 
class  InputManager
 This is the input manager. It does what you expect! Nearly completely copied from GLEngine, the ol' gal. More...
 
class  IOManager
 
struct  Line
 
class  Logger
 For general purpose logging, this is the logger! It is a singleton class. More...
 
class  LuaContextManager
 
class  LuaScript
 
class  LuaScriptContextWrapper
 
class  LuaScriptEngine
 
class  LuaScriptQueue
 
struct  Music
 
class  MutableTexture
 A child of Texture which allows (and gives helpful functions for) mutation. More...
 
class  ParticleEngine2D
 
class  Position
 Positional data. More...
 
struct  Rectangle
 
class  Renderer
 The renderer class holds some shader program, manages some VBO, some render batch(es), and allows customizable, simple rendering. More...
 
class  ResourceManager
 The resource manager manages resources. Groundbreaking news, I know. In short, the resource manager loads and manages Textures, Sounds, Scripts, Fonts, etc. More...
 
class  Screen
 This is meant to be a parent for other, app-specific, screen classes, which is essentially where all game mechanics will "happen", so to speak. This class decides what happens on updates, draws, when to go to different screens, etc. More...
 
class  ScreenList
 Holds and connects all of the screens used in the program in a list. Keeps track of the previous screen. Contains functions to move to the next or previous screens. More...
 
class  ShaderProgram
 The ShaderProgram is a GLSL program which combines two shaders - the vertex shader and the fragment shader - to allow rendering. Each renderer should have its own program. More...
 
struct  Sound
 
struct  Texture
 The texture struct holds very basic stuff - the filepath, width, height, and ID,. More...
 
class  TexturelessRenderer
 
class  Timer
 Not only does the timer keep track of the current time and delta-times, it can do all the "fancy" calculations for timestepping! Uses semi-fixed timestepping, as this engine isn't going to be used for advanced physics! More...
 
class  UV
 Holds two floats which can act as UV sizes or positions. More...
 
class  VAO
 A wrapper class for OpenGL's VAO, as well as its associated VBO and attributes. More...
 
class  Vertex
 Just holds vertex data for convenience. More...
 
class  Window
 It's a graphical window, holds the contexts for GL and SDL. More...
 
class  XMLData
 Holds all the very basic information for XML data. Designed to be a base class from which a user can derive custom data formats. To derive, please overload the default constructor and XMLData(std::string dataType, unsigned int ID) More...
 
class  XMLDataManager
 A singleton class that statically manages all XML data, including read and write operations. More...
 

Enumerations

enum  BAREError {
  BAREError::SDL_FAILURE, BAREError::GL_FAILURE_VERSION, BAREError::DOUBLE_INIT, BAREError::GLEW_FAILURE,
  BAREError::FILE_FAILURE, BAREError::TEXTURE_FAILURE, BAREError::VERTEX_SHADER_FAILURE, BAREError::FRAGMENT_SHADER_FAILURE,
  BAREError::UNIFORM_NOT_FOUND, BAREError::SHADER_COMPILE_FAILURE, BAREError::SHADER_LINK_FAILURE, BAREError::GLSL_PROGRAM_FAILURE,
  BAREError::FONT_FAILURE, BAREError::FBO_FAILURE, BAREError::LOGGER_FAILURE, BAREError::XML_FAILURE,
  BAREError::UNINITIALIZED_FUNCTION, BAREError::LUA_FAILURE, BAREError::SDL_MIXER_FLAC_FAILURE, BAREError::SDL_MIXER_OGG_FAILURE,
  BAREError::SDL_MIXER_MP3_FAILURE, BAREError::SDL_MIXER_MOD_FAILURE, BAREError::SDL_MIXER_CLOSE_FAILURE, BAREError::SDL_MIXER_LOAD_FAILURE,
  BAREError::SDL_MIXER_SOUND_FAILURE, BAREError::NULL_PTR_ACCESS, BAREError::OTHER_ERROR, BAREError::CACHE_FAILURE
}
 Represents a specific type of error that has occured. More...
 
enum  GLErrorSeverity {
  GLErrorSeverity::NOTIF, GLErrorSeverity::LOW, GLErrorSeverity::MED, GLErrorSeverity::HIGH,
  GLErrorSeverity::UNKNOWN
}
 
enum  Justification { Justification::RIGHT, Justification::MIDDLE, Justification::LEFT }
 
enum  ScreenState { ScreenState::RUNNING, ScreenState::CHANGE_NEXT, ScreenState::CHANGE_PREV, ScreenState::EXIT_APPLICATION }
 
enum  AttributeType {
  AttributeType::STRING, AttributeType::UNSIGNED_INT, AttributeType::VECTOR_UNSIGNED_INT, AttributeType::INT,
  AttributeType::FLOAT, AttributeType::VECTOR_FLOAT, AttributeType::BOOL, AttributeType::VECTOR_BOOL,
  AttributeType::VEC2, AttributeType::VECTOR_VEC2, AttributeType::SCRIPT, AttributeType::TEXTURE
}
 

Functions

void init ()
 Inits the required systems used by BARE2D. More...
 
CEGUI::Key::Scan SDLKeyToCEGUIKey (SDL_Keycode key)
 
CEGUI::MouseButton SDLButtonToCEGUIButton (Uint8 sdlButton)
 
std::string getErrString (BAREError err)
 Returns the string representing/explaining the error that occurred. More...
 
void throwFatalError (BAREError err, std::string message="")
 Throws an error (fatal). Also calls displayErrors and exits the program. More...
 
void throwError (BAREError err, std::string message="")
 Throws an error silently. Adds it to the pile. More...
 
void displayErrors ()
 Displays the latest thrown errors (really just all the thrown errors) in the console. More...
 
void initGLErrorCallback (GLErrorSeverity minSeverity=GLErrorSeverity::NOTIF)
 Initializes the GL Debug Message Callback function, and enables debug output straight from OpenGL. More...
 
template<>
void ShaderProgram::setUniform< glm::vec2 > (const std::string uniform, glm::vec2 *data, unsigned int num)
 
template<>
void ShaderProgram::setUniform< glm::vec3 > (const std::string uniform, glm::vec3 *data, unsigned int num)
 
template<>
void ShaderProgram::setUniform< glm::vec4 > (const std::string uniform, glm::vec4 *data, unsigned int num)
 
template<>
void ShaderProgram::setUniform< glm::ivec2 > (const std::string uniform, glm::ivec2 *data, unsigned int num)
 
template<>
void ShaderProgram::setUniform< glm::ivec3 > (const std::string uniform, glm::ivec3 *data, unsigned int num)
 
template<>
void ShaderProgram::setUniform< glm::ivec4 > (const std::string uniform, glm::ivec4 *data, unsigned int num)
 
template<>
void ShaderProgram::setUniformMatrix< glm::mat4 > (const std::string uniform, bool transpose, glm::mat4 *data, unsigned int num)
 
int decodePNG (std::vector< unsigned char > &out_image, unsigned long &image_width, unsigned long &image_height, const unsigned char *in_png, std::size_t in_size, bool convert_to_rgba32)
 
int decodePNG (std::vector< unsigned char > &out_image, unsigned long &image_width, unsigned long &image_height, const unsigned char *in_png, size_t in_size, bool convert_to_rgba32=true)
 Loads a PNG from a file. That's... All I've got. More...
 

Variables

GLErrorSeverity GLErrorMinSeverity = GLErrorSeverity::LOW
 
std::vector< BAREErrorthrownErrors
 

Enumeration Type Documentation

◆ AttributeType

enum BARE2D::AttributeType
strong
Enumerator
STRING 
UNSIGNED_INT 
VECTOR_UNSIGNED_INT 
INT 
FLOAT 
VECTOR_FLOAT 
BOOL 
VECTOR_BOOL 
VEC2 
VECTOR_VEC2 
SCRIPT 
TEXTURE 

Definition at line 10 of file XMLDataTypes.hpp.

◆ BAREError

enum BARE2D::BAREError
strong

Represents a specific type of error that has occured.

Enumerator
SDL_FAILURE 
GL_FAILURE_VERSION 
DOUBLE_INIT 
GLEW_FAILURE 
FILE_FAILURE 
TEXTURE_FAILURE 
VERTEX_SHADER_FAILURE 
FRAGMENT_SHADER_FAILURE 
UNIFORM_NOT_FOUND 
SHADER_COMPILE_FAILURE 
SHADER_LINK_FAILURE 
GLSL_PROGRAM_FAILURE 
FONT_FAILURE 
FBO_FAILURE 
LOGGER_FAILURE 
XML_FAILURE 
UNINITIALIZED_FUNCTION 
LUA_FAILURE 
SDL_MIXER_FLAC_FAILURE 
SDL_MIXER_OGG_FAILURE 
SDL_MIXER_MP3_FAILURE 
SDL_MIXER_MOD_FAILURE 
SDL_MIXER_CLOSE_FAILURE 
SDL_MIXER_LOAD_FAILURE 
SDL_MIXER_SOUND_FAILURE 
NULL_PTR_ACCESS 
OTHER_ERROR 
CACHE_FAILURE 

Definition at line 18 of file BAREErrors.hpp.

◆ GLErrorSeverity

Enumerator
NOTIF 
LOW 
MED 
HIGH 
UNKNOWN 

Definition at line 49 of file BAREErrors.hpp.

◆ Justification

enum BARE2D::Justification
strong
Enumerator
RIGHT 
MIDDLE 
LEFT 

Definition at line 12 of file FontRenderer.hpp.

◆ ScreenState

enum BARE2D::ScreenState
strong
Enumerator
RUNNING 
CHANGE_NEXT 
CHANGE_PREV 
EXIT_APPLICATION 

Definition at line 5 of file Screen.hpp.

Function Documentation

◆ decodePNG() [1/2]

int BARE2D::decodePNG ( std::vector< unsigned char > &  out_image,
unsigned long &  image_width,
unsigned long &  image_height,
const unsigned char *  in_png,
size_t  in_size,
bool  convert_to_rgba32 = true 
)

Loads a PNG from a file. That's... All I've got.

Parameters
out_imageoutput parameter, this will contain the raw pixels after decoding. By default the output is 32-bit RGBA color. The std::vector is automatically resized to the correct size.
image_widthoutput_parameter, this will contain the width of the image in pixels.
image_heightoutput_parameter, this will contain the height of the image in pixels.
in_pngpointer to the buffer of the PNG file in memory. To get it from a file on disk, load it and store it in a memory buffer yourself first.
in_sizesize of the input PNG file in bytes.
convert_to_rgba32optional parameter, true by default. Set to true to get the output in RGBA 32-bit (8 bit per channel) color format no matter what color type the original PNG image had. This gives predictable, useable data from any random input PNG. Set to false to do no color conversion at all. The result then has the same data type as the PNG image, which can range from 1 bit to 64 bits per pixel. Information about the color type or palette colors are not provided. You need to know this information yourself to be able to use the data so this only works for trusted PNG files. Use LodePNG instead of picoPNG if you need this information.
Returns
0 if success, not 0 if some error occured.

◆ decodePNG() [2/2]

int BARE2D::decodePNG ( std::vector< unsigned char > &  out_image,
unsigned long &  image_width,
unsigned long &  image_height,
const unsigned char *  in_png,
std::size_t  in_size,
bool  convert_to_rgba32 
)

Definition at line 28 of file PicoPNG.cpp.

Referenced by BARE2D::ResourceManager::loadTexture().

+ Here is the caller graph for this function:

◆ displayErrors()

void BARE2D::displayErrors ( )

Displays the latest thrown errors (really just all the thrown errors) in the console.

Definition at line 201 of file BAREErrors.cpp.

References getErrString(), and thrownErrors.

Referenced by throwFatalError().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getErrString()

std::string BARE2D::getErrString ( BAREError  err)

Returns the string representing/explaining the error that occurred.

Parameters
errThe error enum, which a function returns.
Returns
The representative string.

Definition at line 134 of file BAREErrors.cpp.

References DOUBLE_INIT, FBO_FAILURE, FONT_FAILURE, FRAGMENT_SHADER_FAILURE, GL_FAILURE_VERSION, GLEW_FAILURE, GLSL_PROGRAM_FAILURE, LOGGER_FAILURE, LUA_FAILURE, NULL_PTR_ACCESS, SDL_FAILURE, SHADER_COMPILE_FAILURE, SHADER_LINK_FAILURE, TEXTURE_FAILURE, UNIFORM_NOT_FOUND, UNINITIALIZED_FUNCTION, VERTEX_SHADER_FAILURE, and XML_FAILURE.

Referenced by displayErrors(), and throwError().

+ Here is the caller graph for this function:

◆ init()

void BARE2D::init ( )

Inits the required systems used by BARE2D.

Returns
Returns a zero if everything's okay, otherwise returns a BAREError enum. Get actual error output from BAREErrors.

Definition at line 10 of file BARE2DEngine.cpp.

References SDL_FAILURE, and throwFatalError().

Referenced by BARE2D::App::init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initGLErrorCallback()

void BARE2D::initGLErrorCallback ( GLErrorSeverity  minSeverity)

Initializes the GL Debug Message Callback function, and enables debug output straight from OpenGL.

Definition at line 211 of file BAREErrors.cpp.

References GLErrorMinSeverity, and MessageCallback().

Referenced by BARE2D::App::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SDLButtonToCEGUIButton()

CEGUI::MouseButton BARE2D::SDLButtonToCEGUIButton ( Uint8  sdlButton)

Definition at line 477 of file BARECEGUI.cpp.

Referenced by BARE2D::BARECEGUI::handleSDLEvent().

+ Here is the caller graph for this function:

◆ SDLKeyToCEGUIKey()

CEGUI::Key::Scan BARE2D::SDLKeyToCEGUIKey ( SDL_Keycode  key)

Definition at line 283 of file BARECEGUI.cpp.

Referenced by BARE2D::BARECEGUI::handleSDLEvent().

+ Here is the caller graph for this function:

◆ ShaderProgram::setUniform< glm::ivec2 >()

template<>
void BARE2D::ShaderProgram::setUniform< glm::ivec2 > ( const std::string  uniform,
glm::ivec2 *  data,
unsigned int  num 
)

Definition at line 297 of file ShaderProgram.cpp.

◆ ShaderProgram::setUniform< glm::ivec3 >()

template<>
void BARE2D::ShaderProgram::setUniform< glm::ivec3 > ( const std::string  uniform,
glm::ivec3 *  data,
unsigned int  num 
)

Definition at line 309 of file ShaderProgram.cpp.

◆ ShaderProgram::setUniform< glm::ivec4 >()

template<>
void BARE2D::ShaderProgram::setUniform< glm::ivec4 > ( const std::string  uniform,
glm::ivec4 *  data,
unsigned int  num 
)

Definition at line 321 of file ShaderProgram.cpp.

◆ ShaderProgram::setUniform< glm::vec2 >()

template<>
void BARE2D::ShaderProgram::setUniform< glm::vec2 > ( const std::string  uniform,
glm::vec2 *  data,
unsigned int  num 
)

Definition at line 261 of file ShaderProgram.cpp.

◆ ShaderProgram::setUniform< glm::vec3 >()

template<>
void BARE2D::ShaderProgram::setUniform< glm::vec3 > ( const std::string  uniform,
glm::vec3 *  data,
unsigned int  num 
)

Definition at line 273 of file ShaderProgram.cpp.

◆ ShaderProgram::setUniform< glm::vec4 >()

template<>
void BARE2D::ShaderProgram::setUniform< glm::vec4 > ( const std::string  uniform,
glm::vec4 *  data,
unsigned int  num 
)

Definition at line 285 of file ShaderProgram.cpp.

◆ ShaderProgram::setUniformMatrix< glm::mat4 >()

template<>
void BARE2D::ShaderProgram::setUniformMatrix< glm::mat4 > ( const std::string  uniform,
bool  transpose,
glm::mat4 *  data,
unsigned int  num 
)

Definition at line 334 of file ShaderProgram.cpp.

◆ throwError()

void BARE2D::throwError ( BAREError  err,
std::string  message = "" 
)

Throws an error silently. Adds it to the pile.

Parameters
errThe error to throw.
message(Optional) The message to display along with the error.

Definition at line 190 of file BAREErrors.cpp.

References getErrString(), and thrownErrors.

Referenced by BARE2D::XMLDataManager::addData(), BARE2D::LuaScriptContextWrapper::createThread(), BARE2D::AudioManager::destroy(), BARE2D::ShaderProgram::getUniformLocation(), BARE2D::AudioManager::init(), BARE2D::LuaScriptContextWrapper::loadLua(), BARE2D::XMLData::read(), BARE2D::LuaScriptEngine::registerModule(), BARE2D::LuaContextManager::removeContext(), BARE2D::LuaScriptContextWrapper::start(), throwFatalError(), and BARE2D::LuaScriptContextWrapper::update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ throwFatalError()

void BARE2D::throwFatalError ( BAREError  err,
std::string  message = "" 
)

Variable Documentation

◆ GLErrorMinSeverity

GLErrorSeverity BARE2D::GLErrorMinSeverity = GLErrorSeverity::LOW

Definition at line 130 of file BAREErrors.cpp.

Referenced by initGLErrorCallback(), and MessageCallback().

◆ thrownErrors

std::vector< BAREError > BARE2D::thrownErrors

Definition at line 132 of file BAREErrors.cpp.

Referenced by displayErrors(), and throwError().