2024-12-22 17:20:31 +00:00
|
|
|
|
|
|
|
Vector2 :: Math.Vector2;
|
|
|
|
|
2024-12-31 13:35:03 +00:00
|
|
|
make_string :: (str: string) -> String {
|
|
|
|
return .{cast(u64, str.count), str.data};
|
|
|
|
}
|
|
|
|
|
|
|
|
UI :: (id: ElementId, layout: LayoutConfig, configs: ..ElementConfig, $call := #caller_code) -> bool #must #expand {
|
|
|
|
_OpenElement();
|
|
|
|
_AttachId(id);
|
|
|
|
_AttachLayoutConfig(_StoreLayoutConfig(layout));
|
|
|
|
for configs _AttachElementConfig(it.config, it.type);
|
|
|
|
_ElementPostConfiguration();
|
|
|
|
|
|
|
|
// TODO Fix the need to have to add the namespace here
|
|
|
|
#insert,scope(call) #code defer Clay._CloseElement();;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// `defer _CloseElement();
|
|
|
|
}
|
|
|
|
|
|
|
|
ID :: (label: string, index: u32 = 0) -> ElementId {
|
|
|
|
return _HashString(make_string(label), index, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
Layout :: (config: LayoutConfig) -> LayoutConfig {
|
|
|
|
// We can just return the config because the layout is attached and stored in the UI function
|
|
|
|
return config;
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle :: (config: RectangleElementConfig) -> ElementConfig {
|
|
|
|
return .{
|
|
|
|
type = .RECTANGLE,
|
|
|
|
config.rectangleElementConfig = _StoreRectangleElementConfig(config)
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
SizingGrow :: (size_min_max: SizingMinMax = .{}) -> SizingAxis {
|
|
|
|
return .{type = .GROW, size = .{minMax = size_min_max}};
|
|
|
|
}
|
|
|
|
|
2024-12-22 17:20:31 +00:00
|
|
|
#scope_module
|
|
|
|
|
|
|
|
Math :: #import "Math";
|
2024-12-31 13:35:03 +00:00
|
|
|
Compiler :: #import "Compiler";
|
|
|
|
ProgramPrint :: #import "Program_Print";
|
2024-12-22 17:20:31 +00:00
|
|
|
|
2024-12-22 10:49:53 +00:00
|
|
|
#if OS == .WINDOWS {
|
|
|
|
#load "windows.jai";
|
|
|
|
} else {
|
2024-12-22 17:20:31 +00:00
|
|
|
assert(false);
|
2024-12-22 10:49:53 +00:00
|
|
|
}
|