|
|
|
@ -34,7 +34,6 @@ GUI::GUI(DinkyECS::World &world, Map& game_map) : |
|
|
|
|
$log({{"Welcome to the game!"}}), |
|
|
|
|
$status_ui(SCREEN_X, SCREEN_Y, 0, 0), |
|
|
|
|
$map_view(0, 0, GAME_MAP_POS, 0, false), |
|
|
|
|
$modal_test(SCREEN_X/2, SCREEN_Y/4, 800, 200, false), |
|
|
|
|
$view_port{0,0}, |
|
|
|
|
$world(world), |
|
|
|
|
$sounds("./assets"), |
|
|
|
@ -72,25 +71,26 @@ void GUI::create_renderer() { |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
auto modal_buttons = Container::Horizontal({ |
|
|
|
|
Button("OK", [&]{ println("OK pressed"); }), |
|
|
|
|
Button("CANCEL", [&]{ println("CANCEL pressed"); }), |
|
|
|
|
Button("OK", [&]{ $show_modal = false; }), |
|
|
|
|
Button("CANCEL", [&]{ $show_modal = false; }), |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$modal_test.set_renderer(Renderer([&, modal_buttons] { |
|
|
|
|
auto modal_test = Renderer([&, modal_buttons] { |
|
|
|
|
return hbox({ |
|
|
|
|
hflow( |
|
|
|
|
vbox( |
|
|
|
|
text("Hello!"), |
|
|
|
|
modal_buttons->Render() |
|
|
|
|
))}) | border; |
|
|
|
|
})); |
|
|
|
|
}); |
|
|
|
|
modal_test->Add(modal_buttons); |
|
|
|
|
|
|
|
|
|
auto test_button = Container::Horizontal({ |
|
|
|
|
Button("Open Test Modal", [&]{ $show_modal = true; }), |
|
|
|
|
Button("Close It", [&]{ $show_modal = false; }), |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
auto status_rend = Renderer(test_button, [&, test_button, player]{ |
|
|
|
|
auto status_rend = Renderer(test_button, [&, modal_test, test_button, player]{ |
|
|
|
|
const auto& player_combat = $world.get<Combat>(player.entity); |
|
|
|
|
const auto& inventory = $world.get<Inventory>(player.entity); |
|
|
|
|
$status_text = player_combat.hp > 0 ? "NOT DEAD" : "DEAD!!!!!!"; |
|
|
|
@ -118,7 +118,10 @@ void GUI::create_renderer() { |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
status_rend |= Modal(modal_test, &$show_modal); |
|
|
|
|
|
|
|
|
|
$status_ui.set_renderer(status_rend); |
|
|
|
|
$status_ui.add(modal_test); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void GUI::handle_world_events() { |
|
|
|
@ -240,10 +243,6 @@ void GUI::render_scene() { |
|
|
|
|
$renderer.draw_text($status_ui); |
|
|
|
|
$renderer.draw_grid($map_view); |
|
|
|
|
|
|
|
|
|
if($show_modal) { |
|
|
|
|
$renderer.draw_text($modal_test); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$renderer.display(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|