|
|
@ -11,6 +11,11 @@ |
|
|
|
#include <iostream> |
|
|
|
#include <iostream> |
|
|
|
#include <fmt/xchar.h> |
|
|
|
#include <fmt/xchar.h> |
|
|
|
#include <fstream> |
|
|
|
#include <fstream> |
|
|
|
|
|
|
|
#include "palette.hpp" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constexpr const int map_width=13; |
|
|
|
|
|
|
|
constexpr const int map_height=13; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace gui { |
|
|
|
namespace gui { |
|
|
|
using namespace components; |
|
|
|
using namespace components; |
|
|
@ -20,8 +25,7 @@ namespace gui { |
|
|
|
$level(level), |
|
|
|
$level(level), |
|
|
|
$map_render(std::make_shared<sf::RenderTexture>()), |
|
|
|
$map_render(std::make_shared<sf::RenderTexture>()), |
|
|
|
$map_sprite($map_render->getTexture()), |
|
|
|
$map_sprite($map_render->getTexture()), |
|
|
|
$map_tiles(matrix::make(12,10)), |
|
|
|
$map_tiles(matrix::make(map_width, map_height)) |
|
|
|
$paper(textures::get("full_screen_paper")) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -31,16 +35,14 @@ namespace gui { |
|
|
|
|
|
|
|
|
|
|
|
void MapViewUI::init() { |
|
|
|
void MapViewUI::init() { |
|
|
|
$gui.position(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); |
|
|
|
$gui.position(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); |
|
|
|
$gui.layout( |
|
|
|
$gui.layout("[log_view| *%(200)map_grid | _ ]"); |
|
|
|
"[log_view| *%(200)map_grid | _ ]" |
|
|
|
$gui.set<Background>($gui.MAIN, {$gui.$parser, palette::get("tiles/fg:wall_plain")}); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$log_to = $gui.entity("log_view"); |
|
|
|
$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 = lel::center(MAP_TILE_DIM * map_width, MAP_TILE_DIM * map_height, $gui.cell_for("map_grid")); |
|
|
|
|
|
|
|
|
|
|
|
auto map_cell = $gui.cell_for("map_grid"); |
|
|
|
|
|
|
|
$map_sprite.setPosition({(float)map_cell.x, (float)map_cell.y + 30}); |
|
|
|
$map_sprite.setPosition({(float)map_cell.x, (float)map_cell.y + 30}); |
|
|
|
|
|
|
|
|
|
|
|
$gui.init(); |
|
|
|
$gui.init(); |
|
|
@ -56,16 +58,12 @@ namespace gui { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MapViewUI::render(sf::RenderWindow &window, int compass_dir) { |
|
|
|
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::draw_map($level, $map_tiles, $entity_map, compass_dir); |
|
|
|
|
|
|
|
|
|
|
|
System::render_map($map_tiles, $entity_map, *$map_render); |
|
|
|
System::render_map($map_tiles, $entity_map, *$map_render); |
|
|
|
|
|
|
|
|
|
|
|
$map_sprite.setTexture($map_render->getTexture(), true); |
|
|
|
$map_sprite.setTexture($map_render->getTexture(), true); |
|
|
|
window.draw($map_sprite); |
|
|
|
window.draw($map_sprite); |
|
|
|
|
|
|
|
|
|
|
|
$gui.render(window); |
|
|
|
|
|
|
|
// $gui.debug_layout(window);
|
|
|
|
// $gui.debug_layout(window);
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|