Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

SDL2_Native demo #831

Open
hbiblia opened this issue Apr 22, 2019 · 9 comments
Open

SDL2_Native demo #831

hbiblia opened this issue Apr 22, 2019 · 9 comments

Comments

@hbiblia
Copy link

hbiblia commented Apr 22, 2019

Hola

Estoy trabajando para que esto funcione nativo en SDL2, ahora mismo las demo funcionan en un 65% o menos.

Estoy utilizando SDL2_ttf y SDL2_gfxPrimitives

  1. Calculator : Parece funcionar bien
  2. NodeEditor : El bezier no funciona
  3. Overview : Funciona en un 60%

https://github.com/hbiblia/nuklear/tree/master/demo/sdl_native

sdl2_native_nuklear_update

@zwykl3
Copy link

zwykl3 commented May 11, 2019

I have trouble
on 63 line return NULL on void function and

cc main.c -std=c99 -Wall -pedantic -O2 -o main -lSDL2 -lSDL2_ttf -lSDL2_gfx -lm
In file included from main.c:22:
./nuklear_sdl.h:198:35: warning: incompatible pointer types passing 'const float *' to parameter of type 'const Sint16 *'
      (aka 'const short *') [-Wincompatible-pointer-types]
                sdl_draw_polyline((const float*)&vertices, (2 * sizeof(float)),(int)p->point_count, p->color);
                                  ^~~~~~~~~~~~~~~~~~~~~~~
./nuklear_sdl.h:124:38: note: passing argument to parameter 'vx' here
void sdl_draw_polyline(const Sint16 *vx, const Sint16 *vy, int n, struct nk_color color) {
                                     ^
./nuklear_sdl.h:198:60: warning: incompatible integer to pointer conversion passing 'unsigned long' to parameter of type 'const Sint16 *'
      (aka 'const short *') [-Wint-conversion]
                sdl_draw_polyline((const float*)&vertices, (2 * sizeof(float)),(int)p->point_count, p->color);
                                                           ^~~~~~~~~~~~~~~~~~~
./nuklear_sdl.h:124:56: note: passing argument to parameter 'vy' here
void sdl_draw_polyline(const Sint16 *vx, const Sint16 *vy, int n, struct nk_color color) {
                                                       ^
./nuklear_sdl.h:209:41: warning: incompatible pointer types passing 'const float *' to parameter of type 'const Sint16 *'
      (aka 'const short *') [-Wincompatible-pointer-types]
                sdl_draw_filled_polygon((const float*)&verticesx, (const float*)&verticesy,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~
./nuklear_sdl.h:132:44: note: passing argument to parameter 'vx' here
void sdl_draw_filled_polygon(const Sint16 *vx, const Sint16 *vy, int n, struct nk_color color) {
                                           ^
./nuklear_sdl.h:209:67: warning: incompatible pointer types passing 'const float *' to parameter of type 'const Sint16 *'
      (aka 'const short *') [-Wincompatible-pointer-types]
                sdl_draw_filled_polygon((const float*)&verticesx, (const float*)&verticesy,
                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~
./nuklear_sdl.h:132:62: note: passing argument to parameter 'vy' here
void sdl_draw_filled_polygon(const Sint16 *vx, const Sint16 *vy, int n, struct nk_color color) {
                                                             ^
./nuklear_sdl.h:226:32: warning: passing 'const struct nk_image *' to parameter of type 'struct nk_image *' discards qualifiers
      [-Wincompatible-pointer-types-discards-qualifiers]
                sdl_draw_image(&i->img, i->x, i->y, i->w, i->h);
                               ^~~~~~~
./nuklear_sdl.h:136:38: note: passing argument to parameter 'img' here
void sdl_draw_image(struct nk_image *img, int x, int y, int w, int h) {
                                     ^
./nuklear_sdl.h:147:15: warning: unused variable 'color' [-Wunused-variable]
       Uint32 color; 
              ^
./nuklear_sdl.h:280:26: warning: incompatible pointer types initializing 'struct nk_user_font *' with an expression of type
      'struct nk_user_font **'; remove & [-Wincompatible-pointer-types]
    struct nk_user_font *font = &sdl.user_font;
                         ^      ~~~~~~~~~~~~~~
In file included from main.c:21:
./../nuclear/nuklear.h:6005:1: warning: unused function 'nk_sqrt' [-Wunused-function]
nk_sqrt(float x)
^
./../nuclear/nuklear.h:6010:1: warning: unused function 'nk_sin' [-Wunused-function]
nk_sin(float x)
^
./../nuclear/nuklear.h:6023:1: warning: unused function 'nk_cos' [-Wunused-function]
nk_cos(float x)
^
./../nuclear/nuklear.h:7230:1: warning: unused function 'nk_file_load' [-Wunused-function]
nk_file_load(const char* path, nk_size* siz, struct nk_allocator *alloc)
^
In file included from main.c:22:
./nuklear_sdl.h:74:13: warning: unused function 'nk_color_to_sdl_color' [-Wunused-function]
static void nk_color_to_sdl_color(struct nk_color color)
            ^
In file included from main.c:48:
./../nuclear/style.c:4:1: warning: unused function 'set_style' [-Wunused-function]
set_style(struct nk_context *ctx, enum theme theme)
^
13 warnings generated.

I get

$ ./demo
Segmentation fault: 11

my makefile (please add it)

$ cat Makefile 
BIN = main
CFLAGS += -std=c99 -Wall -pedantic -O0
SRC = main.c
LIBS = -lSDL2 -lSDL2_ttf -lSDL2_gfx -lm

$(BIN): Makefile main.c nuklear_sdl.h
	rm -f $(BIN)
	$(CC) $(SRC) $(CFLAGS) -o $(BIN) $(LIBS)

clean:
	rm -f $(BIN)

@zwykl3
Copy link

zwykl3 commented May 18, 2019

When code will be working?

@zwykl3
Copy link

zwykl3 commented Jun 10, 2019

I get segmentation 11 when change color background and sitll

cc main.c -std=c99 -Wall -pedantic -O0 -o main -lSDL2 -lSDL2_ttf -lSDL2_gfx -lm
In file included from main.c:22:
./nuklear_sdl.h:63:9: error: void function 'nk_sdl_font_create_from_file' should not return a value
      [-Wreturn-type]
        return NULL;
        ^      ~~~~

@letarg0
Copy link

letarg0 commented Jun 10, 2019

Great, but not working for me. Meybe correct the code?

@zwykl3
Copy link

zwykl3 commented Jul 13, 2019

We waiting for update
;)

@dumblob
Copy link
Contributor

dumblob commented Jul 13, 2019

@zwykl3 there are few things to be addressed in #837 before I merge it. Feel free to take a look at them.

@zwykl3
Copy link

zwykl3 commented Aug 3, 2019

ok, what happened in native sdl version? Why still not in repo?

@dumblob
Copy link
Contributor

dumblob commented Aug 3, 2019

@zwykl3 please see all my comments starting with #837 (comment) (all of them are a reason for not merging the pull request in its current state).

@hbiblia
Copy link
Author

hbiblia commented Oct 11, 2019

Vamos a resolver todo eso pues!!!

Update

@dumblob creo que ya pude corregir algunas de las cosas que menciono en #837 .

Encontré algunos problemas (bug)

  • nk_color_picker (Segmentation fault)
    UPDATE
  • nk_propertyi (Cursor se pierde) Este error esta pasando en las versiones de SDL2_GL también.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants