Exploring raycasters and possibly make a little "doom like" game based on it.
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.
 
 
 
 
 
 
raycaster/map_view.cpp

51 lines
1.1 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),
$tiles(level.map->width(),
level.map->height())
{
}
void MapViewUI::update_level(GameLevel &level) {
$level = level;
}
void MapViewUI::init(int x, int y, int w, int h) {
$gui.position(x, y, w, h);
$gui.layout("[map_grid]");
auto grid = $gui.entity("map_grid");
$gui.set<guecs::WideText>(grid,
{L"Loading...", 45, ColorValue::DARK_LIGHT, 10});
$gui.set<guecs::Sprite>(grid, {"paper_ui_background"});
$gui.init();
}
void MapViewUI::render(sf::RenderWindow &window) {
$tiles = $level.map->tiles();
auto grid = $gui.entity("map_grid");
std::wstring map_out = System::draw_map($level, 13, 6);
auto& map_text = $gui.get<guecs::WideText>(grid);
map_text.update(map_out);
$gui.render(window);
}
}