Game Develop Core: gd::Project 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::Project Class Reference
Platform Definition ( Classes defining the common concepts used by all platforms )

Base class used to represent a project of a platform. More...

`#include <Project.h>`

Inheritance diagram for gd::Project:
[legend]

## Public Member Functions

| Project (const Project &)
Project & | operator= (const Project &rhs)
Common properties
Some properties for the project
void | SetName (const std::string &name_)
const std::string & | GetName () const
void | SetAuthor (const std::string &author_)
const std::string & | GetAuthor () const
void | SetProjectFile (const std::string &file)
const std::string & | GetProjectFile () const
void | SetLastCompilationDirectory (const std::string &dir)
const std::string & | GetLastCompilationDirectory () const
void | SetDefaultWidth (unsigned int width)
unsigned int | GetMainWindowDefaultWidth () const
void | SetDefaultHeight (unsigned int height)
unsigned int | GetMainWindowDefaultHeight () const
void | SetMaximumFPS (int maxFPS_)
int | GetMaximumFPS () const
void | SetMinimumFPS (unsigned int minFPS_)
unsigned int | GetMinimumFPS () const
bool | IsVerticalSynchronizationEnabledByDefault () const
void | SetVerticalSyncActivatedByDefault (bool enable)
const std::vector< std::string > & | GetUsedExtensions () const
std::vector< std::string > & | GetUsedExtensions ()
const std::vector< Platform * > & | GetUsedPlatforms () const
void | AddPlatform (Platform &platform)
bool | RemovePlatform (const std::string &platformName)
Platform & | GetCurrentPlatform () const
| Return a reference to the platform being currently used to edit the project.
void | SetCurrentPlatform (const std::string &platformName)
| Set the platform to be used to edit the project. More...
Factory method
Member functions used to create objects for the project
boost::shared_ptr< gd::Object > | CreateObject (const std::string &type, const std::string &name, const std::string &platformName="")
gd::Automatism * | CreateAutomatism (const std::string &type, const std::string &platformName="")
boost::shared_ptr < gd::AutomatismsSharedData > | CreateAutomatismSharedDatas (const std::string &type, const std::string &platformName="")
boost::shared_ptr< gd::BaseEvent > | CreateEvent (const std::string &type, const std::string &platformName="")
GUI property grid management
Members functions related to managing the wxWidgets property grid used to display the properties of the project.
void | PopulatePropertyGrid (wxPropertyGrid *grid)
void | UpdateFromPropertyGrid (wxPropertyGrid *grid)
void | OnSelectionInPropertyGrid (wxPropertyGrid *grid, wxPropertyGridEvent &event)
void | OnChangeInPropertyGrid (wxPropertyGrid *grid, wxPropertyGridEvent &event)
Layouts management
Members functions related to layout management.
bool | HasLayoutNamed (const std::string &name) const
| Return true if layout called "name" exists.
Layout & | GetLayout (const std::string &name)
| Return a reference to the layout called "name".
const Layout & | GetLayout (const std::string &name) const
| Return a reference to the layout called "name".
Layout & | GetLayout (unsigned int index)
| Return a reference to the layout at position "index" in the layout list.
const Layout & | GetLayout (unsigned int index) const
| Return a reference to the layout at position "index" in the layout list.
unsigned int | GetLayoutPosition (const std::string &name) const
| Return the position of the layout called "name" in the layout list.
void | SwapLayouts (unsigned int first, unsigned int second)
| Swap the specified layouts. More...
unsigned int | GetLayoutCount () const
| Return the number of layouts.
gd::Layout & | InsertNewLayout (const std::string &name, unsigned int position)
| Must add a new empty layout called "name" at the specified position in the layout list.
void | InsertLayout (const Layout &layout, unsigned int position)
| Must add a new layout constructed from the layout passed as parameter. More...
void | RemoveLayout (const std::string &name)
Saving and loading
Members functions related to saving and loading the project.
bool | SaveToFile (const std::string &filename)
| Save the project to a file. More...
bool | LoadFromFile (const std::string &filename)
| Load the project from a file.
void | SaveToXml (TiXmlElement *element) const
void | LoadFromXml (const TiXmlElement *element)
bool | IsDirty ()
| Return true if the project is marked as being modified (The IDE or application using the project should ask for save the project if the project is closed).
void | SetDirty (bool enable=true)
| Mark the project as being modified (The IDE or application using the project should ask for save the project if the project is closed).
unsigned int | GetLastSaveGDMajorVersion ()
unsigned int | GetLastSaveGDMinorVersion ()
External events management
Members functions related to external events management.
bool | HasExternalEventsNamed (const std::string &name) const
ExternalEvents & | GetExternalEvents (const std::string &name)
const ExternalEvents & | GetExternalEvents (const std::string &name) const
ExternalEvents & | GetExternalEvents (unsigned int index)
const ExternalEvents & | GetExternalEvents (unsigned int index) const
unsigned int | GetExternalEventsPosition (const std::string &name) const
void | SwapExternalEvents (unsigned int first, unsigned int second)
| Swap the specified external events. More...
unsigned int | GetExternalEventsCount () const
ExternalEvents & | InsertNewExternalEvents (const std::string &name, unsigned int position)
void | InsertExternalEvents (const ExternalEvents &externalEvents, unsigned int position)
void | RemoveExternalEvents (const std::string &name)
External layout management
Members functions related to external layout management.
bool | HasExternalLayoutNamed (const std::string &name) const
ExternalLayout & | GetExternalLayout (const std::string &name)
const ExternalLayout & | GetExternalLayout (const std::string &name) const
ExternalLayout & | GetExternalLayout (unsigned int index)
const ExternalLayout & | GetExternalLayout (unsigned int index) const
unsigned int | GetExternalLayoutPosition (const std::string &name) const
void | SwapExternalLayouts (unsigned int first, unsigned int second)
| Swap the specified external layouts. More...
unsigned int | GetExternalLayoutsCount () const
gd::ExternalLayout & | InsertNewExternalLayout (const std::string &name, unsigned int position)
void | InsertExternalLayout (const ExternalLayout &externalLayout, unsigned int position)
void | RemoveExternalLayout (const std::string &name)
void | SetFirstLayout (const std::string &name)
const std::string & | GetFirstLayout ()
Global objects groups management
Members functions related to global objects groups management.
std::vector< ObjectGroup > & | GetObjectGroups ()
| Return a reference to the vector containing the project's objects groups.
const std::vector< ObjectGroup > & | GetObjectGroups () const
| Return a const reference to the vector containing the project's objects groups.
Resources management
Members functions related to resources management.
const ResourcesManager & | GetResourcesManager () const
| Provide access to the ResourceManager member containing the list of the resources.
ResourcesManager & | GetResourcesManager ()
| Provide access to the ResourceManager member containing the list of the resources.
const boost::shared_ptr < gd::ImageManager > & | GetImageManager () const
| Provide access to the ImageManager allowing to load SFML or OpenGL textures for the IDE ( or at runtime for the GD C++ Platform ).
boost::shared_ptr < gd::ImageManager > & | GetImageManager ()
| Provide access to the ImageManager allowing to load SFML or OpenGL textures for the IDE ( or at runtime for the GD C++ Platform ).
void | SetImageManager (boost::shared_ptr< gd::ImageManager > imageManager_)
| Provide access to the ImageManager allowing to load SFML or OpenGL textures for the IDE ( or at runtime for the GD C++ Platform ).
void | ExposeResources (gd::ArbitraryResourceWorker &worker)
| Called ( e.g. during compilation ) so as to inventory internal resources and sometimes update their filename. More...
Variable management
Members functions related to global variables management.
const gd::VariablesContainer & | GetVariables () const
gd::VariablesContainer & | GetVariables ()
Other
bool | ValidateObjectName (const std::string &objectName)
std::string | GetBadObjectNameWarning ()
Public Member Functions inherited from gd::ClassWithObjects
| ClassWithObjects ()
| Default constructor creating a container without any objects.
bool | HasObjectNamed (const std::string &name) const
| Return true if object called name exists.
Object & | GetObject (const std::string &name)
| Return a reference to the object called name.
const gd::Object & | GetObject (const std::string &name) const
| Return a reference to the object called name.
Object & | GetObject (unsigned int index)
| Return a reference to the object at position index in the objects list.
const gd::Object & | GetObject (unsigned int index) const
| Return a reference to the object at position index in the objects list.
unsigned int | GetObjectPosition (const std::string &name) const
| Return the position of the object called name in the objects list. More...
unsigned int | GetObjectsCount () const
| Return the number of object.
void | InsertNewObject (gd::Project &project, const std::string &objectType, const std::string &name, unsigned int position)
| Add a new empty object of type objectType called name at the specified position in the layout list. More...
void | InsertObject (const gd::Object &object, unsigned int position)
| Must add a new object constructed from the layout passed as parameter. More...
void | RemoveObject (const std::string &name)
| Delete an object. More...
void | SwapObjects (unsigned int firstObjectIndex, unsigned int secondObjectIndex)
| Swap the position of the specified objects.
std::vector< boost::shared_ptr < gd::Object > > & | GetObjects ()
const std::vector < boost::shared_ptr < gd::Object > > & | GetObjects () const
void | SaveObjectsToXml (TiXmlElement *element) const
| Save the objects to xml.
void | LoadObjectsFromXml (gd::Project &project, const TiXmlElement *element)
| Load the objects from xml.

