Struktur die funktionen enthält, welche einen pointer auf die struktur übernehmen
-
Titel klingt kompliziert.. ist's aber garnicht:
typedef struct { int x; int y; bool isPressed; void (*onMouseDown)(*SDL_Button); void (*onMouseUp)(*SDL_Button); } SDL_Button;
error C2059: syntax error : ''
error C2059: syntax error : ''warum, kann ich da keine pointer als funktionsparameter definieren ?
-
^^weil das so nicht geht, etwa so musses aussehen:
typedef struct blah { int x; int y; bool isPressed; void (*onMouseDown)(struct blah*); void (*onMouseUp)(struct blah*); } SDL_Button;
-
;fricky schrieb:
^^weil das so nicht geht, etwa so musses aussehen:
typedef struct blah { int x; int y; bool isPressed; void (*onMouseDown)(struct blah*); void (*onMouseUp)(struct blah*); } SDL_Button;
igitt, und warum ist das so ?
-
pixartist schrieb:
Titel klingt kompliziert.. ist's aber garnicht:
Wo ist denn dann das Problem?
Deine Sternchen sind auf der falschen Seite, und innerhalb deiner Struktur ist der Typ noch unbekannt. Machst du so:
typedef struct SDL_Button SDL_Button; struct SDL_Button { int x; int y; bool isPressed; void (*onMouseDown)(SDL_Button*); void (*onMouseUp)(SDL_Button*); };
Gruß,
B.B.