Move the map_view and mini_map into gui as well.
This commit is contained in:
parent
bed5ce22d2
commit
a2246d2b71
6 changed files with 5 additions and 6 deletions
39
gui/mini_map.cpp
Normal file
39
gui/mini_map.cpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include "mini_map.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>
|
||||
#include <memory>
|
||||
|
||||
namespace gui {
|
||||
using namespace components;
|
||||
|
||||
MiniMapUI::MiniMapUI(GameLevel &level) :
|
||||
$map_grid{L"...", 45, {200, 200, 200, 100}, 10},
|
||||
$level(level)
|
||||
{
|
||||
$font = std::make_shared<sf::Font>(FONT_FILE_NAME);
|
||||
}
|
||||
|
||||
void MiniMapUI::update_level(GameLevel &level) {
|
||||
$level = level;
|
||||
}
|
||||
|
||||
void MiniMapUI::init(guecs::UI& overlay) {
|
||||
auto top_right = overlay.entity("top_right");
|
||||
auto cell = overlay.cell_for(top_right);
|
||||
$map_grid.init(cell, $font);
|
||||
}
|
||||
|
||||
void MiniMapUI::render(sf::RenderWindow &window, int compass_dir) {
|
||||
std::wstring map_out = System::draw_map($level, 5, 3, compass_dir);
|
||||
$map_grid.update(map_out);
|
||||
window.draw(*$map_grid.text);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue