Структура для анимации

This commit is contained in:
2025-11-17 14:42:42 +03:00
parent 8dd2aa19ad
commit 743b8336a3
5 changed files with 9 additions and 6 deletions

View File

@@ -4,6 +4,6 @@
#include "window.h"
/* Провести один шаг анимации на окне */
void animation_step(struct window_draw_info* draw_info, float speed_multiplier);
void animation_step(struct window_draw_info* draw_info);
#endif

View File

@@ -10,12 +10,15 @@ enum figure_type
FIGURE_SQUARE = 2
};
struct figure_info {
struct figure_animation_info {
enum figure_type type;
struct vec2 position;
struct vec2 velocity;
float rotation;
float rotation_speed;
float angle;
float angular_velocity;
float speed;
};
#endif

View File

@@ -9,7 +9,7 @@ struct window_draw_info {
uint8_t *data;
int32_t width;
int32_t height;
struct figure_info figure;
struct figure_animation_info figure;
pthread_mutex_t figure_mutex;
};

View File

View File

@@ -103,7 +103,7 @@ static void draw(struct wayland_window *win)
// Залочиться, чтобы операции обновления позиции фигуры происходили атомарно
pthread_mutex_lock(&draw_info->figure_mutex);
struct figure_info figure = draw_info->figure;
struct figure_animation_info figure = draw_info->figure;
pthread_mutex_unlock(&draw_info->figure_mutex);
uint32_t color;