All of the UIs should be cleared out, and that just leaves the tests.
This commit is contained in:
parent
d5ff57e025
commit
564f9842a2
23 changed files with 126 additions and 145 deletions
|
@ -4,12 +4,12 @@
|
||||||
#include <fmt/xchar.h>
|
#include <fmt/xchar.h>
|
||||||
#include "gui/guecstra.hpp"
|
#include "gui/guecstra.hpp"
|
||||||
#include "inventory.hpp"
|
#include "inventory.hpp"
|
||||||
|
#include "game_level.hpp"
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
using namespace guecs;
|
using namespace guecs;
|
||||||
|
|
||||||
CombatUI::CombatUI(GameLevel level) :
|
CombatUI::CombatUI()
|
||||||
$level(level)
|
|
||||||
{
|
{
|
||||||
$gui.position(COMBAT_UI_X, COMBAT_UI_Y, COMBAT_UI_WIDTH, COMBAT_UI_HEIGHT);
|
$gui.position(COMBAT_UI_X, COMBAT_UI_Y, COMBAT_UI_WIDTH, COMBAT_UI_HEIGHT);
|
||||||
$gui.layout(
|
$gui.layout(
|
||||||
|
@ -31,15 +31,16 @@ namespace gui {
|
||||||
$gui.set<Sound>(button, {sound});
|
$gui.set<Sound>(button, {sound});
|
||||||
$gui.set<Effect>(button, {.duration=0.5f, .name=effect_name});
|
$gui.set<Effect>(button, {.duration=0.5f, .name=effect_name});
|
||||||
$gui.set<Clickable>(button,
|
$gui.set<Clickable>(button,
|
||||||
guecs::make_action($level, button, event, {action}));
|
guecs::make_action(button, event, {action}));
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CombatUI::init() {
|
void CombatUI::init() {
|
||||||
|
auto world = Game::current_world();
|
||||||
using guecs::THEME;
|
using guecs::THEME;
|
||||||
$gui.set<Background>($gui.MAIN, {$gui.$parser, THEME.DARK_MID});
|
$gui.set<Background>($gui.MAIN, {$gui.$parser, THEME.DARK_MID});
|
||||||
auto& the_belt = $level.world->get_the<ritual::Belt>();
|
auto& the_belt = world->get_the<ritual::Belt>();
|
||||||
|
|
||||||
for(int slot = 0; slot < the_belt.max_slots; slot++) {
|
for(int slot = 0; slot < the_belt.max_slots; slot++) {
|
||||||
if(the_belt.has(slot)) {
|
if(the_belt.has(slot)) {
|
||||||
|
@ -67,7 +68,7 @@ namespace gui {
|
||||||
auto hp_gauge = $gui.entity("hp_gauge");
|
auto hp_gauge = $gui.entity("hp_gauge");
|
||||||
$gui.set<Sprite>(hp_gauge, {"stone_doll_cursed"});
|
$gui.set<Sprite>(hp_gauge, {"stone_doll_cursed"});
|
||||||
$gui.set<Clickable>(hp_gauge,
|
$gui.set<Clickable>(hp_gauge,
|
||||||
guecs::make_action($level, hp_gauge, Events::GUI::HP_STATUS, {}));
|
guecs::make_action(hp_gauge, Events::GUI::HP_STATUS, {}));
|
||||||
|
|
||||||
$gui.init();
|
$gui.init();
|
||||||
}
|
}
|
||||||
|
@ -76,8 +77,7 @@ namespace gui {
|
||||||
$gui.render(window);
|
$gui.render(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CombatUI::update_level(GameLevel &level) {
|
void CombatUI::update_level() {
|
||||||
$level = level;
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "levelmanager.hpp"
|
|
||||||
#include <SFML/Graphics/RenderWindow.hpp>
|
#include <SFML/Graphics/RenderWindow.hpp>
|
||||||
#include <SFML/Graphics/Font.hpp>
|
#include <SFML/Graphics/Font.hpp>
|
||||||
#include <guecs/ui.hpp>
|
#include <guecs/ui.hpp>
|
||||||
|
@ -9,13 +8,12 @@ namespace gui {
|
||||||
class CombatUI {
|
class CombatUI {
|
||||||
public:
|
public:
|
||||||
guecs::UI $gui;
|
guecs::UI $gui;
|
||||||
GameLevel $level;
|
|
||||||
|
|
||||||
CombatUI(GameLevel level);
|
CombatUI();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void render(sf::RenderWindow& window);
|
void render(sf::RenderWindow& window);
|
||||||
void update_level(GameLevel &level);
|
void update_level();
|
||||||
bool mouse(float x, float y, guecs::Modifiers mods);
|
bool mouse(float x, float y, guecs::Modifiers mods);
|
||||||
guecs::Entity make_button(std::string name, Events::GUI event,
|
guecs::Entity make_button(std::string name, Events::GUI event,
|
||||||
int action, const std::string &icon_name,
|
int action, const std::string &icon_name,
|
||||||
|
|
18
gui/fsm.cpp
18
gui/fsm.cpp
|
@ -21,10 +21,6 @@ namespace gui {
|
||||||
$window(sf::VideoMode({SCREEN_WIDTH, SCREEN_HEIGHT}), "Zed's Raycaster Thing"),
|
$window(sf::VideoMode({SCREEN_WIDTH, SCREEN_HEIGHT}), "Zed's Raycaster Thing"),
|
||||||
$debug_ui(Game::get_the_manager()),
|
$debug_ui(Game::get_the_manager()),
|
||||||
$main_ui($window),
|
$main_ui($window),
|
||||||
$combat_ui(Game::current()),
|
|
||||||
$status_ui(Game::current()),
|
|
||||||
$map_ui(Game::current()),
|
|
||||||
$loot_ui(Game::current()),
|
|
||||||
$font{FONT_FILE_NAME},
|
$font{FONT_FILE_NAME},
|
||||||
$dnd_loot($status_ui, $loot_ui, $window, $router)
|
$dnd_loot($status_ui, $loot_ui, $window, $router)
|
||||||
{
|
{
|
||||||
|
@ -47,8 +43,7 @@ namespace gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSM::START(Event ) {
|
void FSM::START(Event ) {
|
||||||
auto& level = Game::current();
|
$main_ui.update_level();
|
||||||
$main_ui.update_level(level);
|
|
||||||
$main_ui.init();
|
$main_ui.init();
|
||||||
$loot_ui.init();
|
$loot_ui.init();
|
||||||
|
|
||||||
|
@ -545,13 +540,10 @@ namespace gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSM::next_level() {
|
void FSM::next_level() {
|
||||||
auto& level = Game::create_level();
|
$status_ui.update_level();
|
||||||
|
$combat_ui.update_level();
|
||||||
$status_ui.update_level(level);
|
$main_ui.update_level();
|
||||||
$map_ui.update_level(level);
|
$loot_ui.update_level();
|
||||||
$combat_ui.update_level(level);
|
|
||||||
$main_ui.update_level(level);
|
|
||||||
$loot_ui.update_level(level);
|
|
||||||
|
|
||||||
$boss_fight_ui = Game::create_bossfight();
|
$boss_fight_ui = Game::create_bossfight();
|
||||||
$boss_fight_ui->init();
|
$boss_fight_ui->init();
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
#include "gui/guecstra.hpp"
|
#include "gui/guecstra.hpp"
|
||||||
|
#include "game_level.hpp"
|
||||||
|
|
||||||
namespace guecs {
|
namespace guecs {
|
||||||
|
|
||||||
Clickable make_action(GameLevel& target, guecs::Entity gui_id, Events::GUI event) {
|
Clickable make_action(guecs::Entity gui_id, Events::GUI event) {
|
||||||
return {[&, gui_id, event](auto){
|
return {[&, gui_id, event](auto){
|
||||||
target.world->send<Events::GUI>(event, gui_id, {});
|
auto world = Game::current_world();
|
||||||
|
world->send<Events::GUI>(event, gui_id, {});
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
Clickable make_action(GameLevel& target, guecs::Entity gui_id, Events::GUI event, std::any data) {
|
Clickable make_action(guecs::Entity gui_id, Events::GUI event, std::any data) {
|
||||||
return {[&, event, data](auto){
|
return {[&, event, data](auto){
|
||||||
target.world->send<Events::GUI>(event, gui_id, data);
|
auto world = Game::current_world();
|
||||||
|
world->send<Events::GUI>(event, gui_id, data);
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,10 @@
|
||||||
#include "events.hpp"
|
#include "events.hpp"
|
||||||
#include <guecs/ui.hpp>
|
#include <guecs/ui.hpp>
|
||||||
#include "textures.hpp"
|
#include "textures.hpp"
|
||||||
#include "levelmanager.hpp"
|
|
||||||
|
|
||||||
namespace guecs {
|
namespace guecs {
|
||||||
Clickable make_action(GameLevel& target, guecs::Entity gui_id, Events::GUI event);
|
Clickable make_action(guecs::Entity gui_id, Events::GUI event);
|
||||||
Clickable make_action(GameLevel& target, guecs::Entity gui_id, Events::GUI event, std::any data);
|
Clickable make_action(guecs::Entity gui_id, Events::GUI event, std::any data);
|
||||||
|
|
||||||
struct GrabSource {
|
struct GrabSource {
|
||||||
DinkyECS::Entity world_entity;
|
DinkyECS::Entity world_entity;
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include <fmt/xchar.h>
|
#include <fmt/xchar.h>
|
||||||
#include "systems.hpp"
|
#include "systems.hpp"
|
||||||
|
#include "game_level.hpp"
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
using namespace guecs;
|
using namespace guecs;
|
||||||
|
|
||||||
LootUI::LootUI(GameLevel level) :
|
LootUI::LootUI() :
|
||||||
$level(level),
|
$temp_loot(Game::current_world()->entity()),
|
||||||
$temp_loot($level.world->entity()),
|
|
||||||
$target($temp_loot)
|
$target($temp_loot)
|
||||||
{
|
{
|
||||||
$gui.position(RAY_VIEW_X+RAY_VIEW_WIDTH/2-200,
|
$gui.position(RAY_VIEW_X+RAY_VIEW_WIDTH/2-200,
|
||||||
|
@ -21,8 +21,9 @@ namespace gui {
|
||||||
"[=item_12| =item_13|=item_14|=item_15 ]"
|
"[=item_12| =item_13|=item_14|=item_15 ]"
|
||||||
"[ =take_all | =close| =destroy]");
|
"[ =take_all | =close| =destroy]");
|
||||||
|
|
||||||
$level.world->set<inventory::Model>($temp_loot, {});
|
auto world = Game::current_world();
|
||||||
$level.world->make_constant($temp_loot);
|
world->set<inventory::Model>($temp_loot, {});
|
||||||
|
world->make_constant($temp_loot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LootUI::make_button(const std::string &name, const std::wstring& label, Events::GUI event) {
|
void LootUI::make_button(const std::string &name, const std::wstring& label, Events::GUI event) {
|
||||||
|
@ -31,7 +32,7 @@ namespace gui {
|
||||||
$gui.set<guecs::Rectangle>(button, {});
|
$gui.set<guecs::Rectangle>(button, {});
|
||||||
$gui.set<guecs::Text>(button, {label});
|
$gui.set<guecs::Text>(button, {label});
|
||||||
$gui.set<guecs::Clickable>(button,
|
$gui.set<guecs::Clickable>(button,
|
||||||
guecs::make_action($level, button, event));
|
guecs::make_action(button, event));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LootUI::init() {
|
void LootUI::init() {
|
||||||
|
@ -52,7 +53,7 @@ namespace gui {
|
||||||
THEME.TRANSPARENT, THEME.LIGHT_MID });
|
THEME.TRANSPARENT, THEME.LIGHT_MID });
|
||||||
$gui.set<guecs::Effect>(id, {0.4f, "ui_shader"});
|
$gui.set<guecs::Effect>(id, {0.4f, "ui_shader"});
|
||||||
$gui.set<guecs::Clickable>(id, {
|
$gui.set<guecs::Clickable>(id, {
|
||||||
guecs::make_action($level, id, Events::GUI::LOOT_SELECT, {id})
|
guecs::make_action(id, Events::GUI::LOOT_SELECT, {id})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,10 +62,12 @@ namespace gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LootUI::update() {
|
void LootUI::update() {
|
||||||
dbc::check($level.world->has<inventory::Model>($target),
|
auto world = Game::current_world();
|
||||||
|
|
||||||
|
dbc::check(world->has<inventory::Model>($target),
|
||||||
"update called but $target isn't in world");
|
"update called but $target isn't in world");
|
||||||
|
|
||||||
auto& contents = $level.world->get<inventory::Model>($target);
|
auto& contents = world->get<inventory::Model>($target);
|
||||||
|
|
||||||
for(size_t i = 0; i < INV_SLOTS; i++) {
|
for(size_t i = 0; i < INV_SLOTS; i++) {
|
||||||
auto id = $gui.entity("item_", int(i));
|
auto id = $gui.entity("item_", int(i));
|
||||||
|
@ -72,9 +75,9 @@ namespace gui {
|
||||||
|
|
||||||
if(contents.has(slot_name)) {
|
if(contents.has(slot_name)) {
|
||||||
auto item = contents.get(slot_name);
|
auto item = contents.get(slot_name);
|
||||||
dbc::check($level.world->has<components::Sprite>(item),
|
dbc::check(world->has<components::Sprite>(item),
|
||||||
"item in inventory UI doesn't exist in world. New level?");
|
"item in inventory UI doesn't exist in world. New level?");
|
||||||
auto& sprite = $level.world->get<components::Sprite>(item);
|
auto& sprite = world->get<components::Sprite>(item);
|
||||||
$gui.set_init<guecs::Icon>(id, {sprite.name});
|
$gui.set_init<guecs::Icon>(id, {sprite.name});
|
||||||
|
|
||||||
guecs::GrabSource grabber{
|
guecs::GrabSource grabber{
|
||||||
|
@ -98,7 +101,7 @@ namespace gui {
|
||||||
void LootUI::remove_slot(guecs::Entity slot_id) {
|
void LootUI::remove_slot(guecs::Entity slot_id) {
|
||||||
auto& name = $gui.name_for(slot_id);
|
auto& name = $gui.name_for(slot_id);
|
||||||
fmt::println("LootUI remove slot inv::Model id={} slot={}", $target, name);
|
fmt::println("LootUI remove slot inv::Model id={} slot={}", $target, name);
|
||||||
System::remove_from_container(*$level.world, $target, name);
|
System::remove_from_container($target, name);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +110,7 @@ namespace gui {
|
||||||
$target, id, world_entity);
|
$target, id, world_entity);
|
||||||
auto& name = $gui.name_for(id);
|
auto& name = $gui.name_for(id);
|
||||||
|
|
||||||
bool worked = System::place_in_container(*$level.world, $target, name, world_entity);
|
bool worked = System::place_in_container($target, name, world_entity);
|
||||||
if(worked) update();
|
if(worked) update();
|
||||||
return worked;
|
return worked;
|
||||||
}
|
}
|
||||||
|
@ -116,13 +119,12 @@ namespace gui {
|
||||||
$gui.render(window);
|
$gui.render(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LootUI::update_level(GameLevel &level) {
|
void LootUI::update_level() {
|
||||||
$level = level;
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LootUI::add_loose_item(DinkyECS::Entity entity) {
|
void LootUI::add_loose_item(DinkyECS::Entity entity) {
|
||||||
System::place_in_container(*$level.world, $temp_loot, "item_0", entity);
|
System::place_in_container($temp_loot, "item_0", entity);
|
||||||
set_target($temp_loot);
|
set_target($temp_loot);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "gui/guecstra.hpp"
|
#include "gui/guecstra.hpp"
|
||||||
#include "levelmanager.hpp"
|
|
||||||
#include <SFML/Graphics/RenderWindow.hpp>
|
#include <SFML/Graphics/RenderWindow.hpp>
|
||||||
#include <SFML/Graphics/Font.hpp>
|
#include <SFML/Graphics/Font.hpp>
|
||||||
#include <guecs/ui.hpp>
|
#include <guecs/ui.hpp>
|
||||||
|
@ -12,11 +11,10 @@ namespace gui {
|
||||||
public:
|
public:
|
||||||
bool active = false;
|
bool active = false;
|
||||||
guecs::UI $gui;
|
guecs::UI $gui;
|
||||||
GameLevel $level;
|
|
||||||
DinkyECS::Entity $temp_loot;
|
DinkyECS::Entity $temp_loot;
|
||||||
DinkyECS::Entity $target;
|
DinkyECS::Entity $target;
|
||||||
|
|
||||||
LootUI(GameLevel level);
|
LootUI();
|
||||||
|
|
||||||
void set_target(DinkyECS::Entity entity) {
|
void set_target(DinkyECS::Entity entity) {
|
||||||
$target = entity;
|
$target = entity;
|
||||||
|
@ -25,7 +23,7 @@ namespace gui {
|
||||||
void init();
|
void init();
|
||||||
void update();
|
void update();
|
||||||
void render(sf::RenderWindow& window);
|
void render(sf::RenderWindow& window);
|
||||||
void update_level(GameLevel &level);
|
void update_level();
|
||||||
bool mouse(float x, float y, guecs::Modifiers mods);
|
bool mouse(float x, float y, guecs::Modifiers mods);
|
||||||
void make_button(const std::string &name, const std::wstring& label, Events::GUI event);
|
void make_button(const std::string &name, const std::wstring& label, Events::GUI event);
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "easings.hpp"
|
#include "easings.hpp"
|
||||||
#include <fmt/xchar.h>
|
#include <fmt/xchar.h>
|
||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
|
#include "game_level.hpp"
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
using namespace components;
|
using namespace components;
|
||||||
|
@ -20,7 +21,7 @@ namespace gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainUI::init() {
|
void MainUI::init() {
|
||||||
auto& player_position = $level.world->get<Position>($level.player);
|
auto& player_position = Game::player_position();
|
||||||
auto player = player_position.location;
|
auto player = player_position.location;
|
||||||
|
|
||||||
$rayview->init_shaders();
|
$rayview->init_shaders();
|
||||||
|
@ -31,9 +32,10 @@ namespace gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
DinkyECS::Entity MainUI::camera_aim() {
|
DinkyECS::Entity MainUI::camera_aim() {
|
||||||
|
auto& level = Game::current();
|
||||||
// what happens if there's two things at that spot
|
// what happens if there's two things at that spot
|
||||||
if($level.collision->something_there($rayview->aiming_at)) {
|
if(level.collision->something_there($rayview->aiming_at)) {
|
||||||
return $level.collision->get($rayview->aiming_at);
|
return level.collision->get($rayview->aiming_at);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -88,27 +90,26 @@ namespace gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainUI::dead_entity(DinkyECS::Entity entity) {
|
void MainUI::dead_entity(DinkyECS::Entity entity) {
|
||||||
// BUG: this is kind of weird, but I think when I switch to dead bodies for things
|
auto world = Game::current_world();
|
||||||
// (see System::distribute_loot) then this can be fixed or improved
|
if(world->has<components::Sprite>(entity)) {
|
||||||
if($level.world->has<components::Sprite>(entity)) {
|
auto &sprite = world->get<components::Sprite>(entity);
|
||||||
auto &sprite = $level.world->get<components::Sprite>(entity);
|
|
||||||
$rayview->update_sprite(entity, sprite);
|
$rayview->update_sprite(entity, sprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainUI::update_level(GameLevel level) {
|
void MainUI::update_level() {
|
||||||
$level = level;
|
auto& level = Game::current();
|
||||||
auto& player_position = $level.world->get<Position>($level.player);
|
auto& player_position = Game::player_position();
|
||||||
auto player = player_position.location;
|
auto player = player_position.location;
|
||||||
|
|
||||||
$rayview->update_level($level);
|
$rayview->update_level(level);
|
||||||
$rayview->position_camera(player.x + 0.5, player.y + 0.5);
|
$rayview->position_camera(player.x + 0.5, player.y + 0.5);
|
||||||
|
|
||||||
player_position.aiming_at = $rayview->aiming_at;
|
player_position.aiming_at = $rayview->aiming_at;
|
||||||
|
|
||||||
$compass_dir = 0;
|
$compass_dir = 0;
|
||||||
|
|
||||||
$overlay_ui.update_level(level);
|
$overlay_ui.update_level();
|
||||||
dirty();
|
dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "levelmanager.hpp"
|
|
||||||
#include <SFML/Graphics/RenderWindow.hpp>
|
#include <SFML/Graphics/RenderWindow.hpp>
|
||||||
#include <SFML/System/Clock.hpp>
|
#include <SFML/System/Clock.hpp>
|
||||||
#include "stats.hpp"
|
#include "stats.hpp"
|
||||||
|
@ -32,7 +31,7 @@ namespace gui {
|
||||||
std::optional<components::Position> play_move();
|
std::optional<components::Position> play_move();
|
||||||
Point plan_move(int dir, bool strafe);
|
Point plan_move(int dir, bool strafe);
|
||||||
void abort_plan();
|
void abort_plan();
|
||||||
void update_level(GameLevel level);
|
void update_level();
|
||||||
DinkyECS::Entity camera_aim();
|
DinkyECS::Entity camera_aim();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <fmt/xchar.h>
|
#include <fmt/xchar.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "palette.hpp"
|
#include "palette.hpp"
|
||||||
|
#include "game_level.hpp"
|
||||||
|
|
||||||
constexpr const int MAP_WIDTH=13;
|
constexpr const int MAP_WIDTH=13;
|
||||||
constexpr const int MAP_HEIGHT=13;
|
constexpr const int MAP_HEIGHT=13;
|
||||||
|
@ -20,18 +21,14 @@ namespace gui {
|
||||||
using namespace components;
|
using namespace components;
|
||||||
using namespace guecs;
|
using namespace guecs;
|
||||||
|
|
||||||
MapViewUI::MapViewUI(GameLevel &level) :
|
MapViewUI::MapViewUI() :
|
||||||
$level(level),
|
|
||||||
$map_render(std::make_shared<sf::RenderTexture>()),
|
$map_render(std::make_shared<sf::RenderTexture>()),
|
||||||
$map_sprite($map_render->getTexture()),
|
$map_sprite($map_render->getTexture()),
|
||||||
$map_tiles(matrix::make(MAP_WIDTH, MAP_HEIGHT))
|
$map_tiles(matrix::make(MAP_WIDTH, MAP_HEIGHT))
|
||||||
{
|
{
|
||||||
auto player = $level.world->get_the<Player>();
|
auto world = Game::current_world();
|
||||||
$player_display = $level.world->get<Tile>(player.entity).display;
|
auto player = Game::the_player();
|
||||||
}
|
$player_display = world->get<Tile>(player).display;
|
||||||
|
|
||||||
void MapViewUI::update_level(GameLevel &level) {
|
|
||||||
$level = level;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapViewUI::init() {
|
void MapViewUI::init() {
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "levelmanager.hpp"
|
|
||||||
#include "textures.hpp"
|
#include "textures.hpp"
|
||||||
#include "matrix.hpp"
|
#include "matrix.hpp"
|
||||||
#include <guecs/ui.hpp>
|
#include <guecs/ui.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "dinkyecs.hpp"
|
||||||
|
#include "map.hpp"
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
class MapViewUI {
|
class MapViewUI {
|
||||||
|
@ -13,15 +14,13 @@ namespace gui {
|
||||||
DinkyECS::Entity $log_to;
|
DinkyECS::Entity $log_to;
|
||||||
EntityGrid $entity_map;
|
EntityGrid $entity_map;
|
||||||
std::deque<std::wstring> $messages;
|
std::deque<std::wstring> $messages;
|
||||||
GameLevel $level;
|
|
||||||
std::shared_ptr<sf::RenderTexture> $map_render;
|
std::shared_ptr<sf::RenderTexture> $map_render;
|
||||||
sf::Sprite $map_sprite;
|
sf::Sprite $map_sprite;
|
||||||
matrix::Matrix $map_tiles;
|
matrix::Matrix $map_tiles;
|
||||||
|
|
||||||
MapViewUI(GameLevel &level);
|
MapViewUI();
|
||||||
void init();
|
void init();
|
||||||
void render(sf::RenderWindow &window, int compass_dir);
|
void render(sf::RenderWindow &window, int compass_dir);
|
||||||
void update_level(GameLevel &level);
|
|
||||||
void log(std::wstring msg);
|
void log(std::wstring msg);
|
||||||
void update();
|
void update();
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,17 +14,12 @@
|
||||||
namespace gui {
|
namespace gui {
|
||||||
using namespace components;
|
using namespace components;
|
||||||
|
|
||||||
MiniMapUI::MiniMapUI(GameLevel &level) :
|
MiniMapUI::MiniMapUI() :
|
||||||
$map_grid{L"...", 45, {200, 200, 200, 100}, 10},
|
$map_grid{L"...", 45, {200, 200, 200, 100}, 10}
|
||||||
$level(level)
|
|
||||||
{
|
{
|
||||||
$font = std::make_shared<sf::Font>(FONT_FILE_NAME);
|
$font = std::make_shared<sf::Font>(FONT_FILE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MiniMapUI::update_level(GameLevel &level) {
|
|
||||||
$level = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MiniMapUI::init(guecs::UI& overlay) {
|
void MiniMapUI::init(guecs::UI& overlay) {
|
||||||
auto top_right = overlay.entity("top_right");
|
auto top_right = overlay.entity("top_right");
|
||||||
auto cell = overlay.cell_for(top_right);
|
auto cell = overlay.cell_for(top_right);
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "levelmanager.hpp"
|
|
||||||
#include "textures.hpp"
|
#include "textures.hpp"
|
||||||
#include <guecs/ui.hpp>
|
#include <guecs/ui.hpp>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
class MiniMapUI {
|
class MiniMapUI {
|
||||||
public:
|
public:
|
||||||
guecs::Text $map_grid;
|
guecs::Text $map_grid;
|
||||||
guecs::UI $gui;
|
guecs::UI $gui;
|
||||||
GameLevel $level;
|
std::shared_ptr<sf::Font> $font = nullptr;
|
||||||
shared_ptr<sf::Font> $font = nullptr;
|
|
||||||
|
|
||||||
MiniMapUI(GameLevel &level);
|
MiniMapUI();
|
||||||
void init(guecs::UI& overlay);
|
void init(guecs::UI& overlay);
|
||||||
void render(sf::RenderWindow &window, int compass_dir);
|
void render(sf::RenderWindow &window, int compass_dir);
|
||||||
void update_level(GameLevel &level);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include "events.hpp"
|
#include "events.hpp"
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include "game_level.hpp"
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
using namespace guecs;
|
using namespace guecs;
|
||||||
|
@ -17,21 +18,23 @@ namespace gui {
|
||||||
$gui.init();
|
$gui.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void make_clickable_area(GameLevel& level, guecs::UI &gui, const std::string &name) {
|
inline void make_clickable_area(std::shared_ptr<DinkyECS::World> world, guecs::UI &gui, const std::string &name) {
|
||||||
auto area = gui.entity(name);
|
auto area = gui.entity(name);
|
||||||
|
|
||||||
gui.set<Clickable>(area, {
|
gui.set<Clickable>(area, {
|
||||||
[&](auto) {
|
[&](auto) {
|
||||||
level.world->send<Events::GUI>(Events::GUI::AIM_CLICK, area, {});
|
world->send<Events::GUI>(Events::GUI::AIM_CLICK, area, {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayUI::init() {
|
void OverlayUI::init() {
|
||||||
|
auto world = Game::current_world();
|
||||||
|
|
||||||
// gui.init is in the constructor
|
// gui.init is in the constructor
|
||||||
make_clickable_area($level, $gui, "top");
|
make_clickable_area(world, $gui, "top");
|
||||||
make_clickable_area($level, $gui, "middle");
|
make_clickable_area(world, $gui, "middle");
|
||||||
make_clickable_area($level, $gui, "bottom");
|
make_clickable_area(world, $gui, "bottom");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayUI::render(sf::RenderWindow& window) {
|
void OverlayUI::render(sf::RenderWindow& window) {
|
||||||
|
@ -55,8 +58,7 @@ namespace gui {
|
||||||
$gui.close<Text>(region);
|
$gui.close<Text>(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayUI::update_level(GameLevel level) {
|
void OverlayUI::update_level() {
|
||||||
$level = level;
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#include <SFML/Graphics/RenderWindow.hpp>
|
#include <SFML/Graphics/RenderWindow.hpp>
|
||||||
#include <SFML/Graphics/Font.hpp>
|
#include <SFML/Graphics/Font.hpp>
|
||||||
#include <guecs/ui.hpp>
|
#include <guecs/ui.hpp>
|
||||||
#include "levelmanager.hpp"
|
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
using std::string;
|
using std::string;
|
||||||
|
@ -10,12 +9,11 @@ namespace gui {
|
||||||
class OverlayUI {
|
class OverlayUI {
|
||||||
public:
|
public:
|
||||||
guecs::UI $gui;
|
guecs::UI $gui;
|
||||||
GameLevel $level;
|
|
||||||
|
|
||||||
OverlayUI();
|
OverlayUI();
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void update_level(GameLevel level);
|
void update_level();
|
||||||
|
|
||||||
void render(sf::RenderWindow& window);
|
void render(sf::RenderWindow& window);
|
||||||
void show_sprite(string region, string sprite_name);
|
void show_sprite(string region, string sprite_name);
|
||||||
|
|
|
@ -6,15 +6,14 @@
|
||||||
#include "rand.hpp"
|
#include "rand.hpp"
|
||||||
#include "sound.hpp"
|
#include "sound.hpp"
|
||||||
#include "events.hpp"
|
#include "events.hpp"
|
||||||
|
#include "game_level.hpp"
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
namespace ritual {
|
namespace ritual {
|
||||||
using namespace guecs;
|
using namespace guecs;
|
||||||
using std::any, std::any_cast, std::string, std::make_any;
|
using std::any, std::any_cast, std::string, std::make_any;
|
||||||
|
|
||||||
UI::UI(GameLevel level) :
|
UI::UI() {
|
||||||
$level(level)
|
|
||||||
{
|
|
||||||
$gui.position(STATUS_UI_X, STATUS_UI_Y, STATUS_UI_WIDTH, STATUS_UI_HEIGHT);
|
$gui.position(STATUS_UI_X, STATUS_UI_Y, STATUS_UI_WIDTH, STATUS_UI_HEIGHT);
|
||||||
$gui.layout(
|
$gui.layout(
|
||||||
"[_]"
|
"[_]"
|
||||||
|
@ -186,11 +185,14 @@ namespace gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI::complete_combine() {
|
void UI::complete_combine() {
|
||||||
|
auto world = Game::current_world();
|
||||||
|
auto player = Game::the_player();
|
||||||
|
|
||||||
if($craft_state.is_combined()) {
|
if($craft_state.is_combined()) {
|
||||||
auto ritual = $ritual_engine.finalize($craft_state);
|
auto ritual = $ritual_engine.finalize($craft_state);
|
||||||
auto& belt = $level.world->get_the<::ritual::Belt>();
|
auto& belt = world->get_the<::ritual::Belt>();
|
||||||
belt.equip(belt.next(), ritual);
|
belt.equip(belt.next(), ritual);
|
||||||
$level.world->send<Events::GUI>(Events::GUI::NEW_RITUAL, $level.player, {});
|
world->send<Events::GUI>(Events::GUI::NEW_RITUAL, player, {});
|
||||||
blanket().consume_crafting();
|
blanket().consume_crafting();
|
||||||
clear_craft_result();
|
clear_craft_result();
|
||||||
|
|
||||||
|
@ -240,14 +242,15 @@ namespace gui {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI::update_level(GameLevel& level) {
|
|
||||||
$level = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UI::clear_craft_result() {
|
void UI::clear_craft_result() {
|
||||||
blanket().reset();
|
blanket().reset();
|
||||||
$gui.close<Text>("result_text");
|
$gui.close<Text>("result_text");
|
||||||
$gui.close<Sprite>("result_image");
|
$gui.close<Sprite>("result_image");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::ritual::Blanket& UI::blanket() {
|
||||||
|
auto world = Game::current_world();
|
||||||
|
return world->get_the<::ritual::Blanket>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "levelmanager.hpp"
|
|
||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include "textures.hpp"
|
#include "textures.hpp"
|
||||||
|
@ -37,12 +36,11 @@ namespace gui {
|
||||||
sf::IntRect $ritual_open_rect{{380 * 2,0},{380,720}};
|
sf::IntRect $ritual_open_rect{{380 * 2,0},{380,720}};
|
||||||
components::Animation $ritual_anim;
|
components::Animation $ritual_anim;
|
||||||
guecs::UI $gui;
|
guecs::UI $gui;
|
||||||
GameLevel $level;
|
|
||||||
textures::SpriteTexture $ritual_ui;
|
textures::SpriteTexture $ritual_ui;
|
||||||
::ritual::Engine $ritual_engine;
|
::ritual::Engine $ritual_engine;
|
||||||
::ritual::CraftingState $craft_state;
|
::ritual::CraftingState $craft_state;
|
||||||
|
|
||||||
UI(GameLevel level);
|
UI();
|
||||||
|
|
||||||
void event(Event ev, std::any data={});
|
void event(Event ev, std::any data={});
|
||||||
void START(Event);
|
void START(Event);
|
||||||
|
@ -63,11 +61,7 @@ namespace gui {
|
||||||
void run_crafting_engine();
|
void run_crafting_engine();
|
||||||
void complete_combine();
|
void complete_combine();
|
||||||
void update_selection_state();
|
void update_selection_state();
|
||||||
void update_level(GameLevel &level);
|
::ritual::Blanket& blanket();
|
||||||
|
|
||||||
::ritual::Blanket& blanket() {
|
|
||||||
return $level.world->get_the<::ritual::Blanket>();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,14 @@
|
||||||
#include "gui/guecstra.hpp"
|
#include "gui/guecstra.hpp"
|
||||||
#include "systems.hpp"
|
#include "systems.hpp"
|
||||||
#include "inventory.hpp"
|
#include "inventory.hpp"
|
||||||
|
#include "game_level.hpp"
|
||||||
|
#include "levelmanager.hpp"
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
using namespace guecs;
|
using namespace guecs;
|
||||||
using std::any, std::any_cast, std::string, std::make_any;
|
using std::any, std::any_cast, std::string, std::make_any;
|
||||||
|
|
||||||
StatusUI::StatusUI(GameLevel level) :
|
StatusUI::StatusUI()
|
||||||
$level(level), $ritual_ui(level)
|
|
||||||
{
|
{
|
||||||
$gui.position(STATUS_UI_X, STATUS_UI_Y, STATUS_UI_WIDTH, STATUS_UI_HEIGHT);
|
$gui.position(STATUS_UI_X, STATUS_UI_Y, STATUS_UI_WIDTH, STATUS_UI_HEIGHT);
|
||||||
$gui.layout(
|
$gui.layout(
|
||||||
|
@ -45,7 +46,7 @@ namespace gui {
|
||||||
} else {
|
} else {
|
||||||
$gui.set<Text>(gui_id, {guecs::to_wstring(name)});
|
$gui.set<Text>(gui_id, {guecs::to_wstring(name)});
|
||||||
$gui.set<Clickable>(gui_id, {
|
$gui.set<Clickable>(gui_id, {
|
||||||
guecs::make_action($level, gui_id, Events::GUI::INV_SELECT, {gui_id})
|
guecs::make_action(gui_id, Events::GUI::INV_SELECT, {gui_id})
|
||||||
});
|
});
|
||||||
$gui.set<DropTarget>(gui_id, {
|
$gui.set<DropTarget>(gui_id, {
|
||||||
.commit=[&, gui_id](DinkyECS::Entity world_target) -> bool {
|
.commit=[&, gui_id](DinkyECS::Entity world_target) -> bool {
|
||||||
|
@ -74,8 +75,9 @@ namespace gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusUI::update() {
|
void StatusUI::update() {
|
||||||
auto player = $level.world->get_the<components::Player>();
|
auto world = Game::current_world();
|
||||||
auto& inventory = $level.world->get<inventory::Model>(player.entity);
|
auto player = world->get_the<components::Player>();
|
||||||
|
auto& inventory = world->get<inventory::Model>(player.entity);
|
||||||
|
|
||||||
for(const auto& [slot, cell] : $gui.cells()) {
|
for(const auto& [slot, cell] : $gui.cells()) {
|
||||||
|
|
||||||
|
@ -83,7 +85,7 @@ namespace gui {
|
||||||
auto gui_id = $gui.entity(slot);
|
auto gui_id = $gui.entity(slot);
|
||||||
auto world_entity = inventory.get(slot);
|
auto world_entity = inventory.get(slot);
|
||||||
|
|
||||||
auto& sprite = $level.world->get<components::Sprite>(world_entity);
|
auto& sprite = world->get<components::Sprite>(world_entity);
|
||||||
$gui.set_init<guecs::Icon>(gui_id, {sprite.name});
|
$gui.set_init<guecs::Icon>(gui_id, {sprite.name});
|
||||||
guecs::GrabSource grabber{ world_entity,
|
guecs::GrabSource grabber{ world_entity,
|
||||||
[&, gui_id]() { return remove_slot(gui_id); }};
|
[&, gui_id]() { return remove_slot(gui_id); }};
|
||||||
|
@ -106,18 +108,17 @@ namespace gui {
|
||||||
$ritual_ui.render(window);
|
$ritual_ui.render(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusUI::update_level(GameLevel &level) {
|
void StatusUI::update_level() {
|
||||||
$level = level;
|
|
||||||
init();
|
init();
|
||||||
$ritual_ui.update_level(level);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StatusUI::place_slot(guecs::Entity gui_id, DinkyECS::Entity world_entity) {
|
bool StatusUI::place_slot(guecs::Entity gui_id, DinkyECS::Entity world_entity) {
|
||||||
|
auto& level = Game::current();
|
||||||
auto& slot_name = $gui.name_for(gui_id);
|
auto& slot_name = $gui.name_for(gui_id);
|
||||||
auto& inventory = $level.world->get<inventory::Model>($level.player);
|
auto& inventory = level.world->get<inventory::Model>(level.player);
|
||||||
|
|
||||||
if(inventory.add(slot_name, world_entity)) {
|
if(inventory.add(slot_name, world_entity)) {
|
||||||
$level.world->make_constant(world_entity);
|
level.world->make_constant(world_entity);
|
||||||
update();
|
update();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -133,23 +134,25 @@ namespace gui {
|
||||||
|
|
||||||
// NOTE: do I need this or how does it relate to drop_item?
|
// NOTE: do I need this or how does it relate to drop_item?
|
||||||
void StatusUI::remove_slot(guecs::Entity slot_id) {
|
void StatusUI::remove_slot(guecs::Entity slot_id) {
|
||||||
|
auto player = Game::the_player();
|
||||||
auto& slot_name = $gui.name_for(slot_id);
|
auto& slot_name = $gui.name_for(slot_id);
|
||||||
System::remove_from_container(*$level.world, $level.player, slot_name);
|
System::remove_from_container(player, slot_name);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusUI::swap(guecs::Entity gui_a, guecs::Entity gui_b) {
|
void StatusUI::swap(guecs::Entity gui_a, guecs::Entity gui_b) {
|
||||||
if(gui_a != gui_b) {
|
if(gui_a != gui_b) {
|
||||||
|
auto player = Game::the_player();
|
||||||
auto& a_name = $gui.name_for(gui_a);
|
auto& a_name = $gui.name_for(gui_a);
|
||||||
auto& b_name = $gui.name_for(gui_b);
|
auto& b_name = $gui.name_for(gui_b);
|
||||||
System::inventory_swap($level.player, a_name, b_name);
|
System::inventory_swap(player, a_name, b_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StatusUI::occupied(guecs::Entity slot) {
|
bool StatusUI::occupied(guecs::Entity slot) {
|
||||||
auto player = $level.world->get_the<components::Player>();
|
auto player = Game::the_player();
|
||||||
return System::inventory_occupied(player.entity, $gui.name_for(slot));
|
return System::inventory_occupied(player, $gui.name_for(slot));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "levelmanager.hpp"
|
|
||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include "textures.hpp"
|
#include "textures.hpp"
|
||||||
|
@ -11,17 +10,16 @@ namespace gui {
|
||||||
class StatusUI {
|
class StatusUI {
|
||||||
public:
|
public:
|
||||||
guecs::UI $gui;
|
guecs::UI $gui;
|
||||||
GameLevel $level;
|
|
||||||
ritual::UI $ritual_ui;
|
ritual::UI $ritual_ui;
|
||||||
|
|
||||||
explicit StatusUI(GameLevel level);
|
explicit StatusUI();
|
||||||
|
|
||||||
StatusUI(const StatusUI& other) = delete;
|
StatusUI(const StatusUI& other) = delete;
|
||||||
StatusUI(StatusUI&& other) = delete;
|
StatusUI(StatusUI&& other) = delete;
|
||||||
~StatusUI() = default;
|
~StatusUI() = default;
|
||||||
|
|
||||||
void select_ritual();
|
void select_ritual();
|
||||||
void update_level(GameLevel &level);
|
void update_level();
|
||||||
void init();
|
void init();
|
||||||
void render(sf::RenderWindow &window);
|
void render(sf::RenderWindow &window);
|
||||||
void update();
|
void update();
|
||||||
|
|
10
systems.cpp
10
systems.cpp
|
@ -470,8 +470,9 @@ void System::drop_item(Entity item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: I think pickup and this need to be different
|
// NOTE: I think pickup and this need to be different
|
||||||
bool System::place_in_container(World& world, Entity cont_id, const std::string& name, Entity world_entity) {
|
bool System::place_in_container(Entity cont_id, const std::string& name, Entity world_entity) {
|
||||||
auto& container = world.get<inventory::Model>(cont_id);
|
auto world = Game::current_world();
|
||||||
|
auto& container = world->get<inventory::Model>(cont_id);
|
||||||
|
|
||||||
if(container.has(world_entity)) {
|
if(container.has(world_entity)) {
|
||||||
fmt::println("container {} already has entity {}, skip", cont_id, world_entity);
|
fmt::println("container {} already has entity {}, skip", cont_id, world_entity);
|
||||||
|
@ -489,8 +490,9 @@ bool System::place_in_container(World& world, Entity cont_id, const std::string&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void System::remove_from_container(World& world, Entity cont_id, const std::string& slot_id) {
|
void System::remove_from_container(Entity cont_id, const std::string& slot_id) {
|
||||||
auto& container = world.get<inventory::Model>(cont_id);
|
auto world = Game::current_world();
|
||||||
|
auto& container = world->get<inventory::Model>(cont_id);
|
||||||
auto entity = container.get(slot_id);
|
auto entity = container.get(slot_id);
|
||||||
container.remove(entity);
|
container.remove(entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,9 @@ namespace System {
|
||||||
|
|
||||||
void pickup();
|
void pickup();
|
||||||
|
|
||||||
bool place_in_container(World& world, Entity cont_id, const string& name, Entity world_entity);
|
bool place_in_container(Entity cont_id, const string& name, Entity world_entity);
|
||||||
|
|
||||||
void remove_from_container(World& world, Entity cont_id, const std::string& name);
|
void remove_from_container(Entity cont_id, const std::string& name);
|
||||||
void remove_from_world(Entity entity);
|
void remove_from_world(Entity entity);
|
||||||
void inventory_swap(Entity container_id, const std::string& a_name, const std::string &b_name);
|
void inventory_swap(Entity container_id, const std::string& a_name, const std::string &b_name);
|
||||||
bool inventory_occupied(Entity container_id, const std::string& name);
|
bool inventory_occupied(Entity container_id, const std::string& name);
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include "map.hpp"
|
#include "map.hpp"
|
||||||
#include "levelmanager.hpp"
|
#include "levelmanager.hpp"
|
||||||
#include "systems.hpp"
|
#include "game_level.hpp"
|
||||||
|
#include "systems.hpp."
|
||||||
|
|
||||||
using namespace fmt;
|
using namespace fmt;
|
||||||
using namespace nlohmann;
|
using namespace nlohmann;
|
||||||
|
@ -84,9 +85,9 @@ TEST_CASE("dijkstra algo test", "[map]") {
|
||||||
TEST_CASE("map image test", "[map]") {
|
TEST_CASE("map image test", "[map]") {
|
||||||
components::init();
|
components::init();
|
||||||
textures::init();
|
textures::init();
|
||||||
|
Game::init();
|
||||||
|
|
||||||
LevelManager levels;
|
GameLevel level = Game::current();
|
||||||
GameLevel level = levels.current();
|
|
||||||
Matrix map_tiles = matrix::make(7,7);
|
Matrix map_tiles = matrix::make(7,7);
|
||||||
EntityGrid entity_map;
|
EntityGrid entity_map;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "sound.hpp"
|
#include "sound.hpp"
|
||||||
#include "levelmanager.hpp"
|
|
||||||
|
|
||||||
using namespace fmt;
|
using namespace fmt;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue