Game Develop Core: gd::Object Class Reference

| Game Develop Core Core library for developing platforms and tools compatible with Game Develop.

- Main Page
- Modules
- Classes

- Class List
- Class Index
- Class Hierarchy

All Classes Files Functions Variables Typedefs Enumerations Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gd::Object Class Reference
Platform Definition ( Classes defining the common concepts used by all platforms )

Base class used to represent an object of a platform. More...

`#include <Object.h>`

## Public Member Functions

| Object (const std::string &name)
| Object (const gd::Object &object)
Object & | operator= (const gd::Object &object)
virtual | ~Object ()
virtual gd::Object * | Clone () const
Common properties
Members functions related to common properties
void | SetName (const std::string &name_)
| Change the name of the object with the name passed as parameter.
const std::string & | GetName () const
| Return the name of the object.
void | SetType (const std::string &type_)
| Change the type of the object.
const std::string & | GetType () const
| Return the type of the object.
Resources management
Members functions related to managing resources used by the object
virtual void | ExposeResources (gd::ArbitraryResourceWorker &worker)
| Called ( e.g. during compilation ) so as to inventory internal resources and sometimes update their filename. Implementation example: More...
virtual bool | SupportShaders ()
Drawing and editing initial instances
Members functions related to drawing and editing initial instances of this object
virtual std::map< std::string, gd::PropgridPropertyDescriptor > | GetInitialInstanceProperties (const gd::InitialInstance &instance, gd::Project &project, gd::Layout &layout)
| Called when the IDE wants to know about the custom properties of an initial instance of this object. More...
virtual bool | UpdateInitialInstanceProperty (gd::InitialInstance &instance, const std::string &name, const std::string &value, gd::Project &project, gd::Layout &layout)
| Called when the IDE wants to update a custom property of an initial instance of this object. More...
virtual void | DrawInitialInstance (gd::InitialInstance &instance, sf::RenderTarget &renderTarget, gd::Project &project, gd::Layout &layout)
| Called when the IDE wants to draw an initial instance of the object on the layout editor. More...
virtual void | LoadResources (gd::Project &project, gd::Layout &layout)
| Called by the IDE when a layout is going to be rendered. More...
virtual sf::Vector2f | GetInitialInstanceDefaultSize (gd::InitialInstance &instance, gd::Project &project, gd::Layout &layout) const
| Called when the IDE wants to know the default size an initial instance. More...
virtual sf::Vector2f | GetInitialInstanceOrigin (gd::InitialInstance &instance, gd::Project &project, gd::Layout &layout) const
| Called when the IDE wants to know the origin of an initial instance. ( Relative to the object ) More...
Others IDE related functions
Members functions related to generating thumbnails and other wxWidgets related tasks
virtual void | EditObject (wxWindow *parent, gd::Project &project, gd::MainFrameWrapper &mainFrameWrapper_)
| Called when user wants to edit the object.
virtual bool | GenerateThumbnail (const gd::Project &project, wxBitmap &thumbnail) const
| Must update thumbnail bitmap with a 24*24 bitmap. More...
Automatisms management
Members functions related to automatisms management.
std::vector< std::string > | GetAllAutomatismNames () const
| Return a vector containing the names of all the automatisms used by the object.
Automatism & | GetAutomatism (const std::string &name)
| Return a reference to the automatism called name.
const Automatism & | GetAutomatism (const std::string &name) const
| Return a reference to the automatism called name.
bool | HasAutomatismNamed (const std::string &name) const
| Return true if object has an automatism called name.
void | RemoveAutomatism (const std::string &name)
| Remove automatism called name.
bool | RenameAutomatism (const std::string &name, const std::string &newName)
| Change the name of automatism called name to newName. More...
gd::Automatism * | AddNewAutomatism (gd::Project &project, const std::string &type, const std::string &name)
| Add the automatism of the specified type with the specified name. More...
const std::map< std::string, gd::Automatism * > & | GetAllAutomatisms () const
| Get a read-only access to the map containing the automatisms.
Variable management
Members functions related to object variables management.
const gd::VariablesContainer & | GetVariables () const
| Provide access to the gd::VariablesContainer member containing the object variables.
gd::VariablesContainer & | GetVariables ()
| Provide access to the gd::VariablesContainer member containing the object variables.
Serialization
Members functions related to saving and loading the object
void | LoadFromXml (gd::Project &project, const TiXmlElement *elemScene)
| Load object from an xml element.
void | SaveToXml (TiXmlElement *elemScene)
| Save object to an xml element.

## Protected Member Functions

virtual void | DoLoadFromXml (gd::Project &project, const TiXmlElement *elemScene)
| Derived objects can redefine this method to load custom attributes.
virtual void | DoSaveToXml (TiXmlElement *elemScene)
| Derived objects can redefine this method to save custom attributes.
void | Init (const gd::Object &object)

## Protected Attributes

