refactor UI function for readability
This commit is contained in:
parent
25dc39b419
commit
c26ef9d4b6
1 changed files with 12 additions and 10 deletions
22
src/root.zig
22
src/root.zig
|
@ -492,17 +492,19 @@ pub const ElementDeclaration = extern struct {
|
|||
};
|
||||
|
||||
pub inline fn UI() fn (config: ElementDeclaration) callconv(.@"inline") fn (void) void {
|
||||
cdefs.Clay__OpenElement();
|
||||
return struct {
|
||||
inline fn f(config: ElementDeclaration) fn (void) void {
|
||||
cdefs.Clay__ConfigureOpenElement(config);
|
||||
return struct {
|
||||
fn f(_: void) void {
|
||||
cdefs.Clay__CloseElement();
|
||||
}
|
||||
}.f;
|
||||
const local = struct {
|
||||
fn CloseElement(_: void) void {
|
||||
cdefs.Clay__CloseElement();
|
||||
}
|
||||
}.f;
|
||||
|
||||
inline fn ConfigureOpenElement(config: ElementDeclaration) fn (void) void {
|
||||
cdefs.Clay__ConfigureOpenElement(config);
|
||||
return CloseElement;
|
||||
}
|
||||
};
|
||||
|
||||
cdefs.Clay__OpenElement();
|
||||
return local.ConfigureOpenElement;
|
||||
}
|
||||
|
||||
pub const getElementData = cdefs.Clay_GetElementData;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue