update example to recent api changes

This commit is contained in:
flederfalter 2016-09-18 02:31:45 +02:00
parent 5f3c1e241b
commit d8718a06b2
1 changed files with 6 additions and 7 deletions

View File

@ -59,19 +59,18 @@ float value = 0.6f;
int i = 20;
struct nk_panel layout;
nk_begin(&ctx, &layout, "Show", nk_rect(50, 50, 220, 220),
NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE);
{
if (nk_begin(&ctx, &layout, "Show", nk_rect(50, 50, 220, 220),
NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE)) {
/* fixed widget pixel width */
nk_layout_row_static(&ctx, 30, 80, 1);
if (nk_button_text(&ctx, "button", NK_BUTTON_DEFAULT)) {
if (nk_button_label(&ctx, "button")) {
/* event handling */
}
/* fixed widget window ratio width */
nk_layout_row_dynamic(&ctx, 30, 2);
if (nk_option(&ctx, "easy", op == EASY)) op = EASY;
if (nk_option(&ctx, "hard", op == HARD)) op = HARD;
if (nk_option_label(&ctx, "easy", op == EASY)) op = EASY;
if (nk_option_label(&ctx, "hard", op == HARD)) op = HARD;
/* custom widget pixel width */
nk_layout_row_begin(&ctx, NK_STATIC, 30, 2);
@ -83,7 +82,7 @@ nk_begin(&ctx, &layout, "Show", nk_rect(50, 50, 220, 220),
}
nk_layout_row_end(&ctx);
}
nk_end(ctx);
nk_end(&ctx);
```
![example](https://cloud.githubusercontent.com/assets/8057201/10187981/584ecd68-675c-11e5-897c-822ef534a876.png)