std::string | name
| The full name of the object.
std::string | type
| Which type is the object. ( To test if we can do something reserved to some objects with it )
std::map< std::string, gd::Automatism * > | automatisms
| Contains all automatisms of the object. Automatisms are the ownership of the object.
gd::VariablesContainer | objectVariables
| List of the variables of the object.

## Detailed Description

Base class used to represent an object of a platform.

## Constructor & Destructor Documentation

gd::Object::Object | ( | const std::string & | name) |  |

Create a new object with the name passed as argument.

Parameters

  name | Object's name

gd::Object::Object | ( | const gd::Object & | object) |  |

inline

Copy constructor. Calls Init().

gd::Object::~Object | ( | ) |  |

virtual

Destructor.

## Member Function Documentation

gd::Automatism * gd::Object::AddNewAutomatism | ( | gd::Project & | project,
|  | const std::string & | type,
|  | const std::string & | name
| ) |  |

Add the automatism of the specified type with the specified name.

The project's current platform is used to create the automatism.

Returns
  A pointer to the newly added automatism. NULL if the creation failed.

virtual gd::Object* gd::Object::Clone | ( | ) |  | const

inlinevirtual

Must return a pointer to a copy of the object. A such method is needed to do polymorphic copies. Just redefine this method in your derived object class like this:

return new MyObject(*this);

void gd::Object::DrawInitialInstance | ( | gd::InitialInstance & | instance,
|  | sf::RenderTarget & | renderTarget,
|  | gd::Project & | project,
|  | gd::Layout & | layout
| ) |  |

virtual

Called when the IDE wants to draw an initial instance of the object on the layout editor.

LoadResources method was called before so as to let the object load resources if necessary.

See Also
  gd::InitialInstance

virtual void gd::Object::ExposeResources | ( | gd::ArbitraryResourceWorker & | worker) |  |

inlinevirtual

Called ( e.g. during compilation ) so as to inventory internal resources and sometimes update their filename. Implementation example:

worker.ExposeImage(myImage);
worker.ExposeResource(myResourceFile);

See Also
  ArbitraryResourceWorker

virtual bool gd::Object::GenerateThumbnail | ( | const gd::Project & | project,
|  | wxBitmap & | thumbnail
| ) |  | const

inlinevirtual

Must update thumbnail bitmap with a 24*24 bitmap.

Returns
  true if thumbnail was successfully updated.

sf::Vector2f gd::Object::GetInitialInstanceDefaultSize | ( | gd::InitialInstance & | instance,
|  | gd::Project & | project,
|  | gd::Layout & | layout
| ) |  | const

virtual

Called when the IDE wants to know the default size an initial instance.

See Also
  gd::InitialInstance

sf::Vector2f gd::Object::GetInitialInstanceOrigin | ( | gd::InitialInstance & | instance,
|  | gd::Project & | project,
|  | gd::Layout & | layout
| ) |  | const

virtual

Called when the IDE wants to know the origin of an initial instance. ( Relative to the object )

The default implementation returns point (0;0) and it should be ok for most objects except for objects whose origin can be modified ( sprites for example )

See Also
  gd::InitialInstance

std::map< std::string, gd::PropgridPropertyDescriptor > gd::Object::GetInitialInstanceProperties | ( | const gd::InitialInstance & | instance,
|  | gd::Project & | project,
|  | gd::Layout & | layout
| ) |  |

virtual

Called when the IDE wants to know about the custom properties of an initial instance of this object.

Returns
  a std::map with properties names as key and values.

See Also
  gd::InitialInstance

void gd::Object::Init | ( | const gd::Object & | object) |  |

protected

Initialize object using another object. Used by copy-ctor and assign-op. Don't forget to update me if members were changed !

virtual void gd::Object::LoadResources | ( | gd::Project & | project,
|  | gd::Layout & | layout
| ) |  |

inlinevirtual

Called by the IDE when a layout is going to be rendered.

See Also
  gd::InitialInstance

Object& gd::Object::operator= | ( | const gd::Object & | object) |  |

inline

Assignment operator. Calls Init().

bool gd::Object::RenameAutomatism | ( | const std::string & | name,
|  | const std::string & | newName
| ) |  |

Change the name of automatism called name to newName.

Returns
  true if name was successfully changed

virtual bool gd::Object::SupportShaders | ( | ) |  |

inlinevirtual

Redefine this function to return true if your object can use shaders.

virtual bool gd::Object::UpdateInitialInstanceProperty | ( | gd::InitialInstance & | instance,
|  | const std::string & | name,
|  | const std::string & | value,
|  | gd::Project & | project,
|  | gd::Layout & | layout
| ) |  |

inlinevirtual

Called when the IDE wants to update a custom property of an initial instance of this object.

Returns
  false if the new value cannot be set

See Also
  gd::InitialInstance

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

- Object.h
- Object.cpp