Commit dcf5cafe authored by Georg Schäfer's avatar Georg Schäfer
Browse files

Add dummy floor tile.

parent b649bab5
Pipeline #3234 passed with stage
in 2 minutes and 20 seconds
{
"Transform": {
"scale": {
"x": 0.5,
"y": 0.5,
"z": 0.5
}
},
"Model": {
"aid": "model:dummy_floor"
}
}
{
"Transform": {
"scale": {
"x": 2.0,
"y": 2.0,
"z": 2.0
}
},
"Model": {
"aid": "model:dummy_floor"
},
"Shadowcaster": {}
}
dummy
##############################
###---------##################
###| |##################
###| p |##################
###| |##################
###| x |##################
###---- ----##################
######| |#####################
######| |#####################
######| |#####################
###---- -----------###########
###| |###########
###| |###########
###| y |###########
###----------------###########
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
##############################
{
"substance_id": "default",
"albedo_aid": "dummy_floor_none.001_albedo.ktx",
"normal_aid": "dummy_floor_none.001_normal.ktx",
"brdf_aid": "dummy_floor_none.001_brdf.ktx",
"emission_aid": ""
}
{
"tile_size": 1,
"tile_size": 4,
"tiles": {
"|": {
"blueprint": "dummy_wall_vertical",
......@@ -16,6 +16,12 @@
"#": {
"blueprint": "dummy_ceiling",
"solid": true
},
"p": {
"blueprint": "dummy_floor",
"solid": false,
"spawn": true,
"spawns": "player"
}
}
}
......@@ -9,10 +9,12 @@
namespace phase_shifter::level {
struct Tile {
std::string blueprint;
bool solid;
bool solid = false;
bool spawn = false;
std::string spawns;
};
sf2_structDef(Tile, blueprint, solid);
sf2_structDef(Tile, blueprint, solid, spawn, spawns);
struct Tileset {
float tile_size;
......
......@@ -14,12 +14,15 @@ namespace phase_shifter::level {
auto& level = _current_level.get_blocking();
auto& tiles = level._tileset->tiles;
auto offset = level._tileset->tile_size / 2.f;
glm::vec3 position;
glm::vec3 position{0.f};
for(auto&& row : level._tiles) {
for(auto&& tile_key : row) {
if(auto tile_it = tiles.find(std::string(1, tile_key)); tile_it != tiles.end()) {
auto& tile = tile_it->second;
_entities.entity_builder(tile.blueprint).position(position).create();
if(tile.spawn) {
_entities.entity_builder(tile.spawns).position(position).create();
}
position.x += offset;
}
}
......
......@@ -104,16 +104,6 @@ namespace phase_shifter {
.create();
entities().entity_builder("player").position({0, 1, 0}).create();
entities()
.entity_builder("cube")
.position({0, 0, 0})
.post_create([=](ecs::Entity_facet entity) {
entity.process<Transform_comp>([&](auto& transform) {
transform.scale = glm::vec3{10.f, 0.01f, 10.f};
});
})
.create();
}
Meta_system::~Meta_system()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment