Skip to content
Imagment edited this page Mar 27, 2025 · 2 revisions

Structures

Anyone can contribute to this wiki, so please feel free to correct any mistakes and add missing information! Silver C++ is a library for game development and anyone can use it and it is simple and easy to learn. It provides a variety of functions and components. Here, you will find information about the Silver C++ library.

Actor is an entity in a game, such as a player, enemy, NPC, or interactive object. And SPActor is a shorthand for std::shared_ptr, managing shared ownership of an Actor.

Public Variables

Variable Name Type Description
name std::string A string to store the name of the actor
intValues std::map<std::string, int> A map to store integer values about the actor with string keys
stringValues std::map<std::string, std::string> A map to store string values about the actor with string keys
tag std::string A string to store the tag of the actor

Private Variables

Variable Name Type Description
objectID int An integer representing the unique ID of the object
objectComponents std::vector<std::shared_ptr<Component>> A vector to store shared pointers to the components of the object
parent std::shared_ptr<Actor> A shared pointer to the parent actor (default is nullptr)
children std::vector<std::shared_ptr<Actor>> A vector of shared pointers to the child actors

Functions

Function Name Description
T* AddComponent() Adds a new component of type T to the actor. If a component of that type already exists, an error is logged.
T* AddComponent() (overloaded) Adds an already created shared pointer component to the actor. If a component of that type already exists, an error is logged.
bool RemoveComponent() Removes a component of type T from the actor. The Transform component cannot be removed. Returns true if successful, false otherwise.
T* GetComponent() Retrieves a component of type T from the actor. Returns nullptr if the component doesn't exist.
void SetParent() Sets the parent actor for this actor and automatically adds this actor as a child to the parent.
void AddChild() Adds a child actor to this actor.
std::shared_ptr<Actor> GetParent() Retrieves the parent actor of this actor. Returns nullptr if no parent is set.
const std::vector<std::shared_ptr<Actor>>& GetChildren() Retrieves the list of child actors of this actor.
void AddObject() Add an object to the Workspace.
void PlaceObject() Places a copy of the object into the workspace. The pointer is independent.
void PlaceObjectAt() Places a copy of the object into the workspace, after changing the location of the object. The pointer is independent.
void RemoveObject() Remove an object from the Workspace.
int GetInstanceID() Returns the unique object ID for this actor.

Overview

Cheatsheets

Structure of the engine

Silver Mathematics

Components

Clone this wiki locally