This commit is contained in:
agra
2026-02-14 21:27:51 +02:00
parent 0e777e9d2e
commit e7d2abdf0c
5 changed files with 338 additions and 78 deletions

View File

@@ -277,12 +277,15 @@ GLSL;
if e.key == {
case .escape: running = false;
}
}
case .window_exposed: (e) {
}
case .key_down: (e) {
k : u32 = xx e.key;
print("ts={} wid={} sc={} key={}\n",
e.timestamp, e.window_id, e.scancode, k);
}
}
}
}
@@ -290,7 +293,7 @@ GLSL;
ticks := SDL_GetTicks();
ms : f32 = xx ticks;
angle := ms * 0.001;
// Build matrices
proj : Matrix44 = ---;
mat4_perspective(proj, PI / 4.0, 800.0 / 600.0, 0.1, 100.0);

View File

@@ -15,6 +15,7 @@ field_name :: ($T: Type, idx: s64) -> string #builtin;
field_value :: (s: $T, idx: s64) -> Any #builtin;
is_flags :: ($T: Type) -> bool #builtin;
field_value_int :: ($T: Type, idx: s64) -> s64 #builtin;
field_index :: ($T: Type, val: T) -> s64 #builtin;
string :: []u8 #builtin;
int_to_string :: (n: s64) -> string {
@@ -221,9 +222,9 @@ flags_to_string :: (val: $T) -> string {
enum_to_string :: (u: $T) -> string {
if is_flags(T) { return flags_to_string(u); }
tag := cast(s64) u;
result := concat(".", field_name(T, tag));
payload := field_value(u, tag);
idx := field_index(T, u);
result := concat(".", field_name(T, idx));
payload := field_value(u, idx);
pstr := any_to_string(payload);
if pstr.len > 0 {
result = concat(result, concat("(", concat(pstr, ")")));