#include <BaseEngine.h>
Public Member Functions | |
BaseEngine (SDL_Renderer *renderer) | |
int | init (int screen_width, int screen_height, int framerate) |
SDL_Renderer * | getRenderer () |
virtual void | start () |
virtual void | stop () |
virtual void | render () |
virtual void | update ()=0 |
virtual void | preRender ()=0 |
virtual void | postRender ()=0 |
void | setRenderer (SDL_Renderer *renderer) |
void | addSprite (BaseSprite *sprite) |
void | addSprite (BaseSprite *sprite, int x, int y) |
void | drawLine (Vector2D v1, Vector2D v2) |
void | drawLine (Vector2D v1, Vector2D v2, SDL_Color col) |
int | getWidth () |
int | getHeight () |
void | setMap (Map *map) |
Map * | getMap () |
float | getLastFrameTime () |
void | setFrameRate (int framerate) |
int | getFrameRate () |
TileSet * | getTileSet () |
TTF_Font * | loadTTFFont (const char *filename, int size) |
TTF_Font * | getTTFFont (TTF_Font *ft, const char *filename, int size) |
void | render_text (SDL_Renderer *renderer, int x, int y, const char *text, TTF_Font *font, SDL_Color *color) |
void | render_text (int x, int y, const char *text, SDL_Color *color) |
void | left () |
void | right () |
void | up () |
void | down () |
Base Engine Library
This is just another Sprite Engine library written in c++.
It uses SDL2 for Rendering and is intended to be compatible with Emscripten. source code.
Games written with this library should be able be compiled to other languagges like Javascript via Emscripten(CLANG/LLVM)
link with 000_enginelib.a (Linux) link with 000_enginelib.dll (Windows) link with 000_enginelib.bc (Emscripten/Javascript/HTML)
BaseEngine::BaseEngine | ( | SDL_Renderer * | renderer | ) |
Construct BaseEngine with SDL Renderer
SDL_Renderer | renderer. |
void BaseEngine::addSprite | ( | BaseSprite * | sprite | ) |
Adds a Sprite to the BaseEngine
BaseSprite | sprite. |
void BaseEngine::addSprite | ( | BaseSprite * | sprite, |
int | x, | ||
int | y | ||
) |
Adds a Sprite at x y to the BaseEngine
BaseSprite | sprite. x Position x. y Position y. |
Draws a colored line from v1 to v2
BaseEngine::drawLine(Vector2D v1, Vector2D v2, SDL_Color col)
int BaseEngine::getFrameRate | ( | ) |
Sets the Framerate per s
int BaseEngine::getHeight | ( | ) |
Gets Screen Height
float BaseEngine::getLastFrameTime | ( | ) |
Gets time of last rendered frame
SDL_Renderer * BaseEngine::getRenderer | ( | ) |
Gets the current SDL_Renderer
TileSet* BaseEngine::getTileSet | ( | ) |
Gets the current Tileset
TTF_Font * BaseEngine::getTTFFont | ( | TTF_Font * | ft, |
const char * | filename, | ||
int | size | ||
) |
Returns a Font with specific Pointsize
TTF_Font | ft* |
char* | filename |
int | size |
int BaseEngine::getWidth | ( | ) |
Gets Screen Width
int BaseEngine::init | ( | int | screen_width, |
int | screen_height, | ||
int | framerate | ||
) |
Initialize BaseEngine to set Display and Framerate throughout the game
int | screen_width sets the width of Display. |
int | screen_height sets the height of Display. |
int | framerate set thes Framerate of the game. |
TTF_Font * BaseEngine::loadTTFFont | ( | const char * | filename, |
int | size | ||
) |
Loads a default Font with specific Pointsize for the Engine
char* | filename |
int | size |
|
pure virtual |
called after rendering Scene
|
pure virtual |
called before rendering Scene
|
virtual |
renders the current Scene
void BaseEngine::render_text | ( | SDL_Renderer * | renderer, |
int | x, | ||
int | y, | ||
const char * | text, | ||
TTF_Font * | font, | ||
SDL_Color * | color | ||
) |
Renders a Text with given Font and Color at Point x,y to Screen Returns a Font with specific Pointsize
SDL_Renderer* | renderer |
int | x |
int | y |
const | char* text |
TTF_Font* | font |
SDL_Color* | color |
void BaseEngine::render_text | ( | int | x, |
int | y, | ||
const char * | text, | ||
SDL_Color * | color | ||
) |
Renders a Text with default Font and Color at Point x,y to Screen Returns a Font with specific Pointsize
int | x |
int | y |
const | char* text |
SDL_Color* | color |
void BaseEngine::setFrameRate | ( | int | framerate | ) |
Sets the Framerate per s
int |
void BaseEngine::setRenderer | ( | SDL_Renderer * | renderer | ) |
Sets the current SDL_Renderer
SDL_Renderer | renderer. |
|
virtual |
Starts the BaseEngine
|
virtual |
Stops the BaseEngine
|
pure virtual |
updates the current Scene