Skip to content

Commit

Permalink
Port mu_header
Browse files Browse the repository at this point in the history
  • Loading branch information
ashn-dot-dev committed Oct 29, 2023
1 parent 38cf70a commit 056fe79
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
10 changes: 6 additions & 4 deletions demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ int main(void) {
mu_begin(ctx);

if (mu_begin_window(ctx, "Hello", mu_rect(20, 20, 200, 150))) {
mu_text(ctx, "text");
if (mu_header(ctx, "Header")) {
mu_text(ctx, "text");

mu_checkbox(ctx, "checkbox", &checked);
mu_checkbox(ctx, "checkbox", &checked);

mu_slider(ctx, &slider, 0.0, 100.0);
mu_slider(ctx, &slider, 0.0, 100.0);

mu_number(ctx, &number, 2.0);
mu_number(ctx, &number, 2.0);
}

mu_label(ctx, "Hello, raylib");

Expand Down
10 changes: 6 additions & 4 deletions demo.sunder
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ func main() void {
mu_begin(ctx);

if mu_begin_window(ctx, startof("Hello"), (:mu_Rect){.x = 20, .y = 20, .w = 200, .h = 150}) != 0 {
mu_text(ctx, startof("text"));
if (mu_header(ctx, startof("Header")) != 0) {
mu_text(ctx, startof("text"));

mu_checkbox(ctx, startof("checkbox"), &checked);
mu_checkbox(ctx, startof("checkbox"), &checked);

mu_slider(ctx, &slider, 0.0, 100.0);
mu_slider(ctx, &slider, 0.0, 100.0);

mu_number(ctx, &number, 2.0);
mu_number(ctx, &number, 2.0);
}

mu_label(ctx, startof("Hello, raylib"));

Expand Down
2 changes: 2 additions & 0 deletions microui.sunder
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func mu_button(ctx: *mu_Context, label: *char) sint { return mu_button_ex(ctx, l
func mu_textbox(ctx: *mu_Context, buf: *char, bufsz: sint) sint { return mu_textbox_ex(ctx, buf, bufsz, 0); }
func mu_slider(ctx: *mu_Context, value: *mu_Real, lo: mu_Real, hi: mu_Real) sint { return mu_slider_ex(ctx, value, lo, hi, 0.0, MU_SLIDER_FMT, (:sint)MU_OPT_ALIGNCENTER); }
func mu_number(ctx: *mu_Context, value: *mu_Real, step: mu_Real) sint { return mu_number_ex(ctx, value, step, MU_SLIDER_FMT, (:sint)MU_OPT_ALIGNCENTER); }
func mu_header(ctx: *mu_Context, label: *char) sint { return mu_header_ex(ctx, label, 0); }
func mu_begin_window(ctx: *mu_Context, title: *char, rect: mu_Rect) sint { return mu_begin_window_ex(ctx, title, rect, 0); }

extern func mu_text(ctx: *mu_Context, text: *byte) void;
Expand All @@ -106,6 +107,7 @@ extern func mu_textbox_raw(ctx: *mu_Context, buf: *char, bufsz: sint, id: mu_Id,
extern func mu_textbox_ex(ctx: *mu_Context, buf: *char, bufsz: sint, opt: sint) sint;
extern func mu_slider_ex(ctx: *mu_Context, value: *mu_Real, low: mu_Real, high: mu_Real, step: mu_Real, fmt: *char, opt: sint) sint;
extern func mu_number_ex(ctx: *mu_Context, value: *mu_Real, step: mu_Real, fmt: *char, opt: sint) sint;
extern func mu_header_ex(ctx: *mu_Context, label: *char, opt: sint) sint;
extern func mu_begin_window_ex(ctx: *mu_Context, title: *char, rect: mu_Rect, opt: sint) sint;
extern func mu_end_window(ctx: *mu_Context) void;
extern func mu_open_popup(ctx: *mu_Context, name: *char) void;
Expand Down

0 comments on commit 056fe79

Please sign in to comment.