## Public Attributes

bool | useExternalSourceFiles
| True if game used external source files.
std::vector< std::string > | imagesChanged
| Images that have been changed and which have to be reloaded.
std::string | winExecutableFilename
| Windows executable name.
std::string | winExecutableIconFile
| Icon for Windows executable.
std::string | linuxExecutableFilename
| Linux executable name.
std::string | macExecutableFilename
| Mac executable name.
std::vector< boost::shared_ptr < gd::SourceFile > > | externalSourceFiles
| List of C++ source files used.

## Additional Inherited Members

Protected Attributes inherited from gd::ClassWithObjects
std::vector< boost::shared_ptr < gd::Object > > | initialObjects
| Objects contained.

## Detailed Description

Base class used to represent a project of a platform.

## Member Function Documentation

void gd::Project::AddPlatform | ( | Platform & | platform) |  |

Add a platform to the project

gd::Automatism * gd::Project::CreateAutomatism | ( | const std::string & | type,
|  | const std::string & | platformName = `""`
| ) |  |

Create an automatism of the given type.

Note
  A project can use more than one platform. In this case, the first platform supporting the automatism is used, unless platformName argument is not empty.
  It is assumed that each platform provides an equivalent automatism.

Parameters

  project | The project for which the object must be created.
  type | The type of the automatism
  platformName | The name of the platform to be used. If empty, the first platform supporting the object is used.

