The layout is now also coming from the bosses.json file so it's totally configured there.
This commit is contained in:
parent
e5fa76b03c
commit
2d836a9e2a
6 changed files with 27 additions and 17 deletions
20
scene.cpp
20
scene.cpp
|
|
@ -1,5 +1,6 @@
|
|||
#include "scene.hpp"
|
||||
#include "animation.hpp"
|
||||
#include <ranges>
|
||||
|
||||
const bool DEBUG=false;
|
||||
const bool YOU_REMOVED_MID_CELL_IDIOT=false;
|
||||
|
|
@ -9,11 +10,7 @@ namespace scene {
|
|||
|
||||
Element config_scene_element(nlohmann::json& config, bool and_play, bool duped) {
|
||||
std::string sprite_name = config["sprite"];
|
||||
auto st = textures::get_sprite(sprite_name);
|
||||
|
||||
if(duped) {
|
||||
st.sprite = std::make_shared<sf::Sprite>(*st.texture);
|
||||
}
|
||||
auto st = textures::get_sprite(sprite_name, duped);
|
||||
|
||||
float scale_x = config["scale_x"];
|
||||
float scale_y = config["scale_y"];
|
||||
|
|
@ -47,6 +44,10 @@ namespace scene {
|
|||
auto element = config_scene_element(fixture, true, true);
|
||||
$fixtures.push_back(element);
|
||||
}
|
||||
|
||||
for(auto& line : $scene.layout) {
|
||||
$layout.append(line);
|
||||
}
|
||||
}
|
||||
|
||||
void Engine::init() {
|
||||
|
|
@ -55,14 +56,7 @@ namespace scene {
|
|||
auto& background = $ui.get<Background>($ui.MAIN);
|
||||
background.set_sprite($scene.background, true);
|
||||
|
||||
$ui.layout(
|
||||
"[status|boss1 |boss2 |boss3 |boss4 |_]"
|
||||
"[torch1|boss5 |boss6 |boss7 |boss8 |torch2]"
|
||||
"[floor1|boss9 |boss10|boss11|boss12|_]"
|
||||
"[floor2|boss13|boss14|boss15|boss16|_]"
|
||||
"[floor3|player1|player2|player3|player4|_]"
|
||||
"[floor4|player5|player6|player7|player8|_]"
|
||||
);
|
||||
$ui.layout($layout);
|
||||
|
||||
for(auto& actor : $actors) {
|
||||
actor.pos = position_sprite(actor.st, actor.cell,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue