LPCGame
A Simple 2d Game Engine
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
ObjectButton< T > Class Template Reference

A button that can register class member functions. More...

#include <objectbutton.h>

Inherits Button.

Public Member Functions

void RegisterCallBack (T *obj, void(T::*func)(std::string), std::string param)
 
void OnClick ()
 Run the registered callback function.
 
Json::Value Save () const
 
void Load (Json::Value val)
 
- Public Member Functions inherited from Button
 Button (std::string script)
 
void Draw (std::weak_ptr< Camera > camera)
 
void RegisterCallBack (void(*f)(std::string), std::string param)
 
virtual Json::Value Save ()
 
- Public Member Functions inherited from Entity
 Entity (std::string file)
 
virtual void Init (std::shared_ptr< Entity > self=nullptr)
 
virtual void Free ()
 
virtual void Update ()
 Update the game object.
 
virtual void Move (float deltaT)
 
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 () const
 Return T/F is the mouse is over the object.
 
PhysicsGetPhysics ()
 
std::weak_ptr< PhysicsGetPhysicsWeakPtr ()
 
void SetCollisionMap (CollisionMap map)
 
Rectf Box () const
 Get the object's box.
 
void SetTag (std::string tag)
 Set the entity's tag.
 
std::string Tag () const
 Get the entity's tag.
 
void SetName (std::string name)
 
std::string Name () const
 
void Render (bool b)
 Set the Entity render flag.
 
bool Render () const
 Check if the Entity should be drawn.
 
void IsUiElement (bool b)
 Set the Entity "is ui element" flag.
 
bool IsUiElement () const
 Check if the Entity is a ui element.
 
LuaScriptScript ()
 Get a pointer to the Entity's LuaScript.
 
virtual void Save (const std::string &file) const
 
virtual void Load (const std::string &file, Json::Value overrides=Json::Value())
 

Additional Inherited Members

- Protected Attributes inherited from Button
Text mText
 
void(* mFunc )(std::string)
 The callback function pointer & its value.
 
std::string mParam
 

Detailed Description

template<class T>
class ObjectButton< T >

A button that can register class member functions.

A button that is able to register class member functions as its callback TODO: This class is being replaced by scripted entities

Member Function Documentation

template<class T >
void ObjectButton< T >::Load ( Json::Value  val)
inlinevirtual

Load the object from a Json::Value

See Also
GameObject::Load for loading of inherited members
Parameters
valThe Json::Value to load from

Reimplemented from Button.

template<class T >
void ObjectButton< T >::RegisterCallBack ( T *  obj,
void(T::*)(std::string)  func,
std::string  param 
)
inline

Register an object and the object function to call when the button is pressed

Parameters
objThe object context to call the function in
funcThe function on the object to call
paramThe parameter to pass to the function when calling it
template<class T >
Json::Value ObjectButton< T >::Save ( ) const
inlinevirtual

Save the object data to a json value and return it

See Also
GameObject::Save for saving of inherited members
Returns
The Json::Value containing the object data

Reimplemented from Entity.


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