boost::shared_ptr< gd::AutomatismsSharedData > gd::Project::CreateAutomatismSharedDatas | ( | const std::string & | type,
|  | const std::string & | platformName = `""`
| ) |  |

Create automatism shared data of the given type.

Note
  A project can use more than one platform. In this case, the first platform supporting the automatism shared data is used, unless platformName argument is not empty.
  It is assumed that each platform provides equivalent automatism shared data.

Parameters

  project | The project for which the object must be created.
  type | The type of automatism shared data
  platformName | The name of the platform to be used. If empty, the first platform supporting the object is used.

boost::shared_ptr< gd::BaseEvent > gd::Project::CreateEvent | ( | const std::string & | type,
|  | const std::string & | platformName = `""`
| ) |  |

Create an event of the given type.

Note
  A project can use more than one platform. In this case, the first platform supporting the automatism shared data is used, unless platformName argument is not empty.
  It is assumed that each platform provides equivalent events.

Parameters

  project | The project for which the object must be created.
  type | The type of automatism shared data
  platformName | The name of the platform to be used. If empty, the first platform supporting the object is used.

boost::shared_ptr< gd::Object > gd::Project::CreateObject | ( | const std::string & | type,
|  | const std::string & | name,
|  | const std::string & | platformName = `""`
| ) |  |

Create an object of the given type with the specified name.

Note
  A project can use more than one platform. In this case, the first platform supporting the object is used, unless platformName argument is not empty.
  It is assumed that each platform provides an equivalent object.

Parameters

  type | The type of the object
  name | The name of the object
  platformName | The name of the platform to be used. If empty, the first platform supporting the object is used.

void gd::Project::ExposeResources | ( | gd::ArbitraryResourceWorker & | worker) |  |

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

See Also
  ArbitraryResourceWorker

const std::string& gd::Project::GetAuthor | ( | ) |  | const

inline

Return the name of the project.

std::string gd::Project::GetBadObjectNameWarning | ( | ) |  |

Return a message that will be displayed when an invalid object name has been entered.

Note
  This message will be displayed by the IDE into a tooltip.

gd::ExternalEvents & gd::Project::GetExternalEvents | ( | const std::string & | name) |  |

Return a reference to the external events called "name".

const gd::ExternalEvents & gd::Project::GetExternalEvents | ( | const std::string & | name) |  | const

Return a reference to the external events called "name".

gd::ExternalEvents & gd::Project::GetExternalEvents | ( | unsigned int | index) |  |

Return a reference to the external events at position "index" in the external events list

const gd::ExternalEvents & gd::Project::GetExternalEvents | ( | unsigned int | index) |  | const

Return a reference to the external events at position "index" in the external events list

unsigned int gd::Project::GetExternalEventsCount | ( | ) |  | const

Return the number of external events.

unsigned int gd::Project::GetExternalEventsPosition | ( | const std::string & | name) |  | const

