Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
8d11c1b
Add subpixel API.
itsuhane Jun 16, 2019
7965ce2
Merge pull request #1 from vurtun/master
itsuhane Jun 16, 2019
4aaad16
Merge branch 'master' into subpixel
itsuhane Jun 16, 2019
a61e94e
Add forward-declarations for subpixel-drawing APIs.
itsuhane Jun 16, 2019
e4133b7
Now detecting if memcpy and memset are actually needed. And same goes…
Nielsbishere Dec 4, 2019
0919f70
https://github.com/vurtun/nuklear/pull/803
Nielsbishere Dec 4, 2019
c9980c2
Merge branch 'fix_cpp17' of https://github.com/Nielsbishere/Nuklear i…
Nielsbishere Dec 4, 2019
dc951bf
Problem with existing PR was as follows:
Nielsbishere Dec 4, 2019
11aa9a3
https://github.com/vurtun/nuklear/pull/653 zhouxs1023's Modify the ap…
Nielsbishere Dec 4, 2019
842fd02
Fixed readme
Nielsbishere Dec 4, 2019
f4d97f5
Fixed logical mistake I made in readme
Nielsbishere Dec 4, 2019
014cd2d
Update nuklear_internal.h
Nielsbishere Dec 5, 2019
0de31b9
Update nuklear_util.c
Nielsbishere Dec 5, 2019
be3f371
Repacked nuklear.h and updated package.json
Dec 5, 2019
2c6afa7
Delete package-lock.json
Nielsbishere Dec 5, 2019
31492dc
Merged with fixed_cpp17
Dec 5, 2019
4ede715
Moved ctx to the stack
Dec 5, 2019
8e89387
Merge branch 'fix_click' of https://github.com/Nielsbishere/Nuklear i…
Dec 5, 2019
9f8a941
Merge with fix_click and bump version
Dec 5, 2019
871f277
Update changelog
Dec 9, 2019
15aff92
Fixed indenting and updated changelog
Dec 9, 2019
9b05321
Merge branch 'fix_click' of https://github.com/Nielsbishere/Nuklear i…
Dec 9, 2019
498c3c1
Updated changelog
Dec 9, 2019
7926983
Now refreshing nuklear.h everytime nuklear rebuilds
Nielsbishere Dec 11, 2019
6023f8d
Removing memset and memcpy functions if they don't exist anymore
Nielsbishere Dec 11, 2019
8ca23c3
Memset/memcpy
Nielsbishere Dec 11, 2019
2c6db66
Merge https://github.com/Immediate-Mode-UI/Nuklear into fix_cpp17
Nielsbishere Dec 11, 2019
2a415e8
Updated to work with clang
Nielsbishere Dec 11, 2019
792931d
Moved to linux line endings.
Nielsbishere Dec 12, 2019
9aa9729
Merge branch 'fix_cpp17' of https://github.com/Nielsbishere/Nuklear i…
Nielsbishere Dec 12, 2019
ccafa56
Merge branch 'fix_click' of https://github.com/Nielsbishere/Nuklear i…
Nielsbishere Dec 12, 2019
f7c0f03
Reverted checkboxes to the old looks; because imho it looks better
Nielsbishere Dec 12, 2019
adcadc9
Merge branch 'fix_radio_buttons' of https://github.com/Nielsbishere/N…
Nielsbishere Dec 12, 2019
dfa723e
nk_begin now returns an nk_window, so you can get the location and di…
Nielsbishere Dec 23, 2019
6ddf690
Added a way to callback when a window is closed or minimized.
Nielsbishere Dec 23, 2019
bd71866
nk_add_window now accepts an id instead of a name.
Nielsbishere Dec 23, 2019
1b2b0ee
Merge branch 'subpixel' into feature_return_window_on_begin
Nielsbishere Jan 19, 2020
9d2dea4
Updated package.json and changelog
Nielsbishere Jan 19, 2020
8e3b0ef
Fixed paq picking invalid python and thus failing.
Nielsbishere May 9, 2020
fe2038f
Replaced "NK_ASSERT(0)" With NK_ERROR; because if assert is implement…
Nielsbishere Jul 6, 2020
d5f22aa
Merge branch 'master' of https://github.com/Immediate-Mode-UI/Nuklear…
Nielsbishere Jul 6, 2020
b7eca91
Added a tree type for children without children; to avoid having a tr…
Nielsbishere Jul 6, 2020
88a34cc
Added "nk_tree_push_from_hash" to avoid having to push a const char* …
Nielsbishere Jul 20, 2020
f6ac703
Fixed strict C++20 compile errors.
Nielsbishere Aug 1, 2020
72108de
Merge https://github.com/Immediate-Mode-UI/Nuklear into HEAD
Nielsbishere Dec 15, 2021
4c3562c
Merge https://github.com/Immediate-Mode-UI/Nuklear into HEAD
Nielsbishere Dec 15, 2021
e974b01
Fix build
Nielsbishere Dec 15, 2021
0abaf32
Fix build 2?
Nielsbishere Dec 15, 2021
43b6a84
Fix build 3?
Nielsbishere Dec 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 44 additions & 26 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,37 +59,55 @@ This is very important; not doing it either leads to compiler errors, or even wo
struct nk_context ctx;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why we are updating the example in the readme. IMO readme examples should be very small and give the reader a taste of how nuklear is to use. Not sure this update really makes it any better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shows elements of nuklear that are often going to be used in applications, but I guess it's preference

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually tend to prefer readme examples to be very small. In our case we're pretty much covered by everything in example/ directory. So here I won't advocate for extending the current example.

