Floor is now just a fixture.

This commit is contained in:
Zed A. Shaw 2025-10-23 14:12:04 -04:00
parent 23f54bd4fe
commit e5fa76b03c
6 changed files with 20 additions and 25 deletions

View file

@ -20,6 +20,7 @@ namespace scene {
float x = config["x"];
float y = config["y"];
// BUG: need to make animation optional
auto anim = animation::load(sprite_name);
if(and_play) anim.play();
anim.scale_x = scale_x;
@ -42,11 +43,6 @@ namespace scene {
$actor_name_ids.try_emplace(element.name, $actors.size() - 1);
}
// floor is std::optional
if($scene.floor) {
$floor_sprite = textures::get_sprite(*$scene.floor);
}
for(auto& fixture : $scene.fixtures) {
auto element = config_scene_element(fixture, true, true);
$fixtures.push_back(element);
@ -68,10 +64,6 @@ namespace scene {
"[floor4|player5|player6|player7|player8|_]"
);
if($scene.floor) {
position_sprite($floor_sprite, $scene.floor_pos, 1.0f, 1.0f, false);
}
for(auto& actor : $actors) {
actor.pos = position_sprite(actor.st, actor.cell,
actor.scale_x, actor.scale_y, false, actor.x, actor.y);
@ -88,10 +80,6 @@ namespace scene {
}
void Engine::render(sf::RenderWindow& window) {
if($floor_sprite.sprite) {
window.draw(*$floor_sprite.sprite);
}
$ui.render(window);
for(auto& fixture : $fixtures) {
@ -99,7 +87,7 @@ namespace scene {
}
for(auto& actor : $actors) {
window.draw(*actor.st.sprite);
window.draw(*actor.st.sprite);
}
if(DEBUG) $ui.debug_layout(window);