Files
sx/examples/issue-0004-defs.sx
2026-02-24 18:17:33 +02:00

19 lines
387 B
Plaintext

#import "modules/std.sx";
Color :: struct {
r, g, b, a: u8;
}
COLOR_WHITE :: Color.{ r = 255, g = 255, b = 255, a = 255 };
// Additional case: struct constant with enum-typed fields
HAlign :: enum { leading; center; trailing; }
VAlign :: enum { top; center; bottom; }
Alignment :: struct {
h: HAlign;
v: VAlign;
}
ALIGN_CENTER :: Alignment.{ h = .center, v = .center };