Now has an actual game loop where you die and start over.
This commit is contained in:
parent
514bfec0ea
commit
009c5c1cd2
10 changed files with 124 additions and 86 deletions
|
|
@ -34,6 +34,21 @@ namespace GameDB {
|
|||
};
|
||||
}
|
||||
|
||||
void init() {
|
||||
components::init();
|
||||
textures::init();
|
||||
|
||||
if(!initialized) {
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
void reset() {
|
||||
LDB = make_shared<LevelDB>();
|
||||
initialized = true;
|
||||
new_level(NULL);
|
||||
}
|
||||
|
||||
shared_ptr<DinkyECS::World> clone_load_world(shared_ptr<DinkyECS::World> prev_world) {
|
||||
auto world = make_shared<DinkyECS::World>();
|
||||
|
||||
|
|
@ -82,17 +97,6 @@ namespace GameDB {
|
|||
.collision=collision});
|
||||
}
|
||||
|
||||
void init() {
|
||||
components::init();
|
||||
textures::init();
|
||||
|
||||
if(!initialized) {
|
||||
LDB = make_shared<LevelDB>();
|
||||
initialized = true;
|
||||
new_level(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
shared_ptr<DinkyECS::World> current_world() {
|
||||
dbc::check(initialized, "Forgot to call GameDB::init()");
|
||||
return current_level().world;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,10 @@ namespace GameDB {
|
|||
Level& create_level();
|
||||
|
||||
void init();
|
||||
void reset();
|
||||
|
||||
Level ¤t_level();
|
||||
void new_level(std::shared_ptr<DinkyECS::World> prev_world);
|
||||
std::shared_ptr<DinkyECS::World> current_world();
|
||||
components::Position& player_position();
|
||||
DinkyECS::Entity the_player();
|
||||
|
|
|
|||
|
|
@ -538,6 +538,10 @@ void System::clear_attack() {
|
|||
void System::spawn_attack(World& world, int attack_id, DinkyECS::Entity enemy) {
|
||||
}
|
||||
|
||||
void System::restart() {
|
||||
// reset game db
|
||||
GameDB::reset();
|
||||
}
|
||||
|
||||
void System::init(Registry& reg) {
|
||||
reg.addRender(System::clear_attack);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ namespace System {
|
|||
using namespace DinkyECS;
|
||||
using std::string, matrix::Matrix;
|
||||
|
||||
void init(Registry& reg);
|
||||
void restart();
|
||||
|
||||
void lighting();
|
||||
void motion();
|
||||
void collision();
|
||||
|
|
@ -70,5 +73,4 @@ namespace System {
|
|||
void clear_attack();
|
||||
void spawn_attack(World& world, int attack_id, DinkyECS::Entity enemy);
|
||||
|
||||
void init(Registry& reg);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue