Подготовлены файлы фигуры

This commit is contained in:
2025-11-17 14:05:42 +03:00
parent c21df94757
commit de18bd8252
5 changed files with 77 additions and 28 deletions

21
wayland/include/figure.h Normal file
View File

@@ -0,0 +1,21 @@
#ifndef FIGURE_H
#define FIGURE_H
#include "geomerty.h"
enum figure_type
{
FIGURE_CIRCLE = 0,
FIGURE_TRIANGLE = 1,
FIGURE_SQUARE = 2
};
struct figure_info {
enum figure_type type;
struct vec2 position;
struct vec2 velocity;
float rotation;
float rotation_speed;
};
#endif

View File

@@ -0,0 +1,9 @@
#ifndef GEOMETRY_H
#define GEOMETRY_H
struct vec2 {
float x;
float y;
};
#endif

View File

@@ -2,6 +2,15 @@
#define WAYLAND_WINDOW_H
#include <wayland-client.h>
#include "figure.h"
struct window_draw_info {
uint8_t *data;
int32_t width;
int32_t height;
uint8_t color;
struct figure_info figure;
};
/* Данные одного Wayland-окна (одна поверхность) */
struct wayland_window {
@@ -12,13 +21,11 @@ struct wayland_window {
struct xdg_surface *xdg_surface;
struct xdg_toplevel *xdg_toplevel;
struct wl_event_queue *queue; /* очередь событий для окна */
uint8_t *data;
int32_t width;
int32_t height;
struct window_draw_info draw_info;
int need_close;
uint8_t color;
};
/* Инициализация окна; структура предоставляется вызывающим */
int window_init(struct wl_display *display, struct wl_event_queue *queue, struct wayland_window *win);