That made sense and I think I understand void pointers a little more than I did now. That however still didn't fix the problem as I'm getting the same error. As for the other warning-inducing problems, yes I know how to fix those although as for right now, I'm just testing something so they're not much of an issue. Any other fatal errors I'm missing?
Code:
MainMenu->CreateMenuItem("Play",SDL_Color{0,255,0},SDL_Color{255,255,255},(*New)(this));
MainMenu->CreateMenuItem("High Scores",SDL_Color{255,0,0},SDL_Color{255,255,255},NULL);
MainMenu->CreateMenuItem("Exit",SDL_Color{255,0,0},SDL_Color{255,255,255},(*Exit)(0));
while(MainMenu->Run(Display));
exit(0);
}
if (Phase == G_NEW_GAME)
{
}
}
}
cGame* New(cGame* data)
{
data->Phase = G_NEW_GAME;
return data;
}
If it's any correlation, here's how Menu itself is set up and how I'm using those pointers.
Code:
typedef void (*MENU_FUNC)(void*);
struct MenuItem
{
string Str;
int x,y,w,h;
SDL_Color Inactive;
SDL_Color Active;
SDL_Color Drawn;
bool PickedAndMouseDown;
MENU_FUNC Option;
};
class Menu
{
private:
vector<MenuItem*> Items;
TTF_Font* Font;
SDL_Surface* Bitmap;
public:
Menu(TTF_Font* f);
~Menu(){ TTF_CloseFont(Font); SDL_FreeSurface(Bitmap); }
bool ItemChosen(); // Run through Item locations and check mouse coords and mouse_button states
bool Run(SDL_Surface* Display);
void CreateMenuItem(string Text, SDL_Color, SDL_Color, MENU_FUNC);
};