here it is;
Code:
while (quit==0)
{
apply_surface(bg, screen,0,0);
if (SDL_PollEvent(&event))
{
//Quit Metronome
if (event.type==SDL_QUIT)
{
quit=1;
}
//--------------------------------
if (event.type==SDL_KEYDOWN)
{
SDL_EnableUNICODE(SDL_ENABLE);
if (event.key.keysym.unicode>=(Uint16)'0' && event.key.keysym.unicode <=(Uint16)'9')
{
if (x<11)
{
time_str[x]=(char)event.key.keysym.unicode;
x++;
text=NULL;
}
}
if (event.key.keysym.sym==SDLK_RETURN)
{
x=0;
while (x<11)
{
time_str[x]=' ';
x++;
}
x=0;
text=NULL;
}
}
text=TTF_RenderText_Solid(font, time_str, textcolor);
}
y=atoi(time_str);
if (y<=0) y=1;
if ((SDL_GetTicks()-timing) == (60000/y))
{
Mix_PlayChannel(-1,clap,0);
timing=SDL_GetTicks();
}
apply_surface(text, screen,0,0);
SDL_Flip(screen);
}
the full loop