Arch Game Engine  0.2
Classes | Public Member Functions | List of all members
Engine Class Reference

Class for declaring an engine, which does basic SDL commands like creating the window and renderer. More...

#include <engine.h>

Classes

struct  color
 

Public Member Functions

 ~Engine ()
 Decontructs renderer and window and then quits SDL.
 
void setGravity (double g)
 
void setFrameRate (int f)
 
double getGravity () const
 
SDL_Renderer * init (string s, const int &w, const int &h, int flag)
 Create a window with a given name, width, height, and anyother SDL_Window flags.
 
SDL_Renderer * init (string s, const int &w, const int &h, int flag, int it)
 Create a window with a given name, width, height, SDL_Window flags, and specified SDL_Init flags.
 
SDL_Renderer * init (string s, const int &w, const int &h, int flag, int x, int y)
 Create a window with a given name, width, height, SDL_Window flags, and specified x and y coordinate.
 
SDL_Renderer * init (string s, const int &w, const int &h, int flag, int x, int y, int it)
 Create a window with a given name, width, height, SDL_Window flags, specified x and y coordinate, and SDL_Init flags.
 
void setName (string s)
 Set window name.
 
void setPos (int x, int y)
 Set window position.
 
void setSize (int w, int y)
 Set window size.
 
SDL_Renderer * getRenderer ()
 Returns screen renderer.
 
SDL_Window * getWindow () const
 Returns screen window.
 
void setColor (Uint8 r, Uint8 g, Uint8 b)
 Sets SDL color.
 
void loopStart ()
 Call this at the beginning of a loop to initilaize the loop.
 
void render ()
 Call this at the end of the game loop to render.
 
void update ()
 Get fps. More...
 
void setBackground (Background b)
 Set background.
 
void setBackground (string filename)
 Set background with filename.
 
Background getBackground () const
 Get background.
 
void drawBackground ()
 Draw background.
 
void draw (Object obj)
 Draw an object on the screen.
 
void draw (vector< Object > objs)
 Draw a vector of Objects.
 
void draw (vector< vector< Object >> objs)
 
void draw (Object obj, int key)
 Draw an object with a pass key before/during splash.
 
void draw (Level lvl)
 Draw the level.
 
void draw (const char *text, int x, int y, int r, int g, int b)
 Write to the screen with a char, coordinates, color, ttf file.
 
void splash ()
 Calls splashscreen at the beginning of the game. This is automatically called unless deactivated.
 
void bypassSplash (int key)
 Deactives the splashscreen, requires key.
 
bool hasSplashed ()
 Check if the splashscreen has occured.
 
void debugMode (bool d)
 Active debugger with Boolean.
 
void loadFont (char *font_path)
 
void hideMouse ()
 
void showMouse ()
 
bool getRunning () const
 
void setRunning (bool r)
 
void setGLView (int a, int b, int c, int d, int e, int f, int g, int h, int i)
 
void setGLMode (bool m)
 
int getFPS () const
 
void loop ()
 
int getTicks ()
 
void delay (int time)
 
void enableTransparency ()
 
void setGamestate (int s)
 
int getGameState ()
 
void setSplashColor (int r, int g, int b)
 

Detailed Description

Class for declaring an engine, which does basic SDL commands like creating the window and renderer.

Definition at line 36 of file engine.h.

Member Function Documentation

void Engine::update ( )

Get fps.

Update loop time.

Definition at line 134 of file engine.cpp.

134  {
135  //simulationTime += 16;
136  //if(simulationTime < realTime) { fps = true; } else { fps = false; }
137  if(glMode) {
138  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
139  glMatrixMode( GL_MODELVIEW );
140  glLoadIdentity( );
141  gluLookAt(glView[0],glView[1],glView[2],glView[3],glView[4],glView[5],glView[6],glView[7],glView[8]);
142  }
143 }

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