Game Develop Core: gd::InitialInstance 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 | Public Attributes | List of all members
gd::InitialInstance Class Reference

Represents an instance of an object to be created on a layout start up. More...

`#include <InitialInstance.h>`

## Public Member Functions

| InitialInstance ()
| Create an initial instance pointing to no object, at position (0,0).
InitialInstance * | Clone () const
Common properties
Members functions related to common properties
const std::string & | GetObjectName () const
| Get the name of object instantiated on the layout.
void | SetObjectName (const std::string &name)
| Set the name of object instantiated on the layout.
float | GetX () const
| Get the X position of the instance.
void | SetX (float x_)
| Set the X position of the instance.
float | GetY () const
| Get the Y position of the instance.
void | SetY (float y_)
| Set the Y position of the instance.
float | GetAngle () const
| Get the rotation of the instance, in radians.
void | SetAngle (float angle_)
| Set the rotation of the instance, in radians.
int | GetZOrder () const
| Get the Z order of the instance.
void | SetZOrder (int zOrder_)
| Set the Z order of the instance.
const std::string & | GetLayer () const
| Get the layer the instance belongs to.
void | SetLayer (const std::string &layer_)
| Set the layer the instance belongs to.
bool | HasCustomSize () const
| Return true if the instance has a size which is different from its object default size. More...
void | SetHasCustomSize (bool hasCustomSize_)
| Set whether the instance has a size which is different from its object default size or not. More...
float | GetCustomWidth () const
void | SetCustomWidth (float width_)
float | GetCustomHeight () const
void | SetCustomHeight (float height_)
bool | IsLocked () const
| Return true if the instance is locked and cannot be selected by clicking on it in the IDE.
void | SetLocked (bool enable=true)
| (Un)lock the initial instance. More...
Variable management
Members functions related to initial instance variables management.
const gd::VariablesContainer & | GetVariables () const
gd::VariablesContainer & | GetVariables ()
Others properties management

Members functions related to exposing others properties of the instance.

Note
  Extensions writers: Even if we can define new types of object by inheriting from gd::Object class, we cannot define new gd::InitialInstance classes. However, objects can store custom properties for their associated initial instances : These properties can be stored into floatInfos and stringInfos members. When the IDE want to get the custom properties, it will call GetProperties and UpdateProperty methods. These methods are here defined to forward the call to the gd::Object associated to the gd::InitialInstance. ( By looking at the value returned by GetObjectName() ).

See Also
  gd::Object

std::map< std::string, gd::PropgridPropertyDescriptor > | GetCustomProperties (gd::Project &project, gd::Layout &layout)
| Return a map containing the properties names (as keys) and their values. More...
bool | UpdateCustomProperty (const std::string &name, const std::string &value, gd::Project &project, gd::Layout &layout)
| Update the property called name with the new value. More...

## Public Attributes

std::map< std::string, float > | floatInfos
| More data which can be used by the object.
std::map< std::string, std::string > | stringInfos
| More data which can be used by the object.

## Detailed Description

Represents an instance of an object to be created on a layout start up.

## Member Function Documentation

InitialInstance* gd::InitialInstance::Clone | ( | ) |  | const

inline

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 MyInitialInstanceClass(*this);

std::map< std::string, gd::PropgridPropertyDescriptor > gd::InitialInstance::GetCustomProperties | ( | gd::Project & | project,
|  | gd::Layout & | layout
| ) |  |

Return a map containing the properties names (as keys) and their values.

Note
  Common properties ( name, position... ) do not need to be inserted in this map

const gd::VariablesContainer& gd::InitialInstance::GetVariables | ( | ) |  | const

inline

Must return a reference to the container storing the instance variables

See Also
  gd::VariablesContainer

gd::VariablesContainer& gd::InitialInstance::GetVariables | ( | ) |  |

inline

Must return a reference to the container storing the instance variables

See Also
  gd::VariablesContainer

bool gd::InitialInstance::HasCustomSize | ( | ) |  | const

inline

Return true if the instance has a size which is different from its object default size.

See Also
  gd::Object

void gd::InitialInstance::SetHasCustomSize | ( | bool | hasCustomSize_) |  |

inline

Set whether the instance has a size which is different from its object default size or not.

Parameters

  hasCustomSize | true if the size is different from the object's default size.

See Also
  gd::Object

void gd::InitialInstance::SetLocked | ( | bool | enable = `true`) |  |

inline

(Un)lock the initial instance.

An instance which is locked cannot be selected by clicking on it in a layout editor canvas.

bool gd::InitialInstance::UpdateCustomProperty | ( | const std::string & | name,
|  | const std::string & | value,
|  | gd::Project & | project,
|  | gd::Layout & | layout
| ) |  |

Update the property called name with the new value.

Returns
  false if the property could not be updated.

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

- InitialInstance.h
- InitialInstance.cpp