feat: refine screen size based sprite selection
Before this change, medium was selected even for devices that could use the large sprites. I also changed the metric from `framebuffer_size[1]` to `window_size[1]`. This is pixel art with pixels that are designed to be seen. We care more about its size on the screen.dev
parent
dbe5a92b54
commit
a14e5c3839
16
src/main.zig
16
src/main.zig
|
@ -405,23 +405,23 @@ pub fn main() !void {
|
|||
|
||||
_ = canvas.printText(.{ 0, 0 }, "History len: {}", .{history.items.len}, .{});
|
||||
|
||||
switch (framebuffer_size[1]) {
|
||||
0...300 => if (card_tilemap_small == null) {
|
||||
switch (window_size[1]) {
|
||||
0...144 => if (card_tilemap_small == null) {
|
||||
card_tilemap_small = try assets.loadSmallCards(gpa.allocator());
|
||||
},
|
||||
301...1000 => if (card_tilemap_medium == null) {
|
||||
145...299 => if (card_tilemap_medium == null) {
|
||||
card_tilemap_medium = try assets.loadMediumCards(gpa.allocator());
|
||||
},
|
||||
1001...std.math.maxInt(c_int) => if (card_tilemap_large == null) {
|
||||
300...std.math.maxInt(c_int) => if (card_tilemap_large == null) {
|
||||
card_tilemap_large = try assets.loadLargeCards(gpa.allocator());
|
||||
},
|
||||
else => unreachable,
|
||||
}
|
||||
|
||||
const deck_sprites = switch (framebuffer_size[1]) {
|
||||
0...300 => card_tilemap_small.?,
|
||||
301...1000 => card_tilemap_medium.?,
|
||||
1001...std.math.maxInt(c_int) => card_tilemap_large.?,
|
||||
const deck_sprites = switch (window_size[1]) {
|
||||
0...144 => card_tilemap_small.?,
|
||||
145...299 => card_tilemap_medium.?,
|
||||
300...std.math.maxInt(c_int) => card_tilemap_large.?,
|
||||
else => unreachable,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue