nuklear
nuklear copied to clipboard
how draw a shape with holes?
How draw char 'A' ? from points
- Using xor and unions between shapes ?
1.1. Draw a black triangle 1.2. draw a white trapeze at the bottom of the black triangle (entered of course) 1.3. draw a white triangle on top of the trapeze
And you're done.
- Other way (just using black lines) : define a "path" to draw the letter ? (rough description, just follow the points by number)
2
1 3
6 <------ 5
7 4
Look up some existing bitmap font and use it. That should be the easiest, proven to be readable and in the end gives the opportunity to use other characters in the future while being graphically compatible.
I need draw any polygon not only A ;)
@ebachard @dumblob ok,simplest question how draw triangle? for example SDL2 or how draw bitmap?
You can try to use nk_draw_list_stroke_poly_line()
- see nuklear.h
for parameters and "examples of its usage":
case NK_COMMAND_TRIANGLE: {
const struct nk_command_triangle *t = (const struct nk_command_triangle*)cmd;
nk_draw_list_stroke_triangle(&ctx->draw_list, nk_vec2(t->a.x, t->a.y),
nk_vec2(t->b.x, t->b.y), nk_vec2(t->c.x, t->c.y), t->color,
t->line_thickness);
} break;
For bitmaps the following might help.
case NK_COMMAND_IMAGE: {
const struct nk_command_image *i = (const struct nk_command_image*)cmd;
nk_draw_list_add_image(&ctx->draw_list, i->img, nk_rect(i->x, i->y, i->w, i->h), i->col);
} break;
@dumblob You code not working
main.c: In function ‘main’:
main.c:135:9: error: case label not within a switch statement
case NK_COMMAND_TRIANGLE: {
^~~~
main.c:136:86: error: ‘cmd’ undeclared (first use in this function)
const struct nk_command_triangle *t = (const struct nk_command_triangle*)cmd;
^~~
main.c:136:86: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Makefile:24: test] Błąd 1
Is possible draw on background window too?
here normal demo code: https://gist.github.com/letarg0/a931dc9b4599e6526ba3d1aaec7b7557 any diff or other way?
@dumblob You code not working
Please read again what I wrote - see nuklear.h for parameters and "examples of its usage": ...
(do you see the suggestion to read the source code and find places with the cited source code?).
@dumblob Ok, I cant reat source code correct. Please show me any working example. I ask because I cant do this himself.
Only draw one line in demo.
@letarg0 no demo will help you if you won't know what it does. Learn programming first, get a broader overview and come back to learn about libraries (analogue to "learn reading first and then come to a library to read complex books").
Or if you don't want to learn programming (which is perfectly OK), ask your friend who knows programming to help you achieve the results you're dreaming about.
@dumblob i undestand. You have no idea how to do it and attack others to hide this fact