#ifndef WORLD_H
#define WORLD_H

#include <vector>

class IEntityBase;

class World
{
public:
	World();
	~World();

	void DestroyWorld();

	void Update(float dt);
	void Render();

	void AddEntity(IEntityBase* pEntity);
	IEntityBase* CreateEntity(const char* pClassname);
	void DeleteEntity(int index);

	int GetNumEntities();
	IEntityBase* GetEntity(int index);

	int FindEntityId(IEntityBase* pEntity);
	IEntityBase* FindEntityByClassName(const char* pClassname);

	void MarkEntityToDelete(IEntityBase* pEntity);
	void MarkEntityToDeleteId(int index);

private:
	void UpdateDestroyList();

private:
	std::vector<IEntityBase*> m_entities;
	std::vector<IEntityBase*> m_entitiesToDelete;
	bool m_isUpdating;
};

extern World* g_world;

#endif // !WORLD_H
