You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.4 KiB
59 lines
1.4 KiB
#include "map_view.hpp"
|
|
#include <functional>
|
|
#include <string>
|
|
#include "dbc.hpp"
|
|
#include "components.hpp"
|
|
#include "rand.hpp"
|
|
#include "animation.hpp"
|
|
#include "systems.hpp"
|
|
#include "rand.hpp"
|
|
#include <codecvt>
|
|
#include <iostream>
|
|
|
|
namespace gui {
|
|
using namespace components;
|
|
|
|
MapViewUI::MapViewUI(GameLevel &level) :
|
|
$level(level),
|
|
$paper(textures::get("full_screen_paper"))
|
|
{
|
|
}
|
|
|
|
void MapViewUI::update_level(GameLevel &level) {
|
|
$level = level;
|
|
}
|
|
|
|
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...", 65, {27, 26, 23, 150}, 10});
|
|
|
|
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) {
|
|
window.draw(*$paper.sprite);
|
|
|
|
auto grid = $gui.entity("map_grid");
|
|
|
|
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);
|
|
}
|
|
}
|
|
|