Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Olympe::Blueprint::EntityBlueprint Struct Reference

#include <EntityBlueprint.h>

Public Member Functions

 EntityBlueprint ()=default
 
 EntityBlueprint (const std::string &n)
 
void AddComponent (const std::string &type, const json &properties)
 
ComponentDataGetComponent (const std::string &type)
 
const ComponentDataGetComponent (const std::string &type) const
 
bool HasComponent (const std::string &type) const
 
bool RemoveComponent (const std::string &type)
 
json ToJson () const
 
bool SaveToFile (const std::string &filepath) const
 

Static Public Member Functions

static EntityBlueprint FromJson (const json &j)
 
static EntityBlueprint LoadFromFile (const std::string &filepath)
 

Public Attributes

std::string name
 
std::string description
 
std::vector< ComponentDatacomponents
 

Detailed Description

Definition at line 31 of file EntityBlueprint.h.

Constructor & Destructor Documentation

◆ EntityBlueprint() [1/2]

Olympe::Blueprint::EntityBlueprint::EntityBlueprint ( )
default

Referenced by LoadFromFile().

+ Here is the caller graph for this function:

◆ EntityBlueprint() [2/2]

Olympe::Blueprint::EntityBlueprint::EntityBlueprint ( const std::string &  n)
inline

Definition at line 38 of file EntityBlueprint.h.

Member Function Documentation

◆ AddComponent()

void Olympe::Blueprint::EntityBlueprint::AddComponent ( const std::string &  type,
const json properties 
)

Definition at line 14 of file EntityBlueprint.cpp.

References components, and GetComponentTypeID_Static().

Referenced by TestCreateAndSaveBlueprint(), and TestLoadAndModifyBlueprint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FromJson()

EntityBlueprint Olympe::Blueprint::EntityBlueprint::FromJson ( const json j)
static

Definition at line 88 of file EntityBlueprint.cpp.

References JsonHelper::ForEachInArray(), GetComponentTypeID_Static(), JsonHelper::GetString(), JsonHelper::IsArray(), name, and Olympe::Blueprint::ComponentData::type.

Referenced by Olympe::BlueprintEditor::ApplyTemplate(), and LoadFromFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetComponent() [1/2]

ComponentData * Olympe::Blueprint::EntityBlueprint::GetComponent ( const std::string &  type)

Definition at line 30 of file EntityBlueprint.cpp.

References components, and GetComponentTypeID_Static().

Referenced by HasComponent(), and TestLoadAndModifyBlueprint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetComponent() [2/2]

const ComponentData * Olympe::Blueprint::EntityBlueprint::GetComponent ( const std::string &  type) const

Definition at line 40 of file EntityBlueprint.cpp.

References components, and GetComponentTypeID_Static().

+ Here is the call graph for this function:

◆ HasComponent()

bool Olympe::Blueprint::EntityBlueprint::HasComponent ( const std::string &  type) const

Definition at line 50 of file EntityBlueprint.cpp.

References GetComponent().

Referenced by TestLoadAndModifyBlueprint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoadFromFile()

EntityBlueprint Olympe::Blueprint::EntityBlueprint::LoadFromFile ( const std::string &  filepath)
static

Definition at line 117 of file EntityBlueprint.cpp.

References EntityBlueprint(), FromJson(), GetComponentTypeID_Static(), and JsonHelper::LoadJsonFromFile().

Referenced by Olympe::BlueprintEditor::LoadBlueprint(), TestCompleteBlueprint(), and TestLoadAndModifyBlueprint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveComponent()

bool Olympe::Blueprint::EntityBlueprint::RemoveComponent ( const std::string &  type)

Definition at line 55 of file EntityBlueprint.cpp.

References components, and GetComponentTypeID_Static().

+ Here is the call graph for this function:

◆ SaveToFile()

bool Olympe::Blueprint::EntityBlueprint::SaveToFile ( const std::string &  filepath) const

Definition at line 112 of file EntityBlueprint.cpp.

References JsonHelper::SaveJsonToFile(), and ToJson().

Referenced by Olympe::BlueprintEditor::SaveBlueprint(), Olympe::BlueprintEditor::SaveBlueprintAs(), TestCreateAndSaveBlueprint(), and TestLoadAndModifyBlueprint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ToJson()

json Olympe::Blueprint::EntityBlueprint::ToJson ( ) const

Definition at line 68 of file EntityBlueprint.cpp.

References components, description, GetComponentTypeID_Static(), and name.

Referenced by Olympe::BlueprintEditor::SaveCurrentAsTemplate(), SaveToFile(), and TestCreateAndSaveBlueprint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ components

std::vector<ComponentData> Olympe::Blueprint::EntityBlueprint::components

◆ description

std::string Olympe::Blueprint::EntityBlueprint::description

◆ name

std::string Olympe::Blueprint::EntityBlueprint::name

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