Map tiles are generating fine, and I can make a map, now to bring it into the game and see how it works.

master
Zed A. Shaw 5 hours ago
parent 5db3d1a306
commit 3b06105813
  1. 58
      assets/map_tiles.json
  2. BIN
      assets/map_tiles.png
  3. 2
      constants.hpp
  4. 2
      tests/map.cpp
  5. 11
      tools/icongen.cpp

@ -8,121 +8,121 @@
{
"centered": false,
"display": 8284,
"x": 64,
"x": 32,
"y": 0
},
{
"centered": false,
"display": 11590,
"x": 128,
"x": 64,
"y": 0
},
{
"centered": false,
"display": 10899,
"x": 192,
"x": 96,
"y": 0
},
{
"centered": false,
"display": 9256,
"x": 256,
"x": 128,
"y": 0
},
{
"centered": false,
"display": 9608,
"x": 320,
"x": 160,
"y": 0
},
{
"centered": false,
"display": 10747,
"x": 384,
"x": 192,
"y": 0
},
{
"centered": false,
"display": 8285,
"x": 448,
"x": 224,
"y": 0
},
{
"centered": true,
"display": 1003,
"x": 512,
"x": 256,
"y": 0
},
{
"centered": true,
"display": 3848,
"x": 576,
"x": 288,
"y": 0
},
{
"centered": true,
"display": 85,
"x": 0,
"y": 64
"y": 32
},
{
"centered": true,
"display": 8687,
"x": 64,
"y": 64
"x": 32,
"y": 32
},
{
"centered": true,
"display": 10949,
"x": 128,
"y": 64
"x": 64,
"y": 32
},
{
"centered": true,
"display": 8793,
"x": 192,
"y": 64
"x": 96,
"y": 32
},
{
"centered": true,
"display": 95,
"x": 256,
"y": 64
"x": 128,
"y": 32
},
{
"centered": true,
"display": 1898,
"x": 320,
"y": 64
"x": 160,
"y": 32
},
{
"centered": true,
"display": 42586,
"x": 384,
"y": 64
"x": 192,
"y": 32
},
{
"centered": true,
"display": 2189,
"x": 448,
"y": 64
"x": 224,
"y": 32
},
{
"centered": true,
"display": 41981,
"x": 512,
"y": 64
"x": 256,
"y": 32
},
{
"centered": true,
"display": 2220,
"x": 576,
"y": 64
"x": 288,
"y": 32
},
{
"centered": true,
"display": 1218,
"x": 0,
"y": 128
"y": 64
}
]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

@ -15,6 +15,8 @@ constexpr const int RAY_VIEW_Y=0;
constexpr const int GLOW_LIMIT=220;
constexpr const int LIGHT_MULTIPLIER=2.5;
constexpr const float AIMED_AT_BRIGHTNESS=0.2f;
constexpr const int MAP_TILE_DIM=32;
constexpr const int ICONGEN_MAP_TILE_DIM=32;
constexpr const int BOSS_VIEW_WIDTH=1080;
constexpr const int BOSS_VIEW_HEIGHT=SCREEN_HEIGHT;

@ -96,7 +96,7 @@ TEST_CASE("map image test", "[map-sprite]") {
auto &walls = level.map->tiles();
auto &tile_set = textures::get_map_tile_set();
sf::Vector2i size{64,64};
sf::Vector2i size{MAP_TILE_DIM,MAP_TILE_DIM};
matrix::dump("TILES?", walls);
std::unordered_map<wchar_t, sf::Vector2i> sprite_coord;

@ -13,7 +13,6 @@
namespace fs = std::filesystem;
constexpr const int TILE_COUNT=10;
constexpr const sf::Color DEFAULT_COLOR{255, 255, 255, 255};
constexpr const size_t DEFAULT_DIM=64;
using namespace nlohmann;
using namespace shiterator;
@ -85,7 +84,6 @@ struct MapTileBuilder {
void run_real_textures(MapConfig &config) {
sf::Vector2u crop{$size.x * (unsigned int)config.it.width, ($size.y) * ((unsigned int)config.it.y + 1)};
fmt::println("TEXTURE CROP: {},{}; size: {},{}", $size.x, $size.y, crop.x, crop.y);
$render = std::make_shared<sf::RenderTexture>(crop);
$render->clear({0,0,0,0});
@ -154,9 +152,6 @@ struct MapTileBuilder {
dbc::check($size.x - t_size.x >= 0, "font too big on x");
dbc::check($size.y - t_size.y >= 0, "font too big on y");
fmt::println("display: {}, bg: {},{},{},{}; fg: {},{},{},{}",
(int)display_char, bg.r, bg.g, bg.b, bg.a, fg.r, fg.g, fg.b, fg.a);
// draw the background first
background.setFillColor(bg);
@ -223,20 +218,16 @@ void load_config(MapConfig& config, bool is_centered, std::string path, std::fun
if(data.contains("foreground")) {
auto fg_color = data["foreground"];
sf::Color fg{fg_color[0], fg_color[1], fg_color[2]};
fmt::println("TILE {}, display: {} has foreground: {},{},{}", key, (int)display, fg.r, fg.g, fg.b);
config.colors.insert_or_assign(display, fg);
} else {
fmt::println("TILE {}, {} has DEFAULT COLOR", key, (int)display);
config.colors.insert_or_assign(display, DEFAULT_COLOR);
}
if(data.contains("background")) {
auto bg_color = data["background"];
sf::Color bg{bg_color[0], bg_color[1], bg_color[2]};
fmt::println("TILE {} display: {} has background: {},{},{}", key, (int)display, bg.r, bg.g, bg.b);
config.backgrounds.insert_or_assign(display, bg);
} else {
fmt::println("TILE {} display: {} has transparent background", key, (int)display);
sf::Color bg{0, 0, 0, 0};
config.backgrounds.insert_or_assign(display, bg);
}
@ -269,7 +260,7 @@ int main() {
load_config(config, true, "./assets/enemies.json", component_display);
fmt::println("-----------------------------------------");
MapTileBuilder builder(DEFAULT_DIM, DEFAULT_DIM);
MapTileBuilder builder(ICONGEN_MAP_TILE_DIM, ICONGEN_MAP_TILE_DIM);
builder.run(config);
builder.save_image("./assets/map_tiles.png");

Loading…
Cancel
Save