perform required bit hacks to get float animations working properly

This commit is contained in:
Felix Kratz 2023-08-30 18:33:31 +02:00
parent 93f567f775
commit b5e87a352a

View file

@ -77,13 +77,22 @@ static bool animation_update(struct animation* animation, double time_scale) {
} else if (animation->as_float) { } else if (animation->as_float) {
*((float*)&value) = (1. - slider) * *(float*)&animation->initial_value *((float*)&value) = (1. - slider) * *(float*)&animation->initial_value
+ slider * *(float*)&animation->final_value; + slider * *(float*)&animation->final_value;
} else { } else {
value = (1. - slider) * animation->initial_value value = (1. - slider) * animation->initial_value
+ slider * animation->final_value; + slider * animation->final_value;
} }
bool needs_update;
if (animation->as_float) {
needs_update =
((bool (*)(void*, float))animation->update_function)(animation->target,
*((float*)&value) );
} else {
needs_update = animation->update_function(animation->target, value);
}
animation->counter += time_scale; animation->counter += time_scale;
bool needs_update = animation->update_function(animation->target, value);
bool found_item = false; bool found_item = false;
for (int i = 0; i < g_bar_manager.bar_item_count; i++) { for (int i = 0; i < g_bar_manager.bar_item_count; i++) {