Now have a full map and a mini map, but I think the mini map will stop rendering sometimes.

This commit is contained in:
Zed A. Shaw 2025-03-23 00:04:23 -04:00
parent 193d97eb48
commit 322797f787
15 changed files with 120 additions and 36 deletions

39
mini_map.cpp Normal file
View 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) {
std::wstring map_out = System::draw_map($level, 5, 3);
$map_grid.update(map_out);
window.draw(*$map_grid.text);
}
}