Slightly refactor resolution check

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion
2024-08-05 18:33:22 +02:00
parent 5e85618730
commit 4e40e32f59

View File

@@ -347,18 +347,11 @@ pub fn main() !void {
const width: usize = @intCast(termbox.tb_width());
const height: usize = @intCast(termbox.tb_height());
if (width != buffer.width) {
buffer.width = width;
resolution_changed = true;
}
if (height != buffer.height) {
buffer.height = height;
resolution_changed = true;
}
if (width != buffer.width or height != buffer.height) {
// If it did change, then update the cell buffer, reallocate the current animation's buffers, and force a draw update
if (resolution_changed) {
buffer.width = width;
buffer.height = height;
buffer.buffer = termbox.tb_cell_buffer();
switch (config.animation) {
@@ -372,6 +365,7 @@ pub fn main() !void {
}
update = true;
resolution_changed = true;
}
}