Browse Source

working

main
h3ndrik 13 years ago
parent
commit
f56e3ac7e4
  1. BIN
      buzzer.wav
  2. BIN
      sdljpd
  3. 30
      sdljpd.c
  4. 23
      sdljpd.c~

BIN
buzzer.wav

Binary file not shown.

BIN
sdljpd

Binary file not shown.

30
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 )
{

23
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;

Loading…
Cancel
Save