Refactor before working on animations sending events.
This commit is contained in:
parent
8b1f288fce
commit
63260f01b9
7 changed files with 10 additions and 42 deletions
27
scene.cpp
27
scene.cpp
|
|
@ -101,10 +101,6 @@ namespace scene {
|
|||
}
|
||||
|
||||
for(auto& actor : $actors) {
|
||||
if(actor.effect != nullptr) {
|
||||
dbc::log(fmt::format("ACTOR {} SHADER {}", actor.name, (void*)actor.effect.get()));
|
||||
}
|
||||
|
||||
view.draw(*actor.st.sprite, actor.effect.get());
|
||||
if(actor.anim.playing) view.draw(actor.text);
|
||||
}
|
||||
|
|
@ -172,29 +168,6 @@ namespace scene {
|
|||
$camera.play();
|
||||
}
|
||||
|
||||
std::pair<Element&, Element&> Engine::left_right(const std::string &actor, const std::string &target) {
|
||||
auto& first = actor_config(actor);
|
||||
auto& second = actor_config(target);
|
||||
|
||||
if(first.pos.x < second.pos.x) {
|
||||
// first is left
|
||||
return {first, second};
|
||||
} else if(first.pos.x == second.pos.x) {
|
||||
auto fb = first.st.sprite->getGlobalBounds();
|
||||
auto sb = second.st.sprite->getGlobalBounds();
|
||||
|
||||
// use the widest one as right
|
||||
if(fb.size.x >= sb.size.x) {
|
||||
return {first, second};
|
||||
} else {
|
||||
return {second, first};
|
||||
}
|
||||
} else {
|
||||
// second is left
|
||||
return {second, first};
|
||||
}
|
||||
}
|
||||
|
||||
void Engine::zoom(const std::string &actor, const std::string& style, float scale) {
|
||||
auto& config = actor_config(actor);
|
||||
auto bounds = config.st.sprite->getGlobalBounds();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue