5#include <entt/entity/entity.hpp>
28 entt::entity
owner = entt::null;
82 std::function<void(context &)>
done{};
139 const tween_desc &desc = {}, entt::entity owner = entt::null);
bool timer_active(const context &ctx, timer_handle timer)
Hẹn giờ còn đang chờ không.
tween_handle tween_tint(context &ctx, entt::entity entity, rgba to, f32 seconds, ease curve=ease::linear, const tween_desc &desc={})
Đổi sprite.tint của entity tới to (cả độ trong suốt).
timer_handle timer_every(context &ctx, f32 interval, std::function< void(context &)> fn, i32 count=-1, const timer_desc &desc={})
Gọi fn mỗi interval giây: sinh quái theo nhịp, hồi máu từ từ.
tween_handle tween_scale(context &ctx, entt::entity entity, f32 to, f32 seconds, ease curve=ease::out_quad, const tween_desc &desc={})
Đổi transform.scale của entity tới to.
void timer_cancel(context &ctx, timer_handle timer)
Hủy một hẹn giờ.
tween_handle tween_rotate(context &ctx, entt::entity entity, f32 to, f32 seconds, ease curve=ease::out_quad, const tween_desc &desc={})
Xoay transform.rot của entity tới to độ.
void tween_cancel_all(context &ctx, entt::entity entity)
Hủy mọi tween đang chạy trên một entity.
timer_handle timer_after(context &ctx, f32 seconds, std::function< void(context &)> fn, const timer_desc &desc={})
Gọi fn một lần sau seconds giây.
tween_handle tween_move(context &ctx, entt::entity entity, vec2 to, f32 seconds, ease curve=ease::out_quad, const tween_desc &desc={})
Dời transform.pos của entity tới to trong seconds giây.
tween_handle tween_value(context &ctx, f32 from, f32 to, f32 seconds, std::function< void(context &, f32)> apply, ease curve=ease::linear, const tween_desc &desc={}, entt::entity owner=entt::null)
Chạy một giá trị từ from tới to và đưa nó cho apply mỗi frame: tween cho bất cứ thứ gì (âm lượng,...
bool tween_active(const context &ctx, tween_handle tween)
Tween còn đang chạy (kể cả đang chờ delay) không.
void tween_cancel(context &ctx, tween_handle tween)
Hủy một tween, giữ nguyên giá trị đang có.
ease
Đường cong chuyển động của tween.
Definition _tween.h:54
@ linear
Đều.
Definition _tween.h:55
@ out_quad
Giảm tốc nhẹ.
Definition _tween.h:57
std::int32_t i32
Số nguyên có dấu 32 bit.
Definition _types.h:14
float f32
Số thực 32 bit.
Definition _types.h:28
std::uint32_t u32
Số nguyên không dấu 32 bit.
Definition _types.h:22
Màu gồm đỏ, xanh lá, xanh dương và alpha.
Definition _types.h:64
Tùy chọn của một hẹn giờ.
Definition njin_timer.h:25
bool keep_across_scenes
Vẫn chạy khi đổi scene.
Definition njin_timer.h:34
entt::entity owner
Gắn với entity này: entity bị hủy thì hẹn giờ tự hủy, không bao giờ gọi hàm với một entity đã chết.
Definition njin_timer.h:28
bool real_time
Tính theo giờ thật: vẫn chạy khi game pause, hitstop hay chạy chậm (menu, UI).
Definition njin_timer.h:31
Định danh của một hẹn giờ, từ timer_after() hoặc timer_every().
Definition njin_timer.h:15
Bộ đếm thời gian: báo khi hết giờ.
Definition _tween.h:12
Tùy chọn của một tween.
Definition njin_timer.h:74
i32 repeat
Số lần lặp thêm sau lần đầu. -1 là mãi mãi.
Definition njin_timer.h:77
f32 delay
Chờ bao lâu trước khi bắt đầu, giây.
Definition njin_timer.h:75
std::function< void(context &)> done
Gọi khi tween chạy xong (không gọi khi bị hủy).
Definition njin_timer.h:82
bool real_time
Tính theo giờ thật, như timer_desc::real_time.
Definition njin_timer.h:80
bool yoyo
Mỗi lần lặp thì đi ngược lại (tới rồi lui), thay vì nhảy về đầu.
Definition njin_timer.h:79
Định danh của một tween chạy trên entity, từ tween_move() và các hàm cùng họ.
Definition njin_timer.h:20
Chuyển mượt một giá trị từ from đến to trong duration giây.
Definition _tween.h:141
Vector 2 chiều. Dùng cho vị trí, kích thước, độ dời.
Definition _types.h:39