Commit Graph

241 Commits

Author SHA1 Message Date
vurtun
bd3fd8300f Pulled panel memory managment into nuklear
I simplified a lot of API calls by pulling panel memory management
inside the library. All API calls which previously required a panel
as parameter are now handling their panel themself.
2016-10-29 23:28:47 +02:00
Micha Mettke
01eb4f88d8 Merge pull request #259 from ettoretorti/ettoretorti-patch-1
Correct NK_MEMCOPY optional define to NK_MEMCPY
2016-10-23 00:17:23 +02:00
vurtun
4020b1bab2 Changed border drawing for widgets
Previously every widget border was drawn by two overlapping rectangles
to limit the number of primitives required to be supported by any
potential backend. The biggest problem from using this approach
is drawing overhead and no real way to get widget transparency. So
I changed border drawing to use stroked rectangles instead of a
second filled rectangle drawing call.
2016-10-21 18:02:41 +02:00
vurtun
867b3359b9 Added functions to manually set edit widget focus
I added function `nk_edit_focus` to set the focus to the next edit
widget that will be called after calling.
2016-10-18 22:27:30 +02:00
Ettore Torti
69221cfd3d Correct NK_MEMCOPY optional define to NK_MEMCPY 2016-10-17 16:07:11 +01:00
Yaroslav Tsarko
26d77f88ff implemented ability to quick compare drawing command buffers
using memcmp and decide whether to draw a new frame or not:
  * added NK_ZERO_COMMAND_MEMORY macro
  * when NK_ZERO_COMMAND_MEMORY is defined, inside
    nk_command_buffer_push function there is an additional call
    to NK_MEMSET after allocating memory for new drawing command
