LPCGame
A Simple 2d Game Engine
Main Page
Related Pages
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Enumerations
Enumerator
Pages
entity.h
1
#ifndef ENTITY_H
2
#define ENTITY_H
3
4
#include <string>
5
#include <memory>
6
#include "external/json/json.h"
7
#include "base.h"
8
#include "physics.h"
9
#include "map.h"
10
#include "image.h"
11
#include "luascript.h"
12
14
18
class
Entity
{
19
public
:
20
Entity
();
25
Entity
(std::string file);
26
virtual
~
Entity
();
33
virtual
void
Init
(std::shared_ptr<Entity>
self
=
nullptr
);
34
//Free the object's memory
35
virtual
void
Free();
37
virtual
void
Update
();
42
virtual
void
Move
(
float
deltaT);
47
virtual
void
Draw
(std::weak_ptr<Camera> camera);
49
virtual
void
OnMouseDown
();
51
virtual
void
OnMouseUp
();
56
virtual
void
OnClick
();
58
virtual
void
OnMouseEnter
();
60
virtual
void
OnMouseExit
();
66
virtual
void
CheckMouseOver
(
const
Vector2f
&pos);
68
bool
GetMouseOver
()
const
;
74
Physics
*
GetPhysics
();
80
std::weak_ptr<Physics>
GetPhysicsWeakPtr
();
85
void
SetCollisionMap
(CollisionMap map);
87
Rectf
Box
()
const
;
89
void
SetTag
(std::string tag);
91
std::string
Tag
()
const
;
92
//Get and set Name
93
void
SetName(std::string name);
94
std::string Name()
const
;
96
void
Render
(
bool
b);
98
bool
Render
()
const
;
100
void
IsUiElement
(
bool
b);
102
bool
IsUiElement
()
const
;
104
LuaScript
*
Script
();
111
virtual
Json::Value
Save
()
const
;
116
virtual
void
Save
(
const
std::string &file)
const
;
123
virtual
void
Load
(
Json::Value
val);
130
virtual
void
Load
(
const
std::string &file,
Json::Value
overrides =
Json::Value
());
131
132
private
:
134
Entity
(
const
Entity
&a);
135
Entity
& operator = (
const
Entity
&a);
136
137
protected
:
140
//I'm not sure if i agree with this idea anymore....
141
Image
mImage
;
143
std::shared_ptr<Physics>
mPhysics
;
145
std::string
mTag
;
147
std::string
mName
;
148
//The entity's file name
149
std::string mConfigFile;
151
bool
mMouseOver
, mClicked;
153
bool
mRender
, mUiElement;
155
LuaScript
mScript
;
156
};
157
158
#endif
Users
Will
Documents
Programs
LPCGame
src
core
entity.h
Generated on Tue Jan 29 2013 18:58:09 for LPCGame by
1.8.2