parent
2fdbd63f4c
commit
009b1e63a7
@ -1,5 +1,7 @@ |
||||
#pragma once |
||||
|
||||
enum GUIEvent { |
||||
START, HIT, MISS, DEAD |
||||
}; |
||||
namespace Events { |
||||
enum GUI { |
||||
START, HIT, MISS, DEAD |
||||
}; |
||||
} |
||||
|
@ -1,6 +1,57 @@ |
||||
#include "gui.hpp" |
||||
#include "dinkyecs.hpp" |
||||
#include "systems.hpp" |
||||
#include "events.hpp" |
||||
#include "components.hpp" |
||||
#include "dbc.hpp" |
||||
#include "collider.hpp" |
||||
|
||||
/*
|
||||
* This needs to be turned into a real world generator |
||||
* system. |
||||
*/ |
||||
void configure_world(DinkyECS::World &world, Map &game_map) { |
||||
// this sets up the gui event system
|
||||
world.set_the<Events::GUI>(Events::GUI::START); |
||||
|
||||
// configure a player as a fact of the world
|
||||
Player player{world.entity()}; |
||||
world.set_the<Player>(player); |
||||
|
||||
spatial_map collider; |
||||
world.set_the<spatial_map>(collider); |
||||
|
||||
world.set<Position>(player.entity, {game_map.place_entity(0)}); |
||||
world.set<Motion>(player.entity, {0, 0}); |
||||
world.set<Combat>(player.entity, {100, 10}); |
||||
world.set<Tile>(player.entity, {PLAYER_TILE}); |
||||
|
||||
auto enemy = world.entity(); |
||||
world.set<Position>(enemy, {game_map.place_entity(1)}); |
||||
world.set<Motion>(enemy, {0,0}); |
||||
world.set<Combat>(enemy, {20, 10}); |
||||
world.set<Tile>(enemy, {ENEMY_TILE}); |
||||
|
||||
auto enemy2 = world.entity(); |
||||
world.set<Position>(enemy2, {game_map.place_entity(2)}); |
||||
world.set<Motion>(enemy2, {0,0}); |
||||
world.set<Combat>(enemy2, {20, 10}); |
||||
world.set<Tile>(enemy2, {"*"}); |
||||
|
||||
auto gold = world.entity(); |
||||
world.set<Position>(gold, {game_map.place_entity(game_map.room_count() - 1)}); |
||||
world.set<Treasure>(gold, {100}); |
||||
world.set<Tile>(gold, {"$"}); |
||||
} |
||||
|
||||
|
||||
int main() { |
||||
GUI gui; |
||||
DinkyECS::World world; |
||||
Map game_map(GAME_MAP_X, GAME_MAP_Y); |
||||
game_map.generate(); |
||||
|
||||
configure_world(world, game_map); |
||||
System::init_positions(world); |
||||
GUI gui(world, game_map); |
||||
return gui.main(); |
||||
} |
||||
|
Loading…
Reference in new issue