ok Im getting a black screen when I do this...
I have the main loop:
int main(int argc, char * args[]){
//SDL init
screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 ) { return 1; }
screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
if( screen == NULL ) { return 1; }
SDL_WM_SetCaption( "BreakOut!", NULL );
if( TTF_Init() == -1 ) { return false; }
//
//game init
MODE_::MODE_();
OPTIONS_::OPTIONS_();
//
while(event.type!=SDL_QUIT){
font=TTF_OpenFont( "Mario and Luigi.ttf", 28 );
if(font==NULL){return 1;}
if( SDL_PollEvent( &event ) ){
if(event.type==SDL_KEYDOWN)
if(event.key.keysym.sym==SDLK_DOWN){
OPTIONS_::TextColor("green");
}
}
message = TTF_RenderText_Solid( font, "Breakout!", textColor );
if( message == NULL ) { return 1; }
apply_surface(50,50,message,screen);
//quit checking
if(checkQuit()==0)
if( SDL_Flip( screen ) == -1 ) { return 1; }
}
return 0;
}
and Options.h:
class OPTIONS_{
public:
OPTIONS_();
static void TextColor(std::string newcolor);
};
OPTIONS_::OPTIONS_(){
SDL_Color textColor = {255,255,255};
}
void OPTIONS_::TextColor(std::string newcolor){
if(newcolor=="green")
SDL_Color textColor={35,245,33};
}
and text should be up in white per the constructor, and keypress down should
change it to green per the TextColor(newcolor) function..help pls!
[Edited by - BlueBan007 on May 21, 2009 6:59:59 AM]