Nuklear
Nuklear copied to clipboard
SDL GLFW without OpenGL
I write a program in SDL2. Im need Windows System in dev mode. I'm not using OpenGL. I need use both: my program and Nuclear.
How writing simple as possible SDL2 or GLFW program /renderer. I need only put image on screen, draw line, draw rectangle with color.
demo/program look easy but difficult add any program 'bottom' of windows
Check: https://github.com/hbiblia/Nuklear/tree/master/demo/sdl_native
Not working
---- linux fedora 32
cc main.c -std=c99 -pedantic -O2 -o bin/demo -lSDL2 -lGL -lm -lGLU
In file included from main.c:22:
nuklear_sdl.h: In function ‘nk_sdl_render’:
nuklear_sdl.h:197:35: warning: passing argument 1 of ‘sdl_draw_polyline’ from incompatible pointer type [-Wincompatible-pointer-types]
197 | sdl_draw_polyline((const float*)&vertices, (2 * sizeof(float)),(int)p->point_count, p->color);
| ^~~~~~~~~~~~~~~~~~~~~~~
| |
| const float *
nuklear_sdl.h:123:38: note: expected ‘const Sint16 *’ {aka ‘const short int *’} but argument is of type ‘const float *’
123 | void sdl_draw_polyline(const Sint16 *vx, const Sint16 *vy, int n, struct nk_color color) {
| ~~~~~~~~~~~~~~^~
nuklear_sdl.h:197:60: warning: passing argument 2 of ‘sdl_draw_polyline’ makes pointer from integer without a cast [-Wint-conversion]
197 | sdl_draw_polyline((const float*)&vertices, (2 * sizeof(float)),(int)p->point_count, p->color);
| ^~~~~~~~~~~~~~~~~~~
| |
| long unsigned int
nuklear_sdl.h:123:56: note: expected ‘const Sint16 *’ {aka ‘const short int *’} but argument is of type ‘long unsigned int’
123 | void sdl_draw_polyline(const Sint16 *vx, const Sint16 *vy, int n, struct nk_color color) {
| ~~~~~~~~~~~~~~^~
nuklear_sdl.h:208:41: warning: passing argument 1 of ‘sdl_draw_filled_polygon’ from incompatible pointer type [-Wincompatible-pointer-types]
208 | sdl_draw_filled_polygon((const float*)&verticesx, (const float*)&verticesy,
| ^~~~~~~~~~~~~~~~~~~~~~~~
| |
| const float *
nuklear_sdl.h:131:44: note: expected ‘const Sint16 *’ {aka ‘const short int *’} but argument is of type ‘const float *’
131 | void sdl_draw_filled_polygon(const Sint16 *vx, const Sint16 *vy, int n, struct nk_color color) {
| ~~~~~~~~~~~~~~^~
nuklear_sdl.h:208:67: warning: passing argument 2 of ‘sdl_draw_filled_polygon’ from incompatible pointer type [-Wincompatible-pointer-types]
208 | sdl_draw_filled_polygon((const float*)&verticesx, (const float*)&verticesy,
| ^~~~~~~~~~~~~~~~~~~~~~~~
| |
| const float *
nuklear_sdl.h:131:62: note: expected ‘const Sint16 *’ {aka ‘const short int *’} but argument is of type ‘const float *’
131 | void sdl_draw_filled_polygon(const Sint16 *vx, const Sint16 *vy, int n, struct nk_color color) {
| ~~~~~~~~~~~~~~^~
nuklear_sdl.h:225:32: warning: passing argument 1 of ‘sdl_draw_image’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
225 | sdl_draw_image(&i->img, i->x, i->y, i->w, i->h);
| ^~~~~~~
nuklear_sdl.h:135:38: note: expected ‘struct nk_image *’ but argument is of type ‘const struct nk_image *’
135 | void sdl_draw_image(struct nk_image *img, int x, int y, int w, int h) {
| ~~~~~~~~~~~~~~~~~^~~
nuklear_sdl.h: In function ‘nk_sdl_init’:
nuklear_sdl.h:279:33: warning: initialization of ‘struct nk_user_font *’ from incompatible pointer type ‘struct nk_user_font **’ [-Wincompatible-pointer-types]
279 | struct nk_user_font *font = &sdl.user_font;
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `nk_sdl_font_get_text_width':
main.c:(.text+0x519): undefined reference to `TTF_SizeText'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `nk_sdl_font_create_from_file':
main.c:(.text+0x2e1ad): undefined reference to `TTF_Init'
/usr/bin/ld: main.c:(.text+0x2e1b7): undefined reference to `TTF_OpenFont'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `sdl_draw_text':
main.c:(.text+0x2e229): undefined reference to `TTF_RenderText_Blended'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `sdl_draw_rect':
main.c:(.text+0x2e301): undefined reference to `roundedRectangleRGBA'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `sdl_draw_rect_fill':
main.c:(.text+0x2e35c): undefined reference to `roundedBoxRGBA'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `sdl_draw_line':
main.c:(.text+0x2e3a9): undefined reference to `lineRGBA'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `sdl_draw_ellipse':
main.c:(.text+0x2e3f9): undefined reference to `ellipseRGBA'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `sdl_draw_ellipse_filled':
main.c:(.text+0x2e449): undefined reference to `filledEllipseRGBA'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `sdl_draw_circle_filled':
main.c:(.text+0x2e492): undefined reference to `filledCircleRGBA'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `sdl_draw_triangle':
main.c:(.text+0x2e4e2): undefined reference to `trigonRGBA'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `sdl_draw_filled_triangle':
main.c:(.text+0x2e532): undefined reference to `filledTrigonRGBA'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `sdl_draw_polyline':
main.c:(.text+0x2e56b): undefined reference to `polygonRGBA'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `sdl_draw_arc':
main.c:(.text+0x2e5be): undefined reference to `arcRGBA'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `sdl_draw_filled_polygon':
main.c:(.text+0x2e5fb): undefined reference to `filledPolygonRGBA'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `nk_sdl_render':
main.c:(.text+0x2e73f): undefined reference to `roundedBoxRGBA'
/usr/bin/ld: main.c:(.text+0x2e78e): undefined reference to `roundedRectangleRGBA'
/usr/bin/ld: main.c:(.text+0x2e7d1): undefined reference to `lineRGBA'
/usr/bin/ld: main.c:(.text+0x2e8bd): undefined reference to `filledPolygonRGBA'
/usr/bin/ld: main.c:(.text+0x2e946): undefined reference to `polygonRGBA'
/usr/bin/ld: main.c:(.text+0x2e993): undefined reference to `filledTrigonRGBA'
/usr/bin/ld: main.c:(.text+0x2e9db): undefined reference to `trigonRGBA'
/usr/bin/ld: main.c:(.text+0x2ea2c): undefined reference to `arcRGBA'
/usr/bin/ld: main.c:(.text+0x2eab6): undefined reference to `filledEllipseRGBA'
/usr/bin/ld: main.c:(.text+0x2eb3e): undefined reference to `ellipseRGBA'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `nk_sdl_init':
main.c:(.text+0x2eb6b): undefined reference to `TTF_FontHeight'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `WinMain':
main.c:(.text+0x2f3bf): undefined reference to `TTF_Init'
/usr/bin/ld: main.c:(.text+0x2f3ce): undefined reference to `TTF_OpenFont'
/usr/bin/ld: /tmp/cchzZKBw.o: in function `nk_sdl_font_del':
main.c:(.text+0x2e1fd): undefined reference to `TTF_CloseFont'
collect2: error: ld returned 1 exit status
make: *** [/home/user/inne/Nuklear/demo/sdl_native/Makefile:25: demo] Error 1
Dependencias : SDL2_ttf SDL2_gfx Modify the make to compile for Linux as it is for Win10.
Update Ubuntu 20 : sudo apt-get install libsdl2-ttf-dev libsdl2-2.0-0 libsdl2-gfx-dev Update: Makefile
Sorry not working. I can compile it but when I would like to change (black !) background I get
./demo
Segmentation fault (core dumped)
I have similar efect. Button, check and value working Background change not workinga and crashing whole program
Ya no explota al cambiar un color, pero no se muestra la tabla de colores. (lo siento no tengo mucho tiempo libre).
Check the sdl2surface_rawfb
demo :wink: ... It will render to an SDL_Surface.
@RobLoach You look at surface raw this is not answer because You dont using sdl_surface AND IN THIS SAME TIME window nuclear
Or the render geography demo?