Skip to content

Commit

Permalink
update dray nuklear version
Browse files Browse the repository at this point in the history
  • Loading branch information
redthing1 committed Jul 15, 2024
1 parent ab650d3 commit b29250c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion demo/nuidemo/dub.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ authors "no"
copyright "Copyright © 2022, no"
license "proprietary"
dependency "reng" path="../.."
dependency "dray-nuklear" version="~>0.5.2"
dependency "dray-nuklear" version="~>0.5.3"
subConfiguration "dray-nuklear" "debug"
16 changes: 15 additions & 1 deletion demo/nuidemo/source/gui_root.d
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import re.util.interop;

import raylib;
import raylib_nuklear;
import nuklear_ext;
import style;

import std.array;
Expand All @@ -20,6 +19,21 @@ import std.string;
enum UI_FS = 16;
enum UI_UI_PAD = 4;

// utility to draw tabs for nuklear
int nk_tab(nk_context* ctx, const char* title, int active) {
auto f = cast(nk_user_font*) ctx.style.font;
float text_width = f.width(f.userdata, f.height, title, nk_strlen(title));
float widget_width = text_width + 3 * ctx.style.button.padding.x;
nk_layout_row_push(ctx, widget_width);
auto c = ctx.style.button.normal;
if (active) {
ctx.style.button.normal = ctx.style.button.active;
}
int r = nk_button_label(ctx, title);
ctx.style.button.normal = c;
return r;
}

class GuiRoot : Component, Renderable2D, Updatable {
mixin Reflect;

Expand Down

0 comments on commit b29250c

Please sign in to comment.