Move tile implementation to tile.cpp

This commit is contained in:
Jan Mrna 2025-09-27 14:34:52 +02:00
parent 33813c135f
commit e31a45b229
3 changed files with 11 additions and 9 deletions

View File

@ -3,7 +3,7 @@ all: test pathfinding
# TODO linter?
pathfinding:
g++ -Wall -ggdb3 -lSDL3 -lSDL3_image -std=c++23 -lGLEW -lGL -o pathfinding src/main.cpp src/sprite.cpp src/entities.cpp src/gameloop.cpp src/map.cpp src/pathfindingdemo.cpp
g++ -Wall -ggdb3 -lSDL3 -lSDL3_image -std=c++23 -lGLEW -lGL -o pathfinding src/main.cpp src/sprite.cpp src/entities.cpp src/gameloop.cpp src/map.cpp src/pathfindingdemo.cpp src/tile.cpp
test: src/test.cpp src/array.hpp
g++ -Wall -Wextra -Wpedantic -ggdb3 -std=c++23 -lgtest -o test src/test.cpp

View File

@ -0,0 +1,8 @@
#include "tile.hpp"
const std::map<std::string_view, Tile> tile_types = {
{"Grass", {1.0, 0, 200, 0, 255}},
{"Mud", {2.0, 100, 100, 100, 255}},
{"Road", {0.5, 200, 200, 200, 255}},
{"Water", {10.0, 0, 50, 200, 255}},
};

View File

@ -1,18 +1,12 @@
#pragma once
#include <cstdint>
#include <map>
#include <string_view>
#include <cstdint>
struct Tile {
float cost;
uint8_t R, G, B, A;
};
static const std::map<std::string_view, Tile> tile_types = {
{"Grass", {1.0, 0, 200, 0, 255}},
{"Mud", {2.0, 100, 100, 100, 255}},
{"Road", {0.5, 200, 200, 200, 255}},
{"Water", {10.0, 0, 50, 200, 255}},
};
extern const std::map<std::string_view, Tile> tile_types;