2016-10-05 10:11:07 +03:00
vurtun
4e26fb0949 Fixed edit widget UTF-8 cursor drawing bug 2016-09-29 14:51:57 +02:00
vurtun
d370ef9bd1 Fixed edit widget UTF-8 text input 2016-09-28 19:58:37 +02:00
vurtun
3977145137 Fixed drawing bug inside edit box for UTF text 2016-09-28 18:28:25 +02:00
vurtun
3b89835533 Fixed font base85 decoding for trigraphs 2016-09-23 10:13:17 +02:00
vurtun
0fef9148fc Fixed color button size calculation 2016-09-20 18:28:20 +02:00
vurtun
ea47c24c28 Removed <stdio.h> fro NK_INCLUDE_STANDARD_VARARGS 2016-09-20 17:17:19 +02:00
vurtun
81d8d689cf Additional behavior fixes for nk_vsnprintf 2016-09-20 00:12:19 +02:00
vurtun
34ddd97c03 Removed test code 2016-09-19 19:12:02 +02:00
vurtun
85b7c7b7f3 Extend nk_strfmt to conform more to C standard 2016-09-19 18:47:34 +02:00
vurtun
7b71cbf03b Fixed NK_VSNPRINTF macro for vsnprintf 2016-09-19 10:46:19 +02:00
vurtun
1e2fadd46b Fixed small typo in standard library version check 2016-09-19 10:08:48 +02:00
vurtun
43a8e246be changed #if to #ifdef 2016-09-18 19:57:19 +02:00
vurtun
b0e2dba52c Fixed C89 error caused by missing vsnprintf
For more information please look inside the changelog. This is more of
an internal fix and hopefully does not break any existing code. I also
removed `nk_strfmt` from the API and made it internal only.
2016-09-18 19:49:52 +02:00
vurtun
5f3c1e241b Fixed popup close to deeper panel level
If you had any kind of popups like for example comboboxes inside a
deeper panel structure using nk_group, then `nk_xxx_close` would only
unblock input for the first level and not the whole panel stack. This is
now fixed and works correctly.
2016-09-16 10:44:45 +02:00
vurtun
00ab109855 Fixed C++ errors and internal selection padding 2016-09-16 10:09:26 +02:00
vurtun
85d109e351 Fixed non-blocking popup closing behavior
This is a breaking change which fixes bad closing behavior in
non-blocking popups. If the maximum size of a non-blocking popup was
not reached and you clicked to close the popup under it could happen
that it wouldn't be closed. This is now fixed in combination with
more popup control by allowing to set both the maximum height as
well as popup width.
2016-09-15 18:20:07 +02:00
vurtun
2a888b3098 Added assert to make sur menubar is used correctly
Since it is not as clear on how to use the menubar correctly as I
thought added an assert into `nk_menubar_begin` with explainations on
how to use it correctly and stop wrong ussage.
2016-09-15 10:01:58 +02:00
vurtun
179fddb5de Cleanup type selection and add additional check 2016-09-14 22:46:11 +02:00
vurtun
3d3e63133e Fixed #240 slider behavior is now correct 2016-09-13 19:00:20 +02:00
vurtun
9e6b4f67cc Changes to fix #233 and #238
For more informatio please look inside the issues and for the
actual changes overview please look inside `CHANGELOG.md`
2016-09-08 20:20:02 +02:00
vurtun
4ad73e83c2 Fixed #239 compile flag to add userdata to command 2016-09-07 07:31:43 +02:00
vurtun
929d74a338 Added documentation to warn for #233
Since it was not as apparent as I thought it is I added some
documentation warning to set the same flags each time you
include "nuklear.h" except `NK_IMPLEMENTATION` which is only
allowed to be defined once in *one* source file.
2016-09-04 20:46:23 +02:00
Micha Mettke
d38cd31010 Merge pull request #237 from mlabbe/master
fix visual studio warning C4116
2016-09-04 20:39:02 +02:00
vurtun
98c7376556 Fixed some warning and C89 errors 2016-09-04 20:29:41 +02:00
Michael Labbe
c867184094 fix visual studio warning C4116 2016-09-04 10:39:19 -07:00
vurtun
1d465751c6 Fixed wrong combobox height calculation #224
Functions `nk_combo`, `nk_combo_seperator`, `nk_combo_string`,
`nk_combo_callback`, `nk_combobox`, `nk_combobox_seperator`, `nk_combobox_string`,
`nk_combobox_callback` all calculated the the height of the combo box
panel wrong and forces a scrollbar even if it was not required. The
calculation is now fixed and should produce the right result.
2016-09-04 12:25:31 +02:00
vurtun
7f5d808809 Fixed CPP build
Looks like C++11 does not like conversion from pointer to int.
No problem just set type to `nk_size`.
2016-09-03 18:05:06 +02:00
vurtun
fc832cef07 Fixed gaps in combobox under OpenGL
This is basically a hack to fill the gaps. I have absoultly no idea why
I get some of these gaps but hopefully it is fixed and does not come
back to hunt me in the future.
2016-09-03 12:55:28 +02:00
vurtun
1b9779ce51 Nuklear now allows custom vertex layouts
I removed the default vertex type and instead create an API to allow the
user to specify the vertex struct layout. Of course you are still
bound on what the library actual has on vertex data but the type and
sequence of the data is now configurable. This commit is quite
experiental and could introduce some bugs, but so far it look fine.
2016-09-02 15:33:49 +02:00
vurtun
210bc49b25 Removed unused variables 2016-08-31 20:04:28 +02:00
vurtun
d9b2cf2035 Fixed #227 with API argument name mismatch 2016-08-31 19:38:32 +02:00
vurtun
4cc1778f9c Fixed C++ build errors 2016-08-31 19:29:18 +02:00
vurtun
550a2b03d3 Fixed some bug introduced by last commit and more
This commit fixed some bugs from the last commit as well as some general
changes and fixes of some old bugs. For overview of all changes please
look inside `CHANGELOG.md`.
2016-08-31 19:19:06 +02:00
vurtun
82e35927b4 Removed some internal complexity
This is a rather experiemental commit to remove some internal complexity
that build up over time handling panel padding and border. There still
could be some bugs but I tried my best to keep everything working.
2016-08-30 21:54:10 +02:00
vurtun
ad821dc808 Added additional height parameter to combo box
Added a max height parameter to very retain mode combo box to allow
a fixed height.
2016-08-29 19:40:27 +02:00
vurtun
24f7096acc Added popup mouse scrolling and fix popup drawing
Previously it was only possible to scroll windows and groups by mouse.
No it is possible to scroll popups, as well as nonblocking popups like
menus, contextuals and comboboxes. In addition I fixed a drawing bug
in dynamically growing panels.
2016-08-29 19:20:53 +02:00
vurtun
8e4d8ee741 Added window name string representation
To account for hash collisions which can be quite nasty I added
the string representation of the window name for additional
assurance. I also added an assert to check and alert if two windows
have the same name.
2016-08-26 20:31:33 +02:00
Micha Mettke
abac1878eb Merge pull request #222 from KalenAnson/master
Do not insert a backward delete
2016-08-26 20:02:38 +02:00
vurtun
d4625dc9c1 Added stacks for temporary style/UI changes
It is now possible to temporarily push some style values like color,
style items, font, ... into a stack modify the value and as soon as
you are done just pop the changes. Main benefit is less boilerplate
code to manually save and restore configuration properties.
2016-08-26 19:46:06 +02:00
Kalen Hall
f614b5dc1a Check for incoming backward delete (unicode 127) and do not insert into text box, just process as a text event 2016-08-26 11:08:12 -04:00
vurtun
114757ffa6 Hopefully fixed iOS key up/down issue #215
SDL iOs implementation provides key press and release in
one frame and while nuklear previously was keeping track
of transistions it did not check it. It hopefully should now be
possible to correctly interpret up and down key in the same frame.
2016-08-24 20:37:26 +02:00
vurtun
e69aee6922 Added additional nk_edit flag
Added flag `NK_EDIT_GOTO_END_ON_ACTIVATE` flag to text fields which
cursor jump to the end of the text field when activated.
2016-08-24 20:22:38 +02:00
vurtun
9f60ef2a3b Fixed #218 with invalid assert and condition check 2016-08-24 16:01:43 +02:00
vurtun
9d184a8b91 Fixed ROM-Flag for deeper level of popup parents
No you can have non/block- popups inside nested groups while the parent
groups do not receive any more input which was a bug.
2016-08-16 19:33:33 +02:00
vurtun
9d14e8e3ae Split CHANGELOG into own file
Since the CHANGELOG in `nuklear.h` became bigger and bigger I decided to
split it into it's own file. Probably have to think about a layout.
2016-08-16 17:40:57 +02:00
vurtun
8bf255030a Keep edit field active after enter commit
Edit widget width `NK_EDIT_SIG_ENTER` flag now keep their active
state after enter was pressed. Main reason is to be able to keep
typing after commiting.
2016-08-15 15:07:11 +02:00
vurtun
ce234fc7a7 Removed redundant code 2016-08-15 11:50:40 +02:00
vurtun
01c088e7d8 Fixed negative numbers in nk_strtoi 2016-08-15 11:24:00 +02:00
vurtun
3771eb1dab Changed NK_WINDOW_BACKGROUND behavior
Background windows now get only selected by hovering if no other window
is above it and not on clicks.
2016-08-15 10:34:27 +02:00
vurtun
338eba3d57 Fixed #211 font baking bug with multiple ranges 2016-08-14 18:46:22 +02:00
vurtun
1cc7697d58 Removed unused variables 2016-08-12 20:17:04 +02:00
vurtun
c7c355e55a Added function to check if window is hidden
`nk_window_is_closed` previously checked if the window is hidden
instead of checking if it is closed. This behavior is now fixed and I
added an additional function `nk_window_is_hidden` to check if a
window is currently hidden.
2016-08-12 20:14:42 +02:00
vurtun
02718210e6 Added additional property version for double
Nuklear now has three different property versions for int, float and
added by this commit a double version. Internally an additional change
happend. Now the type of the property is actually taken into account
and floating pointer errors due to casting are less of an issue.
2016-08-12 12:08:13 +02:00
vurtun
427744e57c Added define to replace float to string conversion
Since floating point to and from string conversion is a total pain
and really complex it is really hard to provide a realtive simple
non-standard library solution. But to solve both problems I now added
a way to overwrite the library intern float to string conversion
implementation if you really need more precision.
2016-08-09 21:30:36 +02:00
vurtun
f675cea305 Added define to overwrite nk_strtod
Since nuklear internal string to number conversion is quite imprecise,
and a correct solution is way to complex (I dare you to look at the
implementation of strtod, dtoa, ...) I now provide a new define to
overwrite the library function with either your own or the standard
libray implementation.
2016-08-09 18:33:31 +02:00
vurtun
e7eb366332 Fixed compiling without NK_INCLUDE_FIXED_TYPE 2016-08-09 07:43:45 +02:00
vurtun
a384c6ed80 Fixed possible floating pointer error in nk_widget
Under certain circumstances it is possible that because of floating
point error `nk_widget` will mark a widget as read only if used in
combination with `nk_layout_row`. The fix is rather simple in this
case since the additional floating point precision is not really needed
it is possible to just cast to int and remove the problem all togther.
2016-08-08 20:48:50 +02:00
vurtun
69d8db0f2b Differentiate between closing and hiding a window
There is now a difference between hiding a window with
`nk_window_show` and closing a window by clicking the close button in
the window header or calling `nk_window_close`. Only in the case of
activly closing a window will be removed at the end of the frame
besides getting removed if not updated inside the frame.
2016-08-08 17:01:48 +02:00
vurtun
7635094d27 Added '\0' terminated nk_edit_string version
To support both string formats with string combined with length as
well as zero terminated strings I added a zero terminated string
version to `nk_edit_xxxx` with `nk_edit_string_zero_terminated`.
2016-08-08 12:42:10 +02:00
vurtun
2e66a94de9 Fixed minor scrollbar and panel padding bug
Fixed scrollbar auto hiding behavior to also work correctly if
the window is not hovered or manipulated in any way.
In addition I fixed a small panel padding bug in `nk_layout_widget`
for all panels outside windows which require a test on
`layout->flags` instead of `window->flags`.
2016-08-08 12:08:51 +02:00
vurtun
a0870bd307 Fixed bug in layout API calculating wrong width
The dynamic immediate mode layout API with `nk_layout_row_begin`,
`nk_layout_row_push` and `nk_layout_row_end` caused an infinite
scrollbar bug by wrongfully calculating the required widget sizes.
This bug is now fixed and everything is correctly calculated.
2016-08-07 21:53:20 +02:00
vurtun
f50f83698c Fixed drawing bug inside combobox popup 2016-08-07 21:26:10 +02:00
vurtun
94ca7accdf Version 1.05 split varargs include into own define
Previously I packed standard library variable arguments as well as
file operation into one define `NK_INCLUDE_STANDARD_IO`. This caused
some problems and I split the define into two. So if you want the old
behavior you need to define `NK_INCLUDE_STANDARD_IO` as well as
`NK_INCLUDE_STANDARD_VARARGS`. If you only want file operations but
not variable arguments only define `NK_INCLUDE_STANDARD_IO` and
if you only want varargs but not file operations please only define
`NK_INCLUDE_STANDARD_VARARGS`.
2016-08-06 17:44:00 +02:00
vurtun
f288188a72 Changed overlooked memset calls to NK_MEMSET 2016-08-06 14:36:31 +02:00
vurtun
204a663de7 Fixed fast window scaling behavior
If you move the cursor to fast while scaling a window there is a
chance the mouse will miss the scaler and the scaling operation will
halt. Dragging in itself is quite hard but I implemented the hack I
use for property, window moving and slider for the window scaler and
scaling hopefully now works correctly.
2016-08-04 21:09:31 +02:00
vurtun
2b1c2ca540 Fixed window scaling, movement bug
This is quite an old bug and a result of being nearly stateless.
If you move/scale a window and another window is behind it the other
window will be acitvated and the move/scale operation will be stopped.
To fix this I now require no mouse down for activating by hovering.
I hope this does not cause any problems and fixes the problem for good.
2016-08-04 16:31:44 +02:00
vurtun
100480c6c7 Fixed swapping out fonts
I had a long standing bug inside nuklear which prevents you from
swapping out a font while the code is being build. This bug is now
fixed but the fix requires _ALL_ `nk_user_font` data structures
provided by `nk_style_set_font` to be persistent.
2016-08-04 14:18:29 +02:00
vurtun
7f4e5eb76e Fixed 'NK_WINDOW_BACKGROUND' behavior 2016-08-03 20:21:31 +02:00
vurtun
b251f91107 Fixed multiple crashes in font handling 2016-08-03 16:22:13 +02:00
vurtun
8d5c479db2 Release version 1.04 changes in changelog 2016-08-03 12:01:33 +02:00
vurtun
84b1bbf069 Fixed NK_RGB color picker widget
Removed invalid assert macro which wrongfully triggers if you call
`nk_color_picker` with parameter `NK_RGB`.
2016-08-03 09:50:56 +02:00
vurtun
c87a55cf56 Version 1.04 with seperated window name and title
Added `nk_begin_titled` for seperated window name and title or cases
you need to keep persistent state between frames while changing
the window title.
2016-08-02 10:48:32 +02:00
vurtun
c957b49d04 Moved helper macros inside header guard
A previous push request added some macros into the header file and
I missed that it was outside the header include guard. This should
now be fixed and not cause problem if included multiple times in
different location.
2016-08-01 21:54:41 +02:00
vurtun
3011ef451f Added clipboard as default flag to edit fields
Edit flags are now a default flag for edit field and editors.
2016-07-31 20:35:32 +02:00
vurtun
ebfeeea7e1 Version 1.03 with auto hiding window scrollbars
Window scrollbar will if enabled by window flag hide if no user
interaction happens for a set time duration.
In addition the internal window/table data structs are now located
inside the header part of nuklear to remove the need to allocate a
pool and therefore simplify memory management.
2016-07-29 12:36:51 +02:00
Timothy Qiu
ff00fc00f6 Fixes typos in comments 2016-07-27 09:54:56 +08:00
vurtun
fe1f1530f4 Fixed hole in combobox and window border drawing
Hopefully I finally fixed the hole inside combobox popup which only
occur if you set the window border size greater one. In addition
I fixed some subpixel drawing artifacts that come up if you use
antialising in combination with vertex buffer output.
2016-07-25 16:54:59 +02:00
vurtun
9637af3681 Fixed window border and popup border drawing 2016-07-25 11:58:01 +02:00
vurtun
980889e6f9 Fixed color picker crosshair drawing
The crosshair inside the color picker had some some wrong pixel
measurements. This is now fixed and should look correct.
2016-07-25 09:42:20 +02:00
vurtun
c5614d9098 Release 1.01 changes in changelog in nuklear.h
Breaking changes to the button API, font atlas and added software
cursor to library.
2016-07-16 01:33:37 +02:00
vurtun
d8adeae85f Merge branch 'master' of https://github.com/phoekz/nuklear into phoekz-master 2016-07-15 13:55:29 +02:00
vurtun
0def503980 Fixed NK_INCLUDE_COMMAND_USERDATA flag
Fixed compile error if flag NK_INCLUDE_COMMAND_USERDATA was set.
2016-07-15 13:48:39 +02:00
vurtun
362afc071a Fixed edit scrollbar and ROM flag
I completely forgot to add the edit scrollbar style and
had a incorrect scrollbar bounds calculation. Both bugs
should now be fixed. Furthermore the edit ROM flag know
prevents any manipulating input instead of all input.
So it should be possible to move or copy inside the edit
field but not to modify the content.
2016-07-14 12:56:41 +02:00
vurtun
db4ff5ad93 Merge branch 'ytsarko-master' 2016-07-12 15:48:15 +02:00
vurtun
d49b669db9 Added function to modify window title 2016-07-12 15:47:53 +02:00
vurtun
def4850b49 Merge branch 'master' of https://github.com/ytsarko/nuklear into ytsarko-master 2016-07-12 15:44:23 +02:00
Vinh Truong
383d0f94bd Change popup toggling semantics
For gui elements like tree tabs, tree nodes and windows themselves,
you can repeatedly click the same "minimize" region and it keeps
toggling that element. This was not the case with "popup" type of
elements. This commit slightly changes how the popups close once
they are already open.

Like before, the user can close the popup by just clicking outside
the popups region. Now the user can also close the popup by clicking
the "header" region of the popup.
2016-07-10 10:36:28 +03:00
Vinh Truong
3b50eedba4 Fix nk_input_key to enable keyboard key repeat 2016-07-10 01:43:31 +03:00
Vinh Truong
5b8b9f8832 Fix incorrect printf token in nk_value_format_byte 2016-07-09 23:30:10 +03:00
Vinh Truong
e1655817b8 Fix fading glyphs with global_alpha < 1 2016-07-09 19:06:17 +03:00
Yaroslav Tsarko
e3a29e9fdf Merge remote-tracking branch 'upstream/master' 2016-07-01 09:38:27 +03:00
vurtun
605d59bf8e Fixed #173 draw list clearing bug 2016-06-29 06:54:29 +02:00
vurtun
4d390a9c46 Fixed some code style issues
Enforced the correct code style and tab index width of 4 instead of 2.
2016-06-25 10:39:49 +02:00
vurtun
b82cf7251e Merge branch 'master' of https://github.com/inolen/nuklear into inolen-master 2016-06-25 10:32:55 +02:00