- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 0
Actors
        Imagment edited this page Mar 27, 2025 
        ·
        2 revisions
      
    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.
| 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 | 
| 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 | 
| Function Name | Description | 
|---|---|
| T* AddComponent() | Adds a new component of type Tto 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 Tfrom the actor. TheTransformcomponent cannot be removed. Returnstrueif successful,falseotherwise. | 
| T* GetComponent() | Retrieves a component of type Tfrom the actor. Returnsnullptrif 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 nullptrif 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. |