void runGameLoop()
{
// THIS LOADS THE TICK SOUND FILES //
/////////////////////////////////////
handle=FSOUND_Sample_Load
(1,"Metronome/MainBeat.wav",0,0,0); // Load the high pitch tick
handle1=FSOUND_Sample_Load
(2,"Metronome/SubBeat.wav",0,0,0); // Load the low pitch tick
glfwSetTime(0.0000); // Set time to 0.0000
while(running) // While still in the game loop
{
// THIS HANDLES WHAT TICKS TO PLAY //
/////////////////////////////////////
if (glfwGetTime() >= 0.4332){ // song is 138.5bpm so 60000/138.5 = 433.2 and if the timer is above this value
if (beat == 1){ // If beat count is 1 then
FSOUND_PlaySound (1,handle); // play the high metronome tick
}else{
FSOUND_PlaySound (2,handle1); // Else play the low metronome tick for beats 2,3 and 4
if (beat == 4){ // If we are on the 4th beat
beat = 1; // reset the beat count to 1
}else{
beat ++; // Else increase the beat count
}
}
// WHAT COLOUR THE QUAD SHOULD BE //
////////////////////////////////////
if (red == 1.0f){ // If red value is 1.0
red = 0.0f; // set it to 0.0
}else{
red = 1.0f; // Else set it to 1.0
}
glfwSetTime(0.0000); // Reset the timer
}
glClear(GL_COLOR_BUFFER_BIT); // Flush the colour fuffer
glClear(GL_DEPTH_BUFFER_BIT); // Flush the depth buffer
glColor3f(red,1.0, 0.0); // Sets the colour for the quad
glRectf(-5.0, 5.0, 5.0, -5.0); // Draws the quad
glfwSwapBuffers(); // Swap front and back rendering buffers
}
}