I totally forgot to compile under C++ and only now noticed it.
And there were a lot of C++ specific errors and warning that
creeped into the codebase. Hopefully everything should
compile just fine under C++ now at it does least for GCC and
Clang.
As described in #48 I added optional userdata to zr_context,
zr_command and zr_draw_command. WARNING: I did not extensivly tested
this so any kind of feedback would be great. I also deactivated the
feature my default so to activate it you need to define
`ZR_COMPILE_WITH_COMMAND_USERDATA`. I also thought about deviding it
up into command userdata and draw command userdata but that would
only complicate things further and it is not really neccessary.
zr_strtof did not have a conversion case for negative float values
which caused problems for negative float text input. In addition
zr_filter_decimal had a bug that did not allow '-' as correct input.
Both bugs have been fixed and it should work now.
Previously newlines were drawn inside an edit box if some text was
selected. That bug is now fixed. In addition backspace and delete
had the same result in deleting the current character under the
cursor. Now it has the respectable implementation.
While this commit fixes some issues with newlines they are still
bugged and an absolute pain to debug and fix.
One of the big problems with transparency while using the vertex
buffer output is that repeated overdraw causes artifacts.
Inherintly that is not a problem if there is no overdraw except
zr_widget_field which relies on it for text selection. So I
previously used overdraw for every text, which caused problems.
With this update only zr_widget_field uses overdraw while
every normal text does not.
Decided to add support for commit the content of a edit wiget
content by enter if a flag was set. Tried to add other flags
like auto complete but failed for now to find a good way.
Also more importantly added `zr_edit_box` to filter callback.
One of the big problems with transparency while using the vertex
buffer output is that repeated overdraw causes artifacts.
Inherintly that is not a problem if there is no overdraw except
zr_widget_field which relies on it for text selection. So I
previously used overdraw for every text, which caused problems.
With this update only zr_widget_field uses overdraw while
every normal text does not.
Decided to add support for commit the content of a edit wiget
content by enter if a flag was set. Tried to add other flags
like auto complete but failed for now to find a good way.
Also more importantly added `zr_edit_box` to filter callback.
Previously it was not possible to control the visibility or rather
the transparency of all render vertex buffer output. For that to
change another settings was added to zr_convert_config to control
the visibility. To achieve the same result as previously it is now
required to fill that property with 1.0f. To make all GUI element
as a whole more transparent a value between 0.0 and 1.0 can be
selected with 0.0 being completely hidden and 1.0f completly
visible.
After some thought I decided to turn all examples back into
event based updated UIs. While it is possible to run all
examples without vsync with good performance it is probably best to
keep the examples in a accessable format which makes it possible
to be just by as many people as possible.
Previously all examples used an event based update scheme since
they caused performance issues on Linux. Further testing revealed
that vsync + tripple buffering causes problems and just needs to be
turned off to smoothly run all examples.
Previoulsy if you select text while using the vertex buffer
output inside a single line edit widget you would get a drawing bug
and the selected text would get transparent. This was caused by
overdraw by the selected text while the unselected text is still
visible.
To fix this behavior the text background is cleared before drawing.
This will cost another rectangle for each text which is quite
wasteful. Probably have to think about way to only draw the
rectangle if really necessary.
If a currently active `zr_edit_string` or `zr_edit_buffer` string
buffers is modified outside both of these function then the
controlling cursor could get out of bounds.
To make sure this does not happen anymore I added some check to
make sure cursors are always valid.
Need to revert a previously added change to read only
edit boxes which deactivated the input but thereby
also deactivated the scrollbar behavior which is not
wanted.
Previously if you want to edit the content if a zr_property the
cursor would appear at the beginning of the line which makes
editing the content cumbersome since you then have to move the
cursor to the end of the line to start editing. In addition
it was required to commit the edited value inside the zr_property
by clicking outside the zr_property.
With this commit if you click inside the property to start editing
the cursor will be placed at the end of the text input. In addition
it is now possible to commit written changes by pressing enter.
zr_edit_string and zr_edit_buffer with varying flags did not have the
correct implementation for the read only mode flag and allowed
writing in some instances and showed a cursor while active
for other. Some additional check have been added to make sure that
read only edit buffer cannot be modified anymore.
If you already have stb_rect_pack.h and stb_truetype.h inside your
project zahnrad will cause symbol collisions since it will import
the implementation a second time.
To prevent this from happening I added two defines which can be set
to 1 to disable the implementation generation of both stb_truetype.h
as well as stb_rect_pack.h in zahnrad.