|
|
@ -13,6 +13,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
namespace gui { |
|
|
|
namespace gui { |
|
|
|
using namespace components; |
|
|
|
using namespace components; |
|
|
|
|
|
|
|
using namespace guecs; |
|
|
|
|
|
|
|
|
|
|
|
MapViewUI::MapViewUI(GameLevel &level) : |
|
|
|
MapViewUI::MapViewUI(GameLevel &level) : |
|
|
|
$level(level), |
|
|
|
$level(level), |
|
|
@ -29,16 +30,15 @@ namespace gui { |
|
|
|
//auto cell = overlay.cell_for(top_right);
|
|
|
|
//auto cell = overlay.cell_for(top_right);
|
|
|
|
$gui.position(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); |
|
|
|
$gui.position(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); |
|
|
|
$gui.layout( |
|
|
|
$gui.layout( |
|
|
|
"[status| *%(200)map_grid | _ ]" |
|
|
|
"[log_view| *%(200)map_grid | _ ]" |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
auto grid = $gui.entity("map_grid"); |
|
|
|
auto grid = $gui.entity("map_grid"); |
|
|
|
$gui.set<guecs::Textual>(grid, |
|
|
|
$gui.set<Textual>(grid, |
|
|
|
{L"Loading...", 65, {27, 26, 23, 150}, 10}); |
|
|
|
{L"Loading...", 65, {27, 26, 23, 150}, 10}); |
|
|
|
|
|
|
|
|
|
|
|
auto status = $gui.entity("status"); |
|
|
|
$log_to = $gui.entity("log_view"); |
|
|
|
$gui.set<guecs::Textual>(status, |
|
|
|
$gui.set<Textual>($log_to, {L"Welcome to the Game!", 25, {37, 36, 33}, 25}); |
|
|
|
{L"Loading...", 25, {37, 36, 33}, 25}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$paper.sprite->setPosition({0, 0}); |
|
|
|
$paper.sprite->setPosition({0, 0}); |
|
|
|
$gui.init(); |
|
|
|
$gui.init(); |
|
|
@ -48,23 +48,33 @@ namespace gui { |
|
|
|
window.draw(*$paper.sprite); |
|
|
|
window.draw(*$paper.sprite); |
|
|
|
|
|
|
|
|
|
|
|
auto grid = $gui.entity("map_grid"); |
|
|
|
auto grid = $gui.entity("map_grid"); |
|
|
|
auto status = $gui.entity("status"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring map_out = System::draw_map($level, 23, 9, compass_dir); |
|
|
|
std::wstring map_out = System::draw_map($level, 23, 9, compass_dir); |
|
|
|
|
|
|
|
|
|
|
|
auto& map_text = $gui.get<guecs::Textual>(grid); |
|
|
|
auto& map_text = $gui.get<Textual>(grid); |
|
|
|
map_text.update(map_out); |
|
|
|
map_text.update(map_out); |
|
|
|
|
|
|
|
|
|
|
|
auto& status_text = $gui.get<guecs::Textual>(status); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::wstring status_out = fmt::format( |
|
|
|
|
|
|
|
L"Level: {}\n" |
|
|
|
|
|
|
|
L"Enemies Killed: A Lot\n", |
|
|
|
|
|
|
|
$level.index + 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
status_text.update(status_out); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$gui.render(window); |
|
|
|
$gui.render(window); |
|
|
|
// $gui.debug_layout(window);
|
|
|
|
// $gui.debug_layout(window);
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MapViewUI::update() { |
|
|
|
|
|
|
|
if($gui.has<Textual>($log_to)) { |
|
|
|
|
|
|
|
auto& text = $gui.get<Textual>($log_to); |
|
|
|
|
|
|
|
//BUG: I'm calling this what it is, fix it
|
|
|
|
|
|
|
|
wstring log_garbage; |
|
|
|
|
|
|
|
for(auto msg : $messages) { |
|
|
|
|
|
|
|
log_garbage += msg + L"\n"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
text.update(log_garbage); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MapViewUI::log(wstring msg) { |
|
|
|
|
|
|
|
$messages.push_front(msg); |
|
|
|
|
|
|
|
if($messages.size() > MAX_LOG_MESSAGES) { |
|
|
|
|
|
|
|
$messages.pop_back(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
update(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|