40 std::list<GameObject>::iterator
DeleteObject(std::list<GameObject>::iterator it);
107 Scene(
const std::string& path);
165 void SetPath(
const std::string& path);
Defines the GameObject class and its related components.
Defines the Sprite class, which represents a game sprite.
Class representing a game object.
Definition GameObject.h:68
Represents a scene in the game.
Definition Scene.h:9
static Scene & CreateNew(const std::string &path)
Creates a new scene and pushes it to a container.
Definition Scene.cpp:279
std::list< GameObject > sceneObjs
Definition Scene.h:14
void SortScene()
Deprecated. Sorts the scene objects container. This method is no longer used as objects are kept sort...
Definition Scene.cpp:18
bool _shouldDelObj
Definition Scene.h:11
void Start()
Initializes the scene. This method should be called once before the update.
Definition Scene.cpp:216
~Scene()
Destroys the Scene object.
Definition Scene.cpp:208
void SetUp()
Sets up the needed static variables and other things.
Definition Scene.cpp:263
std::string name
Definition Scene.h:13
bool IsCurrent()
Checks if the scene is the current scene.
Definition Scene.cpp:203
void Draw()
Draws all the scene objects. This method is called within the default NWengine update.
Definition Scene.cpp:126
Scene(const std::string &path)
Constructs a Scene object with the given path.
Definition Scene.cpp:13
void Render(Sprite *sprite)
Adds a sprite to the draw list.
Definition Scene.cpp:31
static Scene * currentScene
Definition Scene.h:206
static Scene * GetScene(const std::string &path)
Gets a scene by its path. If multiple scenes have the same path, it returns one of them; order or det...
Definition Scene.cpp:284
GameObject & AddObject()
Adds a new empty GameObject to the scene objects container.
Definition Scene.cpp:83
void ForceRenderStop()
Iterates over the draw list and deletes sprites that are not rendered. If a sprite is not rendered,...
Definition Scene.cpp:59
void DeleteObject(uint32 index)
Deletes a GameObject from the scene objects container by index.
Definition Scene.cpp:97
void Update()
Updates the scene. This method should be called every frame. It is called within the default NWengine...
Definition Scene.cpp:224
static Scene * GetCurrent()
Gets the current scene.
Definition Scene.cpp:308
void Rearrange(Sprite *sprite)
Refinds a position to insert a sprite in the draw list. This method is called internally when the lay...
Definition Scene.cpp:20
GameObject * GetGameObject()
Gets the last object added to the scene.
Definition Scene.cpp:78
void DeleteCurrentObj()
This function is intended to be called within object (to-delete) component (like scripts),...
Definition Scene.cpp:114
void MakeCurrent()
Sets the scene as the current scene. The current scene will be updated and drawn during the engine up...
Definition Scene.cpp:199
static bool DeleteScene(const std::string &path)
Deletes a scene by its path.
Definition Scene.cpp:294
void SetPath(const std::string &path)
Sets the path of the scene. This method changes the "name" member to the given path.
Definition Scene.cpp:274
static void UpdateActiveScene()
Updates the active scene.
Definition Scene.cpp:313
const std::string & Rename(const std::string &newName, GameObject *obj)
Renames a GameObject. This method is mostly used internally and can be used by the user to change the...
Definition Scene.cpp:240
void LoadScene()
Loads the scene from the file with the same name as the path.
Definition Scene.cpp:165
static void Destroy()
Destroys the current scene.
Definition Scene.cpp:304
static std::list< Scene > _scenes
Definition Scene.h:205
void Save()
Serializes the scene and saves it in a file with the same name.
Definition Scene.cpp:155
std::list< Sprite * > drawList
Definition Scene.h:15
Represents a game sprite.
Definition Sprite.h:26