Fixed the way scene updates, but it's still not connecting the ticks to the updates in animation.
This commit is contained in:
parent
32e9c65331
commit
0c798c9e0d
3 changed files with 4 additions and 13 deletions
|
|
@ -89,8 +89,7 @@ namespace boss {
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI::update() {
|
void UI::update() {
|
||||||
$arena.tick();
|
$arena.update();
|
||||||
$arena.play_animations();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UI::mouse(float x, float y, Modifiers mods) {
|
bool UI::mouse(float x, float y, Modifiers mods) {
|
||||||
|
|
|
||||||
11
scene.cpp
11
scene.cpp
|
|
@ -1,6 +1,5 @@
|
||||||
#include "scene.hpp"
|
#include "scene.hpp"
|
||||||
#include "animate2.hpp"
|
#include "animate2.hpp"
|
||||||
#include <ranges>
|
|
||||||
#include "shaders.hpp"
|
#include "shaders.hpp"
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
#include "dbc.hpp"
|
#include "dbc.hpp"
|
||||||
|
|
@ -132,6 +131,7 @@ namespace scene {
|
||||||
inline void this_is_stupid_refactor(std::vector<Element>& elements) {
|
inline void this_is_stupid_refactor(std::vector<Element>& elements) {
|
||||||
for(auto& element : elements) {
|
for(auto& element : elements) {
|
||||||
if(element.anim.playing) {
|
if(element.anim.playing) {
|
||||||
|
auto [ticks, alpha] = element.anim.commit();
|
||||||
element.anim.update();
|
element.anim.update();
|
||||||
element.anim.motion(*element.st.sprite, element.pos, element.scale);
|
element.anim.motion(*element.st.sprite, element.pos, element.scale);
|
||||||
element.anim.apply(*element.st.sprite);
|
element.anim.apply(*element.st.sprite);
|
||||||
|
|
@ -140,7 +140,7 @@ namespace scene {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::play_animations() {
|
void Engine::update() {
|
||||||
this_is_stupid_refactor($fixtures);
|
this_is_stupid_refactor($fixtures);
|
||||||
this_is_stupid_refactor($actors);
|
this_is_stupid_refactor($actors);
|
||||||
}
|
}
|
||||||
|
|
@ -187,11 +187,4 @@ namespace scene {
|
||||||
void Engine::reset(sf::RenderTexture& view) {
|
void Engine::reset(sf::RenderTexture& view) {
|
||||||
$camera.reset(view);
|
$camera.reset(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::tick() {
|
|
||||||
for(auto& actor : $actors) {
|
|
||||||
dbc::log("IDIOT! you need to use the ticks to all update ticks number of times");
|
|
||||||
auto [ticks, alpha] = actor.anim.commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ namespace scene {
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void render(sf::RenderTexture& view);
|
void render(sf::RenderTexture& view);
|
||||||
|
void update();
|
||||||
bool mouse(float x, float y, guecs::Modifiers mods);
|
bool mouse(float x, float y, guecs::Modifiers mods);
|
||||||
void attach_text(const std::string& actor, const std::string& text);
|
void attach_text(const std::string& actor, const std::string& text);
|
||||||
Element config_scene_element(nlohmann::json& config, bool duped);
|
Element config_scene_element(nlohmann::json& config, bool duped);
|
||||||
|
|
@ -49,13 +50,11 @@ namespace scene {
|
||||||
|
|
||||||
void move_actor(const std::string& actor, const std::string& cell_name);
|
void move_actor(const std::string& actor, const std::string& cell_name);
|
||||||
void animate_actor(const std::string& actor, const std::string& form);
|
void animate_actor(const std::string& actor, const std::string& form);
|
||||||
void play_animations();
|
|
||||||
void apply_effect(const std::string& actor, const std::string& shader);
|
void apply_effect(const std::string& actor, const std::string& shader);
|
||||||
Element& actor_config(const std::string& actor);
|
Element& actor_config(const std::string& actor);
|
||||||
void zoom(const std::string& actor, const std::string& style, float scale=0.9f);
|
void zoom(const std::string& actor, const std::string& style, float scale=0.9f);
|
||||||
void zoom(float mid_x, float mid_y, const std::string& style, float scale);
|
void zoom(float mid_x, float mid_y, const std::string& style, float scale);
|
||||||
void reset(sf::RenderTexture& view);
|
void reset(sf::RenderTexture& view);
|
||||||
void set_end_cb(std::function<void()> cb);
|
void set_end_cb(std::function<void()> cb);
|
||||||
void tick();
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue