Hoi,
Also ich bin darbei ein kleines SDL spiel zu programmieren hab darbei allerdings das problem das ich mit SDL_CreateThread(rm.shoot, NULL); einen neuen thread erzeugen will. shoot ist allerdings die methode einer klasse und ich bekomm darbei folgenden fehler:
Code:
sdl-test.cpp:285: error: argument of type `int (spieler::)(void*)' does not
match `int (*)(void*)'
Ich kann mit der fehlermeldung leider nicht viel anfangen. So sieht die funktion shoot aus:
Code:
int shoot(void *nichtVerwendet) {
if (figure == 0)
{
of.x = (quellcods.x + quellcods.w);
of.y = (quellcods.y + (quellcods.h / 2)-10);
of.w = kugel->w;
of.h = kugel->h;
}
if (figure == 1)
{
of.x = quellcods.x;
of.y = (quellcods.y + (quellcods.h / 2)-10);
of.w = kugel->w;
of.h = kugel->h;
}
fuck.x = of.x;
fuck.y = of.y;
fuck.w = kugel->w;
fuck.h = kugel->h;
int running = 1;
while (running)
{
fprintf(stderr, "colli %i", colli);
colli = FireCollision();
if (colli == 0)
{
if (figure == 0)
{
of.x = of.x + 2;
}
if (figure == 1)
{
of.x = of.x - 2;
}
SDL_FillRect(screen, &fuck, SDL_MapRGB(screen->format, 0, 0, 0));
SDL_BlitSurface(kugel, 0, screen, &of);
SDL_UpdateRects(screen,1,&of);
SDL_UpdateRects(screen,1,&fuck);
if (of.x > 800 ||of.x < 1)
{running = 0;}
fuck.x = of.x;
SDL_Delay(2);
}
if (colli == 1)
{running = 0;}
}
return(0);
}
Wer nett wenn ihr mir nen tip geben könntet.
Mit freundlichen Grüßen
locai
Lesezeichen