Return the position of the external events called "name" in the external events list

gd::ExternalLayout & gd::Project::GetExternalLayout | ( | const std::string & | name) |  |

Return a reference to the external layout called "name".

const gd::ExternalLayout & gd::Project::GetExternalLayout | ( | const std::string & | name) |  | const

Return a reference to the external layout called "name".

gd::ExternalLayout & gd::Project::GetExternalLayout | ( | unsigned int | index) |  |

Return a reference to the external layout at position "index" in the external layout list

const gd::ExternalLayout & gd::Project::GetExternalLayout | ( | unsigned int | index) |  | const

Return a reference to the external layout at position "index" in the external layout list

unsigned int gd::Project::GetExternalLayoutPosition | ( | const std::string & | name) |  | const

Return the position of the external layout called "name" in the external layout list

unsigned int gd::Project::GetExternalLayoutsCount | ( | ) |  | const

Return the number of external layout.

const std::string& gd::Project::GetFirstLayout | ( | ) |  |

inline

Get the first layout of the project.

const std::string& gd::Project::GetLastCompilationDirectory | ( | ) |  | const

inline

Return the latest directory used to compile the game

See Also
  gd::Project::SetLastCompilationDirectory

unsigned int gd::Project::GetLastSaveGDMajorVersion | ( | ) |  |

inline

Get the major version of Game Develop used to save the project.

unsigned int gd::Project::GetLastSaveGDMinorVersion | ( | ) |  |

inline

Get the minor version of Game Develop used to save the project.

unsigned int gd::Project::GetMainWindowDefaultHeight | ( | ) |  | const

inline

Return the default height of the project main window

unsigned int gd::Project::GetMainWindowDefaultWidth | ( | ) |  | const

inline

Get the default width of the project main window

int gd::Project::GetMaximumFPS | ( | ) |  | const

inline

Get the default number of maximum frame par seconds

unsigned int gd::Project::GetMinimumFPS | ( | ) |  | const

inline

Get the default number of minimum frame par seconds

const std::string& gd::Project::GetName | ( | ) |  | const

inline

Get project name

const std::string& gd::Project::GetProjectFile | ( | ) |  | const

inline

Return project file

See Also
  gd::Project::SetProjectFile

const std::vector< std::string >& gd::Project::GetUsedExtensions | ( | ) |  | const

inline

Return a reference to the vector containing the names of extensions used by the project.

std::vector< std::string >& gd::Project::GetUsedExtensions | ( | ) |  |

inline

Return a reference to the vector containing the names of extensions used by the project.

const std::vector< Platform* >& gd::Project::GetUsedPlatforms | ( | ) |  | const

inline

Return the list of platforms used by the project.

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

inline

Provide access to the gd::VariablesContainer member containing the global variables

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

inline

Provide access to the gd::VariablesContainer member containing the global variables

bool gd::Project::HasExternalEventsNamed | ( | const std::string & | name) |  | const

Return true if external events called "name" exists.

bool gd::Project::HasExternalLayoutNamed | ( | const std::string & | name) |  | const

Return true if external layout called "name" exists.

void gd::Project::InsertExternalEvents | ( | const ExternalEvents & | externalEvents,
|  | unsigned int | position
| ) |  |

Must add a new external events sheet constructed from the layout passed as parameter.

Note
  No pointer or reference must be kept on the external events passed as parameter.

Parameters

  externalEvents | The external events that must be copied and inserted into the project
  position | Insertion position. Even if the position is invalid, the external events must be inserted at the end of the external events list.

void gd::Project::InsertExternalLayout | ( | const ExternalLayout & | externalLayout,
|  | unsigned int | position
| ) |  |

Must add a new external layout constructed from the layout passed as parameter.

Note
  No pointer or reference must be kept on the external layout passed as parameter.

Parameters

  externalLayout | The external layout that must be copied and inserted into the project
  position | Insertion position. Even if the position is invalid, the external layout must be inserted at the end of the external layout list.

void gd::Project::InsertLayout | ( | const Layout & | layout,
|  | unsigned int | position
| ) |  |

Must add a new layout constructed from the layout passed as parameter.

Note
  No pointer or reference must be kept on the layout passed as parameter.

Parameters

  layout | The layout that must be copied and inserted into the project
  position | Insertion position. Even if the position is invalid, the layout must be inserted at the end of the layout list.

gd::ExternalEvents & gd::Project::InsertNewExternalEvents | ( | const std::string & | name,
|  | unsigned int | position
| ) |  |

Must add a new empty external events sheet called "name" at the specified position in the layout list.

