Fixes for the X11 backend with XFT fonts from demo/x11_xft:
- fixed some memory leaks by destroying XFT objects during cleanup
- the function to get text width was returning the wrong value
- the clipping space of text boxes was not implemented for XFT
- misc
- Be consistent about reading and writing pixel values to avoid casting/offset madness
- clean up function names for clarity/consistency
- Fix fence post errors preventing get/set pixels from operating on first row/column
- Enforce mutual exclusivity for pixel layout macros
If XftDrawString8() is given non-ASCII UTF-8 string it fails to properly render it.
Using XftDrawStringUtf8() instead seems to be doing the right thing.
Signed-off-by: Sergiy Kibrik <sakib@darkstar.site>
Like these:
main.c: In function ‘main’:
main.c:234:20: error: ‘ctx’ undeclared (first use in this function)
overview(ctx);
^
Signed-off-by: Sergiy Kibrik <sakib@darkstar.site>
The issue was introduced in the fix for 416 (commit 8559aeb).
The original problem was (backspace and arrows moving too fast) is not a
nuklear problem but a GLFW problem. Because of the way nuklear handles
input (it must be between input_begin and end), the key callback method
GLFW offers is not an option.
So we have to use glfwGetKey() which returns the current state of a key
not whether it was just pressed or released, so nuklear acts like it
was pressed every single frame, hence the "too fast" problem.
The fix checks for state change and discards the event if there was
no change. This kills key repeat behavior (for named keys) on
*all* platforms which makes deleting or arrowing inconvenient.
Since there's no way to fix the shortcomings of a callback vs event
based input API, my "fix" just makes the original fix conditional
on a macro NK_KEYSTATE_BASED_INPUT
This implements the GDI Rect Multicolor functions. This will work without
any problems when targetting Windows 2000 and up.
TODO: Fix Alpha blending. The Color Matrix does not render correctly.
Closing a contextual menu by right click caused invalid behavior and
bocking. In addition having consecutive contextual menus and closing an
earlier menu will wrongfully open a following menu. Both are now fixed.
Use the framebuffer pitch to calculate the correct offset.
Fixes garbled rendering on framebuffer that have
pitch != x_resolution * bpp / 8.
The demo application is unaffected as the pitch always aligns with
the x resolution of the window.
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
The software rasterizer is to be used with raw framebuffer
devices, where no GPU or X11 is available.
The demo emulates a raw framebuffer on X11 using XShmImage / XImage.
Features implemented:
* Drawing primitives
* Drawing polygons (using Darel Rex Finley algorithm)
* Drawing arcs and circles (using Bresenham's elipses algorithm)
* Drawing images using nearest filtering
* Bounds check on every operation
* Fastpath for lines
* Font rendering using nearest filtering
* Window resize
* Thread safe implementation by using a context
* Fixed lower and upper scissors on fast-path
* Adapted coding style to nuklear's style
* Implemented text scissors
Color formats:
Define one of them at compile time.
* RAWFB_RGBX_8888 (32bpp)
* RAWFB_XRGB_8888 (32bpp)
Tested:
The library has been tested on Lenovo Thinkpad T500 and is able to render
more than 30fps on a single core with no further optimizations and VSNYC enabled.
TODO:
* Improve font rendering by using filters.
* Account font foreground color.
Usage:
The raw framebuffer library needs a "texture" that holds the prerendered
font data. The texture is used at runtime to blit the letters onto screen.
You have to provide the framebuffer address, dimension and pitch.
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
1. Main background area was filled by 2 big overlapping rectangles. It works good on solid but not on semi-transparent themes. Just replaced 2 big rectangles with 1 big and 2 small.
2. There is no need in [nk_gdip_fill_rect filled pies fix](7ab7327fa4) anymore. It disturbs semi-transparent themes too.
For example, I draw something via GDI+. Now I can call `nk_gdip_render_gui(AA)` and it will not erase my drawings, just will draw on top.
Previos API was not changed.
Fix incorrect button drawing (wrong stroke, empty spaces in stroke line near the corners). Since there are quarters of circle in the angles then lines must be moved to R, not to D.
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.
calling nk_init_default stores the address to the font (which is on stack) into the nk_context
but when it returns that stack memory is effectively undefined, thus making the program segfault
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.
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.
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`.
Taking in an extern demo is almost always a bad idea since I will be
the one to keep to date and I am not always able to do so. Emscript
was the last time I tried. For now on if anyone has a neat demo
please keep it in your own repository and I will create a link to it.
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.
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`.
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.
Demos for x11 and sdl have been update so that `nk_xxx_handle_event'
return true (1) if the given event was usefull and processed by
nuklear and false (1) if not.
Since it was requested I added a small snippet showing how to create
notebook tabs (header with buttons, selecting content). The added
demo is basically just a combination of already existing widgets +
some small styling changes and can be extended to easily support
case with more tabs then space in the header part. I will have
to think about if it is possible to create an API for this without
taking away the simplicity of it.
Previously if you used movable or scalable groups you had to add
the group border width to the panel to access the updated position
or size. Nuklear now takes control of the process and the new
position/size can be read after `nk_group_end` from `nk_panel`
directly.