diff --git a/buzzer.wav b/buzzer.wav new file mode 100644 index 0000000..01c30b7 Binary files /dev/null and b/buzzer.wav differ diff --git a/sdljpd b/sdljpd index d1f8d44..3db4134 100755 Binary files a/sdljpd and b/sdljpd differ diff --git a/sdljpd.c b/sdljpd.c index e7299d0..503df86 100644 --- a/sdljpd.c +++ b/sdljpd.c @@ -59,7 +59,6 @@ signed int score[3] ={0,0,0}; int scorebuf; int plselect = 0; int lockbz = FALSE; -int port_adr; int xpos = 0, ypos = 0; int solved[5][5] = {{0,0,0,0,0}, {0,0,0,0,0}, @@ -90,6 +89,8 @@ t_kat mykat[5]; Mix_Music *music = NULL; +Mix_Music *buzz_sound = NULL; + /** \brief This is our SDL surface * @@ -337,19 +338,22 @@ void get_buz (void) if(i == 0) { plselect = 0; - lockbz = TRUE; + lockbz = TRUE; + Mix_PlayMusic(buzz_sound, 0); } if(i == 5) { plselect = 1; lockbz = TRUE; + Mix_PlayMusic(buzz_sound, 0); } if(i == 10) { plselect = 2; lockbz = TRUE; + Mix_PlayMusic(buzz_sound, 0); } } } @@ -361,6 +365,8 @@ void draw_sdl (void) int countx =0; int county =0; + int i=0; + /* Spielfeld geschlumpfe*/ drect.w = kachel -> w; drect.h = kachel -> h; @@ -440,13 +446,17 @@ void draw_sdl (void) text = TTF_RenderText_Blended(font, "Antwort:" , color); SDL_BlitSurface(text,NULL,surface,&drect); - drect.y = drect.y + 23; - strcpy(buf,myblock[xpos][ypos].frage); - SDL_FreeSurface(text); - text = TTF_RenderText_Blended(font, buf , color); - SDL_BlitSurface(text,NULL,surface,&drect); - drect.y = drect.y - 23; - + for (i=0; i<=100; i++) + buf[i] = 0; + for (i=0; i<=strlen(myblock[xpos][ypos].frage); i+=40) + { + drect.y = drect.y + 23; + strncpy(buf,myblock[xpos][ypos].frage+i, 40); + SDL_FreeSurface(text); + text = TTF_RenderText_Blended(font, buf , color); + SDL_BlitSurface(text,NULL,surface,&drect); + } + drect.y = drect.y - 23; drect.x = drect.x - 23; drect.y = drect.y - 23; } @@ -638,6 +648,8 @@ int main( int argc, char **argv ) videoInfo = SDL_GetVideoInfo( ); music_init(); + + buzz_sound = Mix_LoadMUS("buzzer.wav"); if ( !videoInfo ) { diff --git a/sdljpd.c~ b/sdljpd.c~ index b2f3063..08683bc 100644 --- a/sdljpd.c~ +++ b/sdljpd.c~ @@ -59,7 +59,6 @@ signed int score[3] ={0,0,0}; int scorebuf; int plselect = 0; int lockbz = FALSE; -int port_adr; int xpos = 0, ypos = 0; int solved[5][5] = {{0,0,0,0,0}, {0,0,0,0,0}, @@ -361,6 +360,8 @@ void draw_sdl (void) int countx =0; int county =0; + int i=0; + /* Spielfeld geschlumpfe*/ drect.w = kachel -> w; drect.h = kachel -> h; @@ -440,13 +441,17 @@ void draw_sdl (void) text = TTF_RenderText_Blended(font, "Antwort:" , color); SDL_BlitSurface(text,NULL,surface,&drect); - drect.y = drect.y + 23; - strcpy(buf,myblock[xpos][ypos].frage); - SDL_FreeSurface(text); - text = TTF_RenderText_Blended(font, buf , color); - SDL_BlitSurface(text,NULL,surface,&drect); - drect.y = drect.y - 23; - + for (i=0; i<=100; i++) + buf[i] = 0; + for (i=0; i<=strlen(myblock[xpos][ypos].frage); i+=40) + { + drect.y = drect.y + 23; + strncpy(buf,myblock[xpos][ypos].frage+i, 40); + SDL_FreeSurface(text); + text = TTF_RenderText_Blended(font, buf , color); + SDL_BlitSurface(text,NULL,surface,&drect); + } + drect.y = drect.y - 23; drect.x = drect.x - 23; drect.y = drect.y - 23; } @@ -460,7 +465,7 @@ void draw_sdl (void) drect.x = drect.x + 23; drect.y = drect.y + 23; SDL_FreeSurface(text); - text = TTF_RenderText_Blended(font, "Fräge:" , color); + text = TTF_RenderText_Blended(font, "Frage:" , color); SDL_BlitSurface(text,NULL,surface,&drect); drect.y = drect.y + 23;