Now have a full map and a mini map, but I think the mini map will stop rendering sometimes.
This commit is contained in:
parent
193d97eb48
commit
322797f787
15 changed files with 120 additions and 36 deletions
26
map_view.cpp
26
map_view.cpp
|
@ -15,8 +15,7 @@ namespace gui {
|
|||
|
||||
MapViewUI::MapViewUI(GameLevel &level) :
|
||||
$level(level),
|
||||
$tiles(level.map->width(),
|
||||
level.map->height())
|
||||
$paper(textures::get("full_screen_paper"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -24,28 +23,37 @@ namespace gui {
|
|||
$level = level;
|
||||
}
|
||||
|
||||
void MapViewUI::init(int x, int y, int w, int h) {
|
||||
$gui.position(x, y, w, h);
|
||||
$gui.layout("[map_grid]");
|
||||
void MapViewUI::init() {
|
||||
//auto top_right = overlay.entity("top_right");
|
||||
//auto cell = overlay.cell_for(top_right);
|
||||
$gui.position(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
$gui.layout(
|
||||
"[status| *%(200)map_grid | _ ]"
|
||||
);
|
||||
|
||||
auto grid = $gui.entity("map_grid");
|
||||
$gui.set<guecs::WideText>(grid,
|
||||
{L"Loading...", 45, ColorValue::DARK_LIGHT, 10});
|
||||
{L"Loading...", 65, {27, 26, 23, 150}, 10});
|
||||
|
||||
$gui.set<guecs::Sprite>(grid, {"paper_ui_background"});
|
||||
auto status = $gui.entity("status");
|
||||
$gui.set<guecs::Textual>(status,
|
||||
{"Loading...", 25, {37, 36, 33}, 25});
|
||||
|
||||
$paper.sprite->setPosition({0, 0});
|
||||
$gui.init();
|
||||
}
|
||||
|
||||
void MapViewUI::render(sf::RenderWindow &window) {
|
||||
$tiles = $level.map->tiles();
|
||||
window.draw(*$paper.sprite);
|
||||
|
||||
auto grid = $gui.entity("map_grid");
|
||||
|
||||
std::wstring map_out = System::draw_map($level, 13, 6);
|
||||
std::wstring map_out = System::draw_map($level, 23, 9);
|
||||
|
||||
auto& map_text = $gui.get<guecs::WideText>(grid);
|
||||
map_text.update(map_out);
|
||||
|
||||
$gui.render(window);
|
||||
// $gui.debug_layout(window);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue