Browse Source

working

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

BIN
buzzer.wav

Binary file not shown.

BIN
sdljpd

Binary file not shown.

18
sdljpd.c

@ -59,7 +59,6 @@ signed int score[3] ={0,0,0};
int scorebuf; int scorebuf;
int plselect = 0; int plselect = 0;
int lockbz = FALSE; int lockbz = FALSE;
int port_adr;
int xpos = 0, ypos = 0; int xpos = 0, ypos = 0;
int solved[5][5] = {{0,0,0,0,0}, int solved[5][5] = {{0,0,0,0,0},
{0,0,0,0,0}, {0,0,0,0,0},
@ -90,6 +89,8 @@ t_kat mykat[5];
Mix_Music *music = NULL; Mix_Music *music = NULL;
Mix_Music *buzz_sound = NULL;
/** \brief This is our SDL surface /** \brief This is our SDL surface
* *
@ -338,18 +339,21 @@ void get_buz (void)
{ {
plselect = 0; plselect = 0;
lockbz = TRUE; lockbz = TRUE;
Mix_PlayMusic(buzz_sound, 0);
} }
if(i == 5) if(i == 5)
{ {
plselect = 1; plselect = 1;
lockbz = TRUE; lockbz = TRUE;
Mix_PlayMusic(buzz_sound, 0);
} }
if(i == 10) if(i == 10)
{ {
plselect = 2; plselect = 2;
lockbz = TRUE; lockbz = TRUE;
Mix_PlayMusic(buzz_sound, 0);
} }
} }
} }
@ -361,6 +365,8 @@ void draw_sdl (void)
int countx =0; int countx =0;
int county =0; int county =0;
int i=0;
/* Spielfeld geschlumpfe*/ /* Spielfeld geschlumpfe*/
drect.w = kachel -> w; drect.w = kachel -> w;
drect.h = kachel -> h; drect.h = kachel -> h;
@ -440,13 +446,17 @@ void draw_sdl (void)
text = TTF_RenderText_Blended(font, "Antwort:" , color); text = TTF_RenderText_Blended(font, "Antwort:" , color);
SDL_BlitSurface(text,NULL,surface,&drect); SDL_BlitSurface(text,NULL,surface,&drect);
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; drect.y = drect.y + 23;
strcpy(buf,myblock[xpos][ypos].frage); strncpy(buf,myblock[xpos][ypos].frage+i, 40);
SDL_FreeSurface(text); SDL_FreeSurface(text);
text = TTF_RenderText_Blended(font, buf , color); text = TTF_RenderText_Blended(font, buf , color);
SDL_BlitSurface(text,NULL,surface,&drect); SDL_BlitSurface(text,NULL,surface,&drect);
}
drect.y = drect.y - 23; drect.y = drect.y - 23;
drect.x = drect.x - 23; drect.x = drect.x - 23;
drect.y = drect.y - 23; drect.y = drect.y - 23;
} }
@ -639,6 +649,8 @@ int main( int argc, char **argv )
music_init(); music_init();
buzz_sound = Mix_LoadMUS("buzzer.wav");
if ( !videoInfo ) if ( !videoInfo )
{ {
fprintf( stderr, "Video query failed: %s\n", fprintf( stderr, "Video query failed: %s\n",

13
sdljpd.c~

@ -59,7 +59,6 @@ signed int score[3] ={0,0,0};
int scorebuf; int scorebuf;
int plselect = 0; int plselect = 0;
int lockbz = FALSE; int lockbz = FALSE;
int port_adr;
int xpos = 0, ypos = 0; int xpos = 0, ypos = 0;
int solved[5][5] = {{0,0,0,0,0}, int solved[5][5] = {{0,0,0,0,0},
{0,0,0,0,0}, {0,0,0,0,0},
@ -361,6 +360,8 @@ void draw_sdl (void)
int countx =0; int countx =0;
int county =0; int county =0;
int i=0;
/* Spielfeld geschlumpfe*/ /* Spielfeld geschlumpfe*/
drect.w = kachel -> w; drect.w = kachel -> w;
drect.h = kachel -> h; drect.h = kachel -> h;
@ -440,13 +441,17 @@ void draw_sdl (void)
text = TTF_RenderText_Blended(font, "Antwort:" , color); text = TTF_RenderText_Blended(font, "Antwort:" , color);
SDL_BlitSurface(text,NULL,surface,&drect); SDL_BlitSurface(text,NULL,surface,&drect);
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; drect.y = drect.y + 23;
strcpy(buf,myblock[xpos][ypos].frage); strncpy(buf,myblock[xpos][ypos].frage+i, 40);
SDL_FreeSurface(text); SDL_FreeSurface(text);
text = TTF_RenderText_Blended(font, buf , color); text = TTF_RenderText_Blended(font, buf , color);
SDL_BlitSurface(text,NULL,surface,&drect); SDL_BlitSurface(text,NULL,surface,&drect);
}
drect.y = drect.y - 23; drect.y = drect.y - 23;
drect.x = drect.x - 23; drect.x = drect.x - 23;
drect.y = drect.y - 23; drect.y = drect.y - 23;
} }
@ -460,7 +465,7 @@ void draw_sdl (void)
drect.x = drect.x + 23; drect.x = drect.x + 23;
drect.y = drect.y + 23; drect.y = drect.y + 23;
SDL_FreeSurface(text); SDL_FreeSurface(text);
text = TTF_RenderText_Blended(font, "Fräge:" , color); text = TTF_RenderText_Blended(font, "Frage:" , color);
SDL_BlitSurface(text,NULL,surface,&drect); SDL_BlitSurface(text,NULL,surface,&drect);
drect.y = drect.y + 23; drect.y = drect.y + 23;

Loading…
Cancel
Save