This commit fixes a stupid reallocation bug I had inside the library.
Basically I get a pointer inside a growing buffer which can be
invalidated by a second allocation and regrowth of said buffer.
Under normal circumstances I do not do this but in one instance I
actually did. That is for allocation temporary normals. This issue
should now be fixed and work correctly.
This fixes some small harmless unitialized variable access violations
found by either valgrind or ASAN. Nothing really ground breaking but
still cleaner.
Previously you had to first activate a window by clicking if it was
visually blocked by another window to move it around which was a
little bit blocky. It should now be possible to directly move and
activate a window.
Previously buttons would show up as hovered if another widget was
being hovered in another window. This behavior is now fixed and
everything should work correctly now.
Fixed some non-portable implementation details inside window and
table memory pool which could cause problems for platforms other
than x86/x64 and fixed some strict aliasing problems.
Tables inside windows get removed if a windows is not longer in use
inside `nk_free_window`. But I noticed that they are only removed
if they were not used the last frame, because of a copy & paste bug.
I removed the additional check and every table should now rightfully
be marked as free. I don't know if this bug actually caused any
problems, since I checked memory consumption and there were no
symptoms of wrong behavior before.
This patch hacks the chart API to support display of multiple data sets in a
single chart instances. Tested briefly with the line chart.
Signed-off-by: Jan Viktorin <iviktorin@fit.vutbr.cz>
Previously I only used the `__FILE__` and a user `ID` to make
sure to get an unqiue identifier out of it. Like @ands pointed out
this is not enough. Since it is possible to have multipe instances
with the same `title` in the same `__FILE__`. So to fix that I had
the idea to string concat `__FILE__` and `__LINE__` into a string.
This allows to have the same sequence of `IDs` in different places
in one `__FILE__`.
Previously it was not possible to check if currently any window or
widget is active. To fix that I added function `nk_item_any_active`.
To get correct result you should only call it after all UI code
ran but before calling `nk_clear`. There is currently no other way to
achive the same result inside UI code.
It is now possible to control button click behavior to trigger either
on button pressed or button released. By default nuklear now used
on button pressed but `#define NK_BUTTON_TRIGGER_ON_RELEASE` lets
you change button behavior to trigger on release. I furthermore
enhanced slider dragging behavior to not force you to hover the
slider at all times.
Editfield width inside properties were previously calculate by text
length + padding and always the size of the edit cursor, even in case
were no one is editing the property. Now the cursor size is only
added while editing.
Fixed a small copy & paste error which pushes the wrong texture
into an empty draw list. In normal cases this never occurs but is
still a big if used independent of libraries use cases.
`nk_tree__push` was not supposed to be seen as private but more like
the more extended way of handling duplicate tree elements. But I used
double underscore which is the general indicator for private. I renamed
it know to nk_tree_push_id, to hopefully make it clearer.
This commit fixes a bug that occurs if you move the cursor inside
text and then back to the end of the text and insert a character.
Caused was the bug by an incorrect check if the cursor is at the
end of the string.
Previously if you use `nk_edit_string` and use flag
`NK_EDIT_CLIPBOARD`, callbacks were not passed. I only tested it with
`nk_edit_buffer` and set the callbacks directly. This wrong behavior
is now fixed and should work copy & paste should behave correctly.
I previously used a conditional style so I don't have to compare
floats directly with eachother because of warning. This caused some
bugs and I now reverted back all conditions back to normal.
In addition I oversampled the default font to make it look better.
Thanks to @codemeow I fixed some bugs and warnings found with
cppcheck. NOTE: it seems like all static analyzer fail to
detect the assert macro or hate combining assert ans if checks.
Some minor issues: an unused variable, fixed a comparison of int against
float, and a pragma warning (pop) that didn't have a matching pragma
warning (push). Potentially more serious was a possible buffer overrun,
where a pointer was being tested against a null terminator, instead of
the char it points to.
There were a few casts from void * missing causing problems when
compiling as C++, also the assert function from <assert.h> was being
used instead of NK_ASSERT(...) in one place.
Fixed window movement for windows without header and some small
wrong calculation inside the panel layout code. In addition I
added another example implementing a simple calculator.
This is the first release version of nuklear (previously: zahnrad).
As for those who no the old version will notice: a lot has changed.
Most obvious should be the two biggest changes. First the name change
because I got critique that the name is hard to comprehend and
remember (understandable for non-germans) and the second is the
transistion from four files (zahnrad.h, zahnrad.c, stb_truetype
and stb_rect_pack) to one single header library file nuklear.h.
I am not 100% convinced that using a single header library is the
right choice here but so far I haven't encountered any problems.
Noticable should be as well that nuklear now directly embeds three
stb libraries: stb_truetype, stb_rect_pack and stb_textedit. Like
in previous versions the first two are optional and the library
can be compiled without. stb_textedit on the other hand powers
the text edit implementation for single as well as multiline
text manipulation. The text edit implementation is still relative
new and untested so you can expect some bugs I have not found yet.
In the demo department a lot changed as well. All platform demos
now don't compile one big demo but instead contain a simple
demo and small abstraction layer over the platform. Main benefit is
better understandablity improved ease of use. The old demo
is now split up and transfered into the example folder while each part
is self contained and compileable. (All examples use glfw I don't now
if this is the best platform but it is at least the simplest.
I also removed the apple demo because I don't have an apple system
and cannot make sure the new version runs with the old version.
Finally a lot of small bugs have been fixed as well as bugs found by
clang analyzer and coverity.