#include "map_view.hpp" #include #include #include "dbc.hpp" #include "components.hpp" #include "rand.hpp" #include "animation.hpp" #include "rand.hpp" namespace gui { using namespace components; MapViewUI::MapViewUI(GameLevel &level) : $level(level) { $gui.position(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); $gui.layout( "[*%(100,900)left|*%(200,900)map_grid| _]" "[_ | _ | _]" "[_ | _ | _]" "[_ | _ | _]" "[_ | _ | _]" "[_ | _ | _]" "[_ | _ | _]" "[_ | _ | _]" "[_ | _ | _]" "[bottom_status_left | bottom_status_right ]"); auto cell = $gui.cell_for($gui.entity("map_grid")); $grid.position(cell.x, cell.y, cell.w, cell.h); $grid.layout( "[cell_11|cell_12|cell_13|cell_14|cell_15|cell_16|cell_17]" "[cell_21|cell_22|cell_23|cell_24|cell_25|cell_26|cell_27]" "[cell_31|cell_32|cell_33|cell_34|cell_35|cell_36|cell_37]" "[cell_41|cell_42|cell_43|cell_44|cell_45|cell_46|cell_47]" "[cell_51|cell_52|cell_53|cell_54|cell_55|cell_56|cell_57]"); } void MapViewUI::update_level(GameLevel &level) { $level = level; } void MapViewUI::init() { $gui.world().set_the({$gui.$parser}); for(auto& [name, cell] : $gui.cells()) { auto box = $gui.entity(name); if(name != "map_grid") { $gui.set(box, {}); $gui.set(box, {name}); } } $gui.init(); for(auto& [name, cell] : $grid.cells()) { auto box = $grid.entity(name); $grid.set(box, {}); $grid.set(box, {name}); } $grid.init(); } void MapViewUI::render(sf::RenderWindow &window) { $gui.render(window); $grid.render(window); } }