#include "game_level.hpp" #include "levelmanager.hpp" #include "components.hpp" namespace Game { using std::shared_ptr, std::string, std::make_shared; shared_ptr LEVELS; bool initialized = false; void init() { LEVELS = make_shared(); initialized = true; } LevelManager& get_the_manager() { return *LEVELS; } shared_ptr current_world() { return current().world; } shared_ptr 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(); return world->get(player.entity); } DinkyECS::Entity the_player() { return current().player; } }