gd::ExternalLayout & gd::Project::InsertNewExternalLayout | ( | const std::string & | name,
|  | unsigned int | position
| ) |  |

Must add a new empty external layout called "name" at the specified position in the layout list.

bool gd::Project::IsVerticalSynchronizationEnabledByDefault | ( | ) |  | const

inline

Return true if vertical synchronization is enabled by default.

void gd::Project::LoadFromXml | ( | const TiXmlElement * | element) |  |

Called to load the layout from a TiXmlElement.

void gd::Project::OnChangeInPropertyGrid | ( | wxPropertyGrid * | grid,
|  | wxPropertyGridEvent & | event
| ) |  |

IDE calls this function when a property was changed in the property grid.

void gd::Project::OnSelectionInPropertyGrid | ( | wxPropertyGrid * | grid,
|  | wxPropertyGridEvent & | event
| ) |  |

IDE calls this function when a property is selected in the property grid.

void gd::Project::PopulatePropertyGrid | ( | wxPropertyGrid * | grid) |  |

IDE calls this function so as to let the project populate a wxPropertyGrid with its properties.

void gd::Project::RemoveExternalEvents | ( | const std::string & | name) |  |

Must delete external events named "name".

void gd::Project::RemoveExternalLayout | ( | const std::string & | name) |  |

Must delete external layout named "name".

void gd::Project::RemoveLayout | ( | const std::string & | name) |  |

Must delete layout named "name".

bool gd::Project::RemovePlatform | ( | const std::string & | platformName) |  |

Remove a platform from the project.

Note
  The remove will fail if there is only one platform left.

Returns
  true if the platform was removed, false otherwise.

bool gd::Project::SaveToFile | ( | const std::string & | filename) |  |

Save the project to a file.

"Dirty" flag is set to false when save is done.

void gd::Project::SaveToXml | ( | TiXmlElement * | element) |  | const

Called to save the layout to a TiXmlElement.

"Dirty" flag is set to false when save is done.

void gd::Project::SetAuthor | ( | const std::string & | author_) |  |

inline

Must change the name of the project with the name passed as parameter.

void gd::Project::SetCurrentPlatform | ( | const std::string & | platformName) |  |

Set the platform to be used to edit the project.

Parameters

  platformName | The name of the new current platform. If not found, the current platform won't be changed.

void gd::Project::SetDefaultHeight | ( | unsigned int | height) |  |

inline

Change the default height of the project main window

void gd::Project::SetDefaultWidth | ( | unsigned int | width) |  |

inline

Change game's main window default width.

Note
  This is only the default width used when creating the main window for the first time. To change the width at runtime, use the functions related to RuntimeScene.renderWindow

void gd::Project::SetFirstLayout | ( | const std::string & | name) |  |

inline

Set the first layout of the project.

void gd::Project::SetLastCompilationDirectory | ( | const std::string & | dir) |  |

inline

Called when project file has changed.

void gd::Project::SetMaximumFPS | ( | int | maxFPS_) |  |

inline

Change the default maximum number of frames allowed to be rendered per seconds

void gd::Project::SetMinimumFPS | ( | unsigned int | minFPS_) |  |

inline

Change the default minimum number of frames allowed to be rendered per seconds

void gd::Project::SetName | ( | const std::string & | name_) |  |

inline

Change project name

void gd::Project::SetProjectFile | ( | const std::string & | file) |  |

inline

Called when project file has changed.

void gd::Project::SetVerticalSyncActivatedByDefault | ( | bool | enable) |  |

inline

Set if vertical synchronization is enabled by default.

void gd::Project::SwapExternalEvents | ( | unsigned int | first,
|  | unsigned int | second
| ) |  |

Swap the specified external events.

Do nothing if indexes are not correct.

void gd::Project::SwapExternalLayouts | ( | unsigned int | first,
|  | unsigned int | second
| ) |  |

Swap the specified external layouts.

Do nothing if indexes are not correct.

void gd::Project::SwapLayouts | ( | unsigned int | first,
|  | unsigned int | second
| ) |  |

Swap the specified layouts.

Do nothing if indexes are not correct.

void gd::Project::UpdateFromPropertyGrid | ( | wxPropertyGrid * | grid) |  |

IDE calls this function so that the project update its properties from the values stored in the wxPropertyGrid.

bool gd::Project::ValidateObjectName | ( | const std::string & | objectName) |  |

Return true if objectName can be used as name for an object.

Default implementation check if objectName is only composed of a-z,A-Z,0-9 or _ characters an if does not conflict with an expression.

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

- Project.h
- Project.cpp