46 lines
1.0 KiB
C++
46 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace boundard::render {
|
|
class InputMap;
|
|
}
|
|
|
|
namespace boundard {
|
|
|
|
class Actor;
|
|
|
|
// 运行时场景:持有场景名和其中的 Actor,并统一驱动 Actor 的 init/tick。
|
|
class Scene {
|
|
public:
|
|
explicit Scene(std::string name = {});
|
|
~Scene();
|
|
|
|
Scene(const Scene&) = delete;
|
|
Scene& operator=(const Scene&) = delete;
|
|
Scene(Scene&&) noexcept = delete;
|
|
Scene& operator=(Scene&&) noexcept = delete;
|
|
|
|
const std::string& name() const;
|
|
void set_name(std::string name);
|
|
|
|
void add_actor(std::shared_ptr<Actor> actor);
|
|
void set_actors(std::vector<std::shared_ptr<Actor>> actors);
|
|
void clear();
|
|
|
|
const std::vector<Actor*>& actors() const;
|
|
std::vector<Actor*>& actors();
|
|
|
|
void initialize();
|
|
void process(float dt, const render::InputMap& input);
|
|
|
|
private:
|
|
std::string name_;
|
|
std::vector<std::shared_ptr<Actor>> actor_storage_;
|
|
std::vector<Actor*> actors_;
|
|
};
|
|
|
|
} // namespace boundard
|