Map now displays way better. The paper is gone for now.
This commit is contained in:
parent
973495b687
commit
3b81959aa9
2 changed files with 12 additions and 15 deletions
|
@ -11,6 +11,11 @@
|
|||
#include <iostream>
|
||||
#include <fmt/xchar.h>
|
||||
#include <fstream>
|
||||
#include "palette.hpp"
|
||||
|
||||
constexpr const int map_width=13;
|
||||
constexpr const int map_height=13;
|
||||
|
||||
|
||||
namespace gui {
|
||||
using namespace components;
|
||||
|
@ -20,8 +25,7 @@ namespace gui {
|
|||
$level(level),
|
||||
$map_render(std::make_shared<sf::RenderTexture>()),
|
||||
$map_sprite($map_render->getTexture()),
|
||||
$map_tiles(matrix::make(12,10)),
|
||||
$paper(textures::get("full_screen_paper"))
|
||||
$map_tiles(matrix::make(map_width, map_height))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -31,16 +35,14 @@ namespace gui {
|
|||
|
||||
void MapViewUI::init() {
|
||||
$gui.position(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
$gui.layout(
|
||||
"[log_view| *%(200)map_grid | _ ]"
|
||||
);
|
||||
$gui.layout("[log_view| *%(200)map_grid | _ ]");
|
||||
$gui.set<Background>($gui.MAIN, {$gui.$parser, palette::get("tiles/fg:wall_plain")});
|
||||
|
||||
$log_to = $gui.entity("log_view");
|
||||
$gui.set<Textual>($log_to, {L"Welcome to the Game!", 25, {37, 36, 33}, 25});
|
||||
$gui.set<Rectangle>($log_to, {10, THEME.DARK_MID, THEME.BORDER_COLOR, 10});
|
||||
$gui.set<Textual>($log_to, {L"Welcome to the Game!", 25, THEME.TEXT_COLOR, 10});
|
||||
|
||||
$paper.sprite->setPosition({0, 0});
|
||||
|
||||
auto map_cell = $gui.cell_for("map_grid");
|
||||
auto map_cell = lel::center(MAP_TILE_DIM * map_width, MAP_TILE_DIM * map_height, $gui.cell_for("map_grid"));
|
||||
$map_sprite.setPosition({(float)map_cell.x, (float)map_cell.y + 30});
|
||||
|
||||
$gui.init();
|
||||
|
@ -56,16 +58,12 @@ namespace gui {
|
|||
|
||||
|
||||
void MapViewUI::render(sf::RenderWindow &window, int compass_dir) {
|
||||
window.draw(*$paper.sprite);
|
||||
$gui.render(window);
|
||||
|
||||
System::draw_map($level, $map_tiles, $entity_map, compass_dir);
|
||||
|
||||
System::render_map($map_tiles, $entity_map, *$map_render);
|
||||
|
||||
$map_sprite.setTexture($map_render->getTexture(), true);
|
||||
window.draw($map_sprite);
|
||||
|
||||
$gui.render(window);
|
||||
// $gui.debug_layout(window);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue