#include "map_view.hpp" #include #include #include "dbc.hpp" #include "components.hpp" #include "rand.hpp" #include "animation.hpp" #include "systems.hpp" #include "rand.hpp" #include #include namespace gui { using namespace components; MapViewUI::MapViewUI(GameLevel &level) : $level(level), $tiles(level.map->width(), level.map->height()) { } void MapViewUI::update_level(GameLevel &level) { $level = level; } void MapViewUI::init(int x, int y, int w, int h) { $gui.position(x, y, w, h); $gui.layout("[map_grid]"); auto grid = $gui.entity("map_grid"); $gui.set(grid, {L"Loading...", 45, ColorValue::DARK_LIGHT, 10}); $gui.set(grid, {"paper_ui_background"}); $gui.init(); } void MapViewUI::render(sf::RenderWindow &window) { $tiles = $level.map->tiles(); auto grid = $gui.entity("map_grid"); std::wstring map_out = System::draw_map($level, 13, 6); auto& map_text = $gui.get(grid); map_text.update(map_out); $gui.render(window); } }