blob: 0bfbe60a9165160791fac0b1426d9cd8e4cc7623 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
const std = @import("std");
const zxc = @import("zxc.zig");
pub fn main() !void {
var z = try zxc.init(.{
.width = 400,
.height = 224,
.target_fps = 60,
});
defer z.deinit();
var score: usize = 0;
while (!z.shouldQuit()) {
z.cycleEvents();
if (z.getKey(.space) == .pressed) {
score += 1;
std.log.info("score: {}", .{score});
}
try z.drawBegin();
try z.drawSetColor(.{ .r = 1, .g = 0, .b = 1 });
try z.drawClear();
try z.drawSetColor(.{ .r = 0, .g = 0, .b = 0 });
try z.drawRectangle(.{
.x = 12,
.y = 25,
.w = 32,
.h = 16,
.fill = true,
});
try z.drawEnd();
}
}
|