Commit 709f26b0 authored by Hanspeter Portner's avatar Hanspeter Portner

Merge commit '1df39f01'

parents c38001df 1df39f01
Pipeline #19087018 (#) passed with stages
in 13 minutes and 48 seconds
......@@ -5,7 +5,7 @@
This is a minimal state immediate mode graphical user interface toolkit
written in ANSI C and licensed under public domain. It was designed as a simple
embeddable user interface for application and does not have any dependencies,
a default renderbackend or OS window and input handling but instead provides a very modular
a default render backend or OS window and input handling but instead provides a very modular
library approach by using simple input state for input and draw
commands describing primitive shapes as output. So instead of providing a
layered library that tries to abstract over a number of platform and
......@@ -109,14 +109,14 @@ languages. Furthermore there are no guarantee that all bindings will always be k
Developed by Micha Mettke and every direct or indirect contributor to the GitHub.
Embeds `stb_texedit`, `stb_truetype` and `stb_rectpack` by Sean Barret (public domain)
Embeds `stb_texedit`, `stb_truetype` and `stb_rectpack` by Sean Barrett (public domain)
Embeds `ProggyClean.ttf` font by Tristan Grimmer (MIT license).
Big thank you to Omar Cornut (ocornut@github) for his [imgui](https://github.com/ocornut/imgui) library and
giving me the inspiration for this library, Casey Muratori for handmade hero
and his original immediate mode graphical user interface idea and Sean
Barret for his amazing single header [libraries](https://github.com/nothings/stb) which restored my faith
Barrett for his amazing single header [libraries](https://github.com/nothings/stb) which restored my faith
in libraries and brought me to create some of my own.
## License
......
......@@ -94,7 +94,7 @@ set_swap_chain_size(int width, int height)
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
hr = IDXGISwapChain_GetBuffer(swap_chain, 0, &IID_ID3D11Texture2D, &back_buffer);
hr = IDXGISwapChain_GetBuffer(swap_chain, 0, &IID_ID3D11Texture2D, (void **)&back_buffer);
assert(SUCCEEDED(hr));
hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)back_buffer, &desc, &rt_view);
......
......@@ -179,14 +179,15 @@ nk_gdi_stroke_rect(HDC dc, short x, short y, unsigned short w,
SelectObject(dc, pen);
}
SetDCBrushColor(dc, OPAQUE);
HGDIOBJ br = SelectObject(dc, GetStockObject(NULL_BRUSH));
if (r == 0) {
Rectangle(dc, x, y, x + w, y + h);
} else {
RoundRect(dc, x, y, x + w, y + h, r, r);
}
SelectObject(dc, br);
if (pen) {
if (pen) {
SelectObject(dc, GetStockObject(DC_PEN));
DeleteObject(pen);
}
......@@ -562,7 +563,7 @@ nk_gdi_handle_event(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
case WM_SIZE:
{
unsigned width = LOWORD(lparam);
unsigned height = LOWORD(lparam);
unsigned height = HIWORD(lparam);
if (width != gdi.width || height != gdi.height)
{
DeleteObject(gdi.bitmap);
......
......@@ -310,7 +310,6 @@ nk_sdl_handle_event(SDL_Event *evt)
nk_input_button(ctx, NK_BUTTON_MIDDLE, x, y, down);
else if (evt->button.button == SDL_BUTTON_RIGHT)
nk_input_button(ctx, NK_BUTTON_RIGHT, x, y, down);
else return 0;
return 1;
} else if (evt->type == SDL_MOUSEMOTION) {
/* mouse motion */
......
......@@ -889,8 +889,9 @@ nk_xlib_render(Drawable screen, struct nk_color clear)
} break;
case NK_COMMAND_RECT: {
const struct nk_command_rect *r = (const struct nk_command_rect *)cmd;
nk_xsurf_stroke_rect(surf, r->x, r->y, r->w, r->h,
(unsigned short)r->rounding, r->line_thickness, r->color);
nk_xsurf_stroke_rect(surf, r->x, r->y, NK_MAX(r->w -r->line_thickness, 0),
NK_MAX(r->h - r->line_thickness, 0), (unsigned short)r->rounding,
r->line_thickness, r->color);
} break;
case NK_COMMAND_RECT_FILLED: {
const struct nk_command_rect_filled *r = (const struct nk_command_rect_filled *)cmd;
......
......@@ -90,9 +90,11 @@ nk_rawfb_setpixel(const struct rawfb_context *rawfb,
const short x0, const short y0, const struct nk_color col)
{
unsigned int c = nk_color_from_byte(&col.r);
unsigned int *ptr = (unsigned int *)rawfb->fb.pixels;
unsigned char *pixels = rawfb->fb.pixels;
unsigned int *ptr;
ptr += y0 * rawfb->fb.w;
pixels += y0 * rawfb->fb.pitch;
ptr = (unsigned int *)pixels;
ptr += x0;
if (y0 < rawfb->scissors.h && y0 >= rawfb->scissors.y &&
......@@ -109,8 +111,11 @@ nk_rawfb_line_horizontal(const struct rawfb_context *rawfb,
* The caller has to make sure it does no exceed bounds. */
unsigned int i, n;
unsigned int c[16];
unsigned int *ptr = (unsigned int *)rawfb->fb.pixels;
ptr += y * rawfb->fb.w;
unsigned char *pixels = rawfb->fb.pixels;
unsigned int *ptr;
pixels += y * rawfb->fb.pitch;
ptr = (unsigned int *)pixels;
ptr += x0;
n = x1 - x0;
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment