52 lines
1.1 KiB
Plaintext
52 lines
1.1 KiB
Plaintext
@startuml
|
|
title Цикл анимации фигуры (aux_thread)
|
|
|
|
start
|
|
|
|
:aux_thread запущен;
|
|
|
|
while (окно не закрыто?) is (да)
|
|
|
|
:Залочить figure_mutex;
|
|
|
|
:figure_animation_step(draw_info);
|
|
|
|
partition "figure_animation_step (ASM)" {
|
|
:Обработка коллизий;
|
|
note right
|
|
figure_handle_collision():
|
|
- Расчёт точек фигуры на окружности
|
|
- Проверка выхода за границы
|
|
- Инверсия velocity при коллизии
|
|
- Обновление angular_velocity
|
|
end note
|
|
|
|
:Обновить позицию;
|
|
note right
|
|
position += (velocity * speed) / height
|
|
end note
|
|
|
|
:Обновить угол поворота;
|
|
note right
|
|
angle += angular_velocity * speed
|
|
end note
|
|
|
|
:Применить трение к вращению;
|
|
note right
|
|
angular_velocity *= 0.95
|
|
end note
|
|
}
|
|
|
|
:Разлочить figure_mutex;
|
|
|
|
:usleep(33 ms);
|
|
note right: ~30 FPS обновление физики
|
|
|
|
endwhile (нет)
|
|
|
|
:Завершение потока;
|
|
|
|
stop
|
|
|
|
@enduml
|