Documentation for C++/SDL 2.0 Tile Engine
Making a simple tile based engine
|
A base class for GameObjects to inherit from. More...
#include <gameobject.h>
Inherited by Button, Npc, Player, and TileBar.
Public Member Functions | |
virtual void | Update ()=0 |
Update the game object. | |
virtual void | Move (float deltaT)=0 |
virtual void | Draw (Camera *cam=nullptr)=0 |
virtual void | OnMouseDown () |
On mouse down events. | |
virtual void | OnMouseUp () |
On mouse up event. | |
virtual void | OnMouseEnter () |
On mouse enter. | |
virtual void | OnMouseExit () |
On mouse exit. | |
virtual void | CheckMouseOver (const Vector2f &pos) |
bool | GetMouseOver () |
Return T/F is the mouse is over the object. | |
bool | HasTag (std::string tag) |
virtual Json::Value | Save () |
virtual void | Load (Json::Value val) |
void | SetCollisionMap (CollisionMap map) |
Rectf | Box () |
Get the object's box. |
Protected Attributes | |
Image | mImage |
Physics | mPhysics |
Handle's the objects physics. | |
std::string | mTag |
To store tags to identify the object. |
A base class for GameObjects to inherit from.
Base class for gameobjects, has methods for intialization, updating setting colliison maps, mouse interaction, etc.
|
virtual |
Check if mouse entered the object's box Updates mMouseOver accordingly
pos | The mouse pos to check |
|
pure virtual |
bool GameObject::HasTag | ( | std::string | tag | ) |
Check if the gameobject has the tag
tag | The tag to check for |
|
virtual |
Load the gameobject from a Json::Value The GameObject instance of the function takes care of loading the base object members, physics, image and tags
val | The Json::Value to load from |
Reimplemented in ObjectButton< T >, Button, TileBar, Npc, and Player.
|
pure virtual |
|
virtual |
Save the gameobject data to a json value and return it The GameObject instance of the function takes care of saving the base object members, physics, image and tags
Reimplemented in Button, ObjectButton< T >, TileBar, Npc, and Player.
|
inline |
Set a collision map for the physics member to check against
map | The collision map |