You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.3 KiB
66 lines
1.3 KiB
#include "game_level.hpp"
|
|
#include "levelmanager.hpp"
|
|
#include "components.hpp"
|
|
|
|
namespace Game {
|
|
using std::shared_ptr, std::string, std::make_shared;
|
|
|
|
shared_ptr<LevelManager> LEVELS;
|
|
bool initialized = false;
|
|
|
|
void init() {
|
|
LEVELS = make_shared<LevelManager>();
|
|
initialized = true;
|
|
}
|
|
|
|
LevelManager& get_the_manager() {
|
|
return *LEVELS;
|
|
}
|
|
|
|
shared_ptr<DinkyECS::World> current_world() {
|
|
return current().world;
|
|
}
|
|
|
|
shared_ptr<gui::BossFightUI> create_bossfight() {
|
|
return LEVELS->create_bossfight(current_world());
|
|
}
|
|
|
|
GameLevel& create_level() {
|
|
LEVELS->create_level(current_world());
|
|
return next();
|
|
}
|
|
|
|
GameLevel &next() {
|
|
return LEVELS->next();
|
|
}
|
|
|
|
GameLevel &previous() {
|
|
return LEVELS->previous();
|
|
}
|
|
|
|
GameLevel ¤t() {
|
|
return LEVELS->current();
|
|
}
|
|
|
|
size_t current_index() {
|
|
return LEVELS->current_index();
|
|
}
|
|
|
|
GameLevel &get(size_t index) {
|
|
return LEVELS->get(index);
|
|
}
|
|
|
|
DinkyECS::Entity spawn_enemy(const std::string& named) {
|
|
return LEVELS->spawn_enemy(named);
|
|
}
|
|
|
|
components::Position& player_position() {
|
|
auto world = current_world();
|
|
auto& player = world->get_the<components::Player>();
|
|
return world->get<components::Position>(player.entity);
|
|
}
|
|
|
|
DinkyECS::Entity the_player() {
|
|
return current().player;
|
|
}
|
|
}
|
|
|