Have a class object created in main, and have a function before main use its member functions.
Cake for the person that can!
Code: Select all
void option(const Card &card)
{
if (keystates[SDLK_LEFT])
{
apply_surface(0,0,Table,screen);
Card1.applyCard(100,280);
Card2.applyCard(140,280);
Card3.applyCard(420,50);
apply_surface(370,513,Border,screen);
spot = false;
}
else
if (keystates[SDLK_RIGHT])
{
apply_surface(0,0,Table,screen);
Card1.applyCard(100,280);
Card2.applyCard(140,280);
Card3.applyCard(420,50);
apply_surface(500,513,Border,screen);
spot = true;
}
else
if (keystates[SDLK_RETURN])
{
if (spot == false)
{
pos = false;
}
else
if (spot = true)
{
pos = true;
}
}
}
int main ( int argc, char *args[] )
{
srand(time(0));
bool quit = false;
if( init() == false ) { return 1;}
if( load_files() == false ) { return 2;}
apply_surface( 0,0,Table,screen);
apply_surface(370,513,Border,screen);
Card Card1;
Card Card2;
Card Card3;
Card1.applyCard(100,280);
Card2.applyCard(140,280);
Card3.applyCard(420,50);
while (quit == false)
{
while ( SDL_PollEvent( &event ) )
{
if( event.type == SDL_QUIT )
{
quit = true;
}
}
SDL_Flip( screen );
}
cleanup();
return 0;
}