Module
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Module::GraphicsInterface Class Referenceabstract

#include <GraphicsInterface.hpp>

Inheritance diagram for Module::GraphicsInterface:
Module::ThreadObject

Public Member Functions

 GraphicsInterface ()
 
 GraphicsInterface (unsigned int set_fps)
 
virtual MeshcreateMesh (Vector3 *vertices, Vector3 *normals, unsigned int num_vertices, const std::string &name)
 
virtual MeshcreateMesh (const std::vector< Vector3 > &vertices, const std::vector< Vector3 > &normals, const std::string &name)
 
virtual MeshloadMeshFromFile (const std::string &meshname, const std::string &filename, bool flipFaces=false)=0
 
virtual void setCamera (GameObject *obj)
 
void addGraphicsCallback (GraphicsCallback *g)
 
void addInputCallback (InputCallback *g)
 

Protected Member Functions

void start ()
 
void run ()
 
void preRender ()
 
void postRender ()
 
void mousePressed (uint8_t button, uint16_t x, uint16_t y)
 
void mouseReleased (uint8_t button, uint16_t x, uint16_t y)
 
void mouseMoved (uint16_t x, uint16_t y, int16_t dx, int16_t dy)
 
void keyPressed (KeyCode::Code code, char keyChar)
 
void keyReleased (KeyCode::Code code, char keyChar)
 
virtual void createWindow ()=0
 
virtual void renderFrame ()=0
 
virtual void swapBuffers ()=0
 
virtual unsigned long getMilliseconds ()=0
 
virtual bool isRunning ()=0
 
virtual void drawPolygons2D (const PolygonContainer &polygons)=0
 
Book< float > * getVertexBook (Mesh *m) const
 
Book< float > * getNormalBook (Mesh *m) const
 
unsigned int getVertexIndex (Mesh *m) const
 
unsigned int getNormalIndex (Mesh *m) const
 
unsigned int getNumVertices (Mesh *m) const
 

Protected Attributes

unsigned int fps
 
ModuleGamegame
 
GameObjectcamera
 
Book< float > allVertices
 
Book< float > allNormals
 
Book< MeshallMeshes
 
std::vector< GraphicsCallback * > graphicsCallbacks
 
std::vector< InputCallback * > inputCallbacks
 

Friends

class ModuleGame
 
class GraphicsContext
 

Detailed Description

The GraphicsInterface is one of Module's four core interfaces. It manages rendering and user input. Implementations of the GraphicsInterface are responsible for drawing the world and triggering the attached graphics and input callbacks.

Constructor & Destructor Documentation

GraphicsInterface::GraphicsInterface ( )
GraphicsInterface::GraphicsInterface ( unsigned int  set_fps)

Member Function Documentation

void GraphicsInterface::addGraphicsCallback ( GraphicsCallback g)
void GraphicsInterface::addInputCallback ( InputCallback g)
Mesh * GraphicsInterface::createMesh ( Vector3 vertices,
Vector3 normals,
unsigned int  num_vertices,
const std::string &  name 
)
virtual
Mesh * GraphicsInterface::createMesh ( const std::vector< Vector3 > &  vertices,
const std::vector< Vector3 > &  normals,
const std::string &  name 
)
virtual
virtual void Module::GraphicsInterface::createWindow ( )
protectedpure virtual
virtual void Module::GraphicsInterface::drawPolygons2D ( const PolygonContainer polygons)
protectedpure virtual
virtual unsigned long Module::GraphicsInterface::getMilliseconds ( )
protectedpure virtual
Book< float > * Module::GraphicsInterface::getNormalBook ( Mesh m) const
inlineprotected
unsigned int Module::GraphicsInterface::getNormalIndex ( Mesh m) const
inlineprotected
unsigned int Module::GraphicsInterface::getNumVertices ( Mesh m) const
inlineprotected
Book< float > * Module::GraphicsInterface::getVertexBook ( Mesh m) const
inlineprotected
unsigned int Module::GraphicsInterface::getVertexIndex ( Mesh m) const
inlineprotected
virtual bool Module::GraphicsInterface::isRunning ( )
protectedpure virtual
void GraphicsInterface::keyPressed ( KeyCode::Code  code,
char  keyChar 
)
protected
void GraphicsInterface::keyReleased ( KeyCode::Code  code,
char  keyChar 
)
protected
virtual Mesh* Module::GraphicsInterface::loadMeshFromFile ( const std::string &  meshname,
const std::string &  filename,
bool  flipFaces = false 
)
pure virtual
void GraphicsInterface::mouseMoved ( uint16_t  x,
uint16_t  y,
int16_t  dx,
int16_t  dy 
)
protected
void GraphicsInterface::mousePressed ( uint8_t  button,
uint16_t  x,
uint16_t  y 
)
protected
void GraphicsInterface::mouseReleased ( uint8_t  button,
uint16_t  x,
uint16_t  y 
)
protected
void GraphicsInterface::postRender ( )
protected
void GraphicsInterface::preRender ( )
protected
virtual void Module::GraphicsInterface::renderFrame ( )
protectedpure virtual
void GraphicsInterface::run ( )
protectedvirtual

Implements Module::ThreadObject.

virtual void Module::GraphicsInterface::setCamera ( GameObject obj)
inlinevirtual
void GraphicsInterface::start ( )
protected
virtual void Module::GraphicsInterface::swapBuffers ( )
protectedpure virtual

Friends And Related Function Documentation

friend class GraphicsContext
friend
friend class ModuleGame
friend

Member Data Documentation

Book<Mesh> Module::GraphicsInterface::allMeshes
protected
Book<float> Module::GraphicsInterface::allNormals
protected
Book<float> Module::GraphicsInterface::allVertices
protected
GameObject* Module::GraphicsInterface::camera
protected
unsigned int Module::GraphicsInterface::fps
protected
ModuleGame* Module::GraphicsInterface::game
protected
std::vector<GraphicsCallback*> Module::GraphicsInterface::graphicsCallbacks
protected
std::vector<InputCallback*> Module::GraphicsInterface::inputCallbacks
protected