34 lines
666 B
C++
34 lines
666 B
C++
#pragma once
|
|
|
|
#include "framework/Core.h"
|
|
class Application;
|
|
class Actor;
|
|
|
|
namespace ly {
|
|
|
|
class World {
|
|
public:
|
|
World(Application *owningApp);
|
|
|
|
void BeginPlayInternal();
|
|
void TickInternal(float deltaTime);
|
|
|
|
virtual ~World();
|
|
|
|
template <typename ActorType>
|
|
weak<ActorType> SpawnActor() {
|
|
shared<ActorType> newActor{new ActorType{this}};
|
|
mPendingActors.push_back(newActor);
|
|
return newActor;
|
|
}
|
|
|
|
private:
|
|
void BeginPlay();
|
|
void Tick(float deltaTime);
|
|
Application *mOwningApp;
|
|
bool mBeganPlay;
|
|
List<shared<Actor>> mActors;
|
|
List<shared<Actor>> mPendingActors;
|
|
};
|
|
} // namespace ly
|