I'm though fine with extending if it's just about 1-5 SLOC which add and I quote "often used elements". That's not the current case though.

nk_init_fixed(&ctx, calloc(1, MAX_MEMORY), MAX_MEMORY, &font);

enum {EASY, HARD};
static int op = EASY;
enum { EASY, NORMAL, HARD };
static int op = EASY, active[3]{ 1, 0, 1 }, selected{};
static float value = 0.6f;
static int i = 20;

if (nk_begin(&ctx, "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_label(&ctx, "button")) {
/* event handling */
}

/* fixed widget window ratio width */
nk_layout_row_dynamic(&ctx, 30, 2);
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);
{
nk_layout_row_push(&ctx, 50);
nk_label(&ctx, "Volume:", NK_TEXT_LEFT);
nk_layout_row_push(&ctx, 110);
nk_slider_float(&ctx, 0, &value, 1.0f, 0.1f);
}
nk_layout_row_end(&ctx);
static size_t test{};

static char const * biomes[] = {
"Large biome",
"Small biome"
};

static int biomeCount = int(sizeof(biomes) / sizeof(biomes[0]));

if (nk_begin(&ctx, "Show", nk_rect(50, 50, 300, 350),
NK_WINDOW_BORDER|NK_WINDOW_SCALABLE|NK_WINDOW_MOVABLE|NK_WINDOW_TITLE)) {

// fixed widget pixel width
nk_layout_row_static(&ctx, 30, 150, 1);
if (nk_button_label(&ctx, "Play"))
myPlayFunction();

// fixed widget window ratio width
nk_layout_row_dynamic(&ctx, 30, 2);
if (nk_option_label(&ctx, "Easy", op == EASY)) op = EASY;
if (nk_option_label(&ctx, "Normal", op == NORMAL)) op = NORMAL;
if (nk_option_label(&ctx, "Hard", op == HARD)) op = HARD;

nk_layout_row_dynamic(ctx, 30, 2);
nk_checkbox_label(&ctx, "Silver", active);
nk_checkbox_label(&ctx, "Bronze", active + 1);
nk_checkbox_label(&ctx, "Gold", active + 2);

nk_layout_row_dynamic(&ctx, 30, 2);
nk_combobox(&ctx, names, biome_count, &selected, 30, nk_vec2(150, 200));

// custom widget pixel width
nk_layout_row_begin(&ctx, NK_STATIC, 30, 2);
{
nk_layout_row_push(&ctx, 50);
nk_label(&ctx, "Volume:", NK_TEXT_LEFT);
nk_layout_row_push(&ctx, 110);
nk_slider_float(&ctx, 0, &value, 1.0f, 0.1f);
nk_progress(&ctx, &test, 100, 1);
}
nk_layout_row_end(&ctx);
}
nk_end(&ctx);
```
![example](https://cloud.githubusercontent.com/assets/8057201/10187981/584ecd68-675c-11e5-897c-822ef534a876.png)
![example](img/test%20window.png)

## Bindings
There are a number of nuklear bindings for different languages created by other authors.
Expand Down
12 changes: 9 additions & 3 deletions clib.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"name": "nuklear",
"version": "4.09.0",
"version": "4.10.0",
"repo": "Immediate-Mode-UI/Nuklear",
"description": "A small ANSI C gui toolkit",
"keywords": ["gl", "ui", "toolkit"],
"src": ["nuklear.h"]
"keywords": [
"gl",
"ui",
"toolkit"
],
"src": [
"nuklear.h"
]
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not change the formatting of the clib.json. Only bump the version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason? To me it seems easier to read this way

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm indifferent here. But generally speaking if such changes shall further extend big PRs I'd beg everyone to leave them out for the sake of clarity.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would personally also like it to be formatted this way, as then it would be inline with my json formatter (4 spaces would be nice too). If enough people agree, then sure we can change it, but I don't want to end up en a situation where we change the clib.json format in every PR, if you know what I mean :)

14 changes: 13 additions & 1 deletion doc/nuklear.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<meta charset='utf-8' emacsmode='-*- markdown -*-'>
<meta charset='utf-8' emacsmode='-*- markdown -*-'>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What changed on this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure, hopefully not line endings

<link rel='stylesheet' href='https://casual-effects.com/markdeep/latest/apidoc.css?'>
<title>Nuklear</title> <!--Page Title-->
# Nuklear
Expand Down Expand Up @@ -137,6 +137,7 @@
NK_COS | You can define this to 'cosf' or your own cosine implementation replacement. If not nuklear will use its own approximation implementation.
NK_STRTOD | You can define this to `strtod` or your own string to double conversion implementation replacement. If not defined nuklear will use its own imprecise and possibly unsafe version (does not handle nan or infinity!).
NK_DTOA | You can define this to `dtoa` or your own double to string conversion implementation replacement. If not defined nuklear will use its own imprecise and possibly unsafe version (does not handle nan or infinity!).
NK_ERROR | Defined to NK_ASSERT(0 && ...), when an assert always returns false. This is done to allow strict C++17 implementations to keep on working.
NK_VSNPRINTF| If you define `NK_INCLUDE_STANDARD_VARARGS` as well as `NK_INCLUDE_STANDARD_IO` and want to be safe define this to `vsnprintf` on compilers supporting later versions of C or C++. By default nuklear will check for your stdlib version in C as well as compiler version in C++. if `vsnprintf` is available it will define it to `vsnprintf` directly. If not defined and if you have older versions of C or C++ it will be defined to `vsprintf` which is unsafe.
!!! WARNING
The following dependencies will pull in the standard C library if not redefined:
Expand Down Expand Up @@ -2313,6 +2314,17 @@
- [x]: Major version with API and library breaking changes
- [yy]: Minor version with non-breaking API and library changes
- [zz]: Bug fix version with no direct changes to API
- 2020/07/06 (4.04.0) - Added subpixel API from itsuhane. Allowing you to turn on
NK_ENABLE_SUBPIXEL_API to position window and elements in subpixels
Changed nk_begin to return a nk_window so you can get the position and other useful info.
Fixed radio buttons' style.
Fixed click cascading through multiple buttons; it should only click the upper button.
Strict c++17 now compiles: only declaring memset, memcpy if they are used.
Only asserting index range if ushorts are used for indices.
Made paq.sh identical to paq.bat (outputs to nuklear.h).
Replaced NK_ASSERT(0 && ...) with NK_ERROR(), to ensure it compiles on strict C++17.
Replaced const char** by const char * const * in combobox, to ensure const List&lt;const char*&gt; can be used.
Added nk_tree_type for allowing the symbol next to a tree element to be hidden (for children) if it's not an image.
- 2020/04/09 (4.02.1) - Removed unused nk_sqrt function to fix compiler warnings
- Fixed compiler warnings if you bring your own methods for
Comment on lines +2317 to 2329
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. The versioning in here seems quite out of date

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll fix the versioning after we finally know which of the (many) other PRs get merged first.

nk_cos/nk_sin/nk_strtod/nk_memset/nk_memcopy/nk_dtoa
Expand Down
Binary file added img/test window.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading