mirror of
https://github.com/fairyglade/ly.git
synced 2026-05-13 18:40:46 +00:00
Add Widget.calculateTimeout function
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -312,6 +312,7 @@ start_pos: IVec2,
|
||||
full_color: bool,
|
||||
animate: *bool,
|
||||
timeout_sec: u12,
|
||||
frame_delay: u16,
|
||||
frame_time: u32,
|
||||
time_previous: i64,
|
||||
is_color_format_16: bool,
|
||||
@@ -373,6 +374,7 @@ pub fn init(
|
||||
full_color: bool,
|
||||
animate: *bool,
|
||||
timeout_sec: u12,
|
||||
frame_delay: u16,
|
||||
) !DurFile {
|
||||
var dur_movie: DurFormat = .init(allocator);
|
||||
|
||||
@@ -414,6 +416,7 @@ pub fn init(
|
||||
.full_color = full_color,
|
||||
.animate = animate,
|
||||
.timeout_sec = timeout_sec,
|
||||
.frame_delay = frame_delay,
|
||||
.dur_movie = dur_movie,
|
||||
.frame_time = frame_time,
|
||||
.is_color_format_16 = eql(u8, dur_movie.colorFormat.?, "16"),
|
||||
@@ -431,6 +434,7 @@ pub fn widget(self: *DurFile) Widget {
|
||||
draw,
|
||||
update,
|
||||
null,
|
||||
calculateTimeout,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -508,3 +512,7 @@ fn update(self: *DurFile, _: *anyopaque) !void {
|
||||
self.animate.* = false;
|
||||
}
|
||||
}
|
||||
|
||||
fn calculateTimeout(self: *DurFile, _: *anyopaque) !?usize {
|
||||
return self.frame_delay;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user