128 lines
3.0 KiB
Plaintext
128 lines
3.0 KiB
Plaintext
@startuml
|
|
title Структура классов проекта Wayland
|
|
|
|
class wayland_runtime {
|
|
+ init_wayland() : int32_t
|
|
+ run_window() : int32_t
|
|
+ wait_for_windows() : void
|
|
+ destroy_wayland() : void
|
|
+ get_window_by_surface(surf) : wayland_window*
|
|
--
|
|
- g_display : wl_display*
|
|
- g_slots[MAX_WINDOW_THREADS] : window_thread_slot
|
|
- g_thread_lock : pthread_mutex_t
|
|
- g_active_threads : atomic_int
|
|
- g_shutdown : atomic_bool
|
|
}
|
|
|
|
class window_thread_slot {
|
|
+ thread : pthread_t
|
|
+ aux_thread : pthread_t
|
|
+ active : int
|
|
+ queue : wl_event_queue*
|
|
+ window : wayland_window
|
|
}
|
|
|
|
class wayland_window {
|
|
+ id : int
|
|
+ wl_surface : wl_surface*
|
|
+ xdg_surface : xdg_surface*
|
|
+ xdg_toplevel : xdg_toplevel*
|
|
+ buffer : wl_buffer*
|
|
+ frame_callback : wl_callback*
|
|
+ queue : wl_event_queue*
|
|
+ need_close : int
|
|
+ draw_info : window_draw_info
|
|
--
|
|
+ window_init(display, queue) : int
|
|
+ window_destroy() : void
|
|
+ window_should_close() : int
|
|
}
|
|
|
|
class window_draw_info {
|
|
+ width : uint32_t
|
|
+ height : uint32_t
|
|
+ data : void*
|
|
+ figure : figure_animation_info
|
|
+ figure_mutex : pthread_mutex_t
|
|
}
|
|
|
|
class figure_animation_info {
|
|
+ type : figure_type
|
|
+ position : vec2
|
|
+ velocity : vec2
|
|
+ angle : float
|
|
+ angular_velocity : float
|
|
+ speed : float
|
|
+ radius : float
|
|
}
|
|
|
|
enum figure_type {
|
|
FIGURE_CIRCLE = 0
|
|
FIGURE_TRIANGLE = 1
|
|
FIGURE_SQUARE = 2
|
|
}
|
|
|
|
class registry {
|
|
+ registry_global_bind(display) : int
|
|
+ registry_global_unbind() : void
|
|
+ registry_get_compositor() : wl_compositor*
|
|
+ registry_get_shm() : wl_shm*
|
|
+ registry_get_xdg_wm_base() : xdg_wm_base*
|
|
--
|
|
- global_compositor : wl_compositor*
|
|
- global_shm : wl_shm*
|
|
- global_wm_base : xdg_wm_base*
|
|
- global_registry : wl_registry*
|
|
- global_thread : pthread_t
|
|
- global_thread_running : atomic_int
|
|
}
|
|
|
|
class input {
|
|
+ input_register_seat(seat) : void
|
|
+ input_cleanup() : void
|
|
--
|
|
- seat : wl_seat*
|
|
- keyboard : wl_keyboard*
|
|
- xkb_ctx : xkb_context*
|
|
- xkb_keymap : xkb_keymap*
|
|
- xkb_state : xkb_state*
|
|
- focused_window : wayland_window*
|
|
}
|
|
|
|
class input_handle {
|
|
+ keyboard_key_handle(kc, ks, state, window) : void
|
|
}
|
|
|
|
class figure_animate <<ASM>> {
|
|
+ figure_animation_step(draw_info) : void
|
|
+ place_points_on_circle(...) : void
|
|
--
|
|
- figure_handle_collision(draw_info) : void
|
|
- check_collision_mask(...) : uint64_t
|
|
- sincos_f32_rbp(angle) : (sin, cos)
|
|
}
|
|
|
|
class figure_draw {
|
|
+ figure_draw(draw_info, thickness, border_color, fill_color) : void
|
|
}
|
|
|
|
wayland_runtime "1" *-- "0..128" window_thread_slot
|
|
window_thread_slot "1" *-- "1" wayland_window
|
|
wayland_window "1" *-- "1" window_draw_info
|
|
window_draw_info "1" *-- "1" figure_animation_info
|
|
figure_animation_info --> figure_type
|
|
|
|
wayland_runtime ..> registry : uses
|
|
wayland_runtime ..> input : uses
|
|
wayland_window ..> registry : uses
|
|
wayland_window ..> figure_draw : uses
|
|
|
|
input ..> input_handle : uses
|
|
input --> wayland_window : focuses
|
|
|
|
window_thread_slot ..> figure_animate : uses (aux_thread)
|
|
figure_draw ..> figure_animate : uses
|
|
|
|
@enduml
|