try to make a window
This commit is contained in:
parent
46ae92d40e
commit
ff653d4cdf
1 changed files with 14 additions and 6 deletions
20
src/main.zig
20
src/main.zig
|
@ -44,8 +44,15 @@ fn toMuKey(sdl_key: i32) u8 {
|
|||
};
|
||||
}
|
||||
|
||||
fn testWindow(ctx: *c.mu_Context) void {
|
||||
if (c.mu_begin_window(ctx, "test", c.mu_rect(350, 40, 300, 200)) != 0) {
|
||||
c.mu_end_window(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
fn processFrame(ctx: *c.mu_Context) void {
|
||||
c.mu_begin(ctx);
|
||||
testWindow(ctx);
|
||||
c.mu_end(ctx);
|
||||
}
|
||||
|
||||
|
@ -97,13 +104,14 @@ pub fn main() anyerror!void {
|
|||
processFrame(ctx);
|
||||
|
||||
c.r_clear(c.mu_color(90, 95, 100, 255));
|
||||
var cmd: [*c]c.mu_Command = null;
|
||||
std.debug.warn("sex\n", .{});
|
||||
var cmd: ?*c.mu_Command = null;
|
||||
while (c.mu_next_command(ctx, &cmd) != 0) {
|
||||
switch (cmd.*.@"type") {
|
||||
c.MU_COMMAND_TEXT => c.r_draw_text(&cmd.*.text.str, cmd.*.text.pos, cmd.*.text.color),
|
||||
c.MU_COMMAND_RECT => c.r_draw_rect(cmd.*.rect.rect, cmd.*.rect.color),
|
||||
c.MU_COMMAND_ICON => c.r_draw_icon(cmd.*.icon.id, cmd.*.icon.rect, cmd.*.icon.color),
|
||||
c.MU_COMMAND_CLIP => c.r_set_clip_rect(cmd.*.clip.rect),
|
||||
switch (cmd.?.@"type") {
|
||||
c.MU_COMMAND_TEXT => c.r_draw_text(&cmd.?.text.str, cmd.?.text.pos, cmd.?.text.color),
|
||||
c.MU_COMMAND_RECT => c.r_draw_rect(cmd.?.rect.rect, cmd.?.rect.color),
|
||||
c.MU_COMMAND_ICON => c.r_draw_icon(cmd.?.icon.id, cmd.?.icon.rect, cmd.?.icon.color),
|
||||
c.MU_COMMAND_CLIP => c.r_set_clip_rect(cmd.?.clip.rect),
|
||||
else => {},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue