....
This commit is contained in:
18
examples/issue-0004-defs.sx
Normal file
18
examples/issue-0004-defs.sx
Normal file
@@ -0,0 +1,18 @@
|
||||
#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 };
|
||||
Reference in New Issue
Block a user