mirror of
https://github.com/Nexoniarz/Finch.git
synced 2026-11-03 08:54:25 +00:00
- finch.toml: name, entry, paths, include, links, libdirs, cflags, ldflags, and [target.windows] etc.;
finch run / build / test with no file use its entry
- import thread: spawn, join, mutex, cpus; atomic_add/sub/load/store/swap/cas built in
- finch fmt [--check]: indentation by { }, trailing spaces, empty lines; also as LSP formatting
- link "x.cpp" (or in finch.toml): built with the C++ compiler, which then links (FINCH_CXX)
- #define RAYWHITE (Color){ 245, 245, 245, 255 } imports as a Color
- push(body) where push takes ptr[Body]: the same as push(addr(body))
- --target android (NDK clang from ANDROID_NDK_HOME, -llog)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016GzNP6r8dg6WDxUVZy8wjL
29 lines
911 B
Text
29 lines
911 B
Text
// C unions (SDL_Event-style) and #defines that are expressions, strings or casts
|
|
import "cunion.h"
|
|
import "stdlib.h"
|
|
link "cunion.c"
|
|
|
|
fn main() {
|
|
print(EV_MOTION, EV_KEY, FLAG_BIG, FLAGS_BOTH, HALF, GREETING, LONG_NAME)
|
|
u64 flags = FLAG_BIG | FLAG_GL
|
|
u32 small = EV_KEY
|
|
print(flags, small)
|
|
|
|
Event e
|
|
if poll_event(addr(e)) != 0 && e.type == EV_MOTION {
|
|
print("motion", e.motion.x, e.motion.y)
|
|
}
|
|
k := Event(key: Key(type: EV_KEY, key: 32))
|
|
print(k.type == EV_KEY, k.key.key)
|
|
[]Event queue
|
|
queue.push(e)
|
|
queue.push(k)
|
|
print(queue[1].key.key, queue.len)
|
|
|
|
Tagged t
|
|
t.as.f = 0.5
|
|
print(t.as.f)
|
|
print(abs(-2.5), abs(-3), min(EV_KEY, 7)) // Finch's abs, not C's int-only one
|
|
bg := RAYWHITE // #define RAYWHITE (Color){ 245, 245, 245, 255 }
|
|
print(bg.r, bg.a, DARK.g, DARK.a, HALF_UP.x, HALF_UP.y)
|
|
}
|