#include "Graphics.h"

extern int tick;
extern int lasttick;

void intro()
{
  int currentstart = 0;
  int introframe = 0;
  sound_voices(4);

  sound_set_voice(1,"WaveSynth-Beep");
  sound_set_voice(2,"WaveSynth-Beep");
  sound_set_voice(3,"WaveSynth-Beep");
  sound_set_voice(4,"WaveSynth-Beep");
  sound_composition_init();

  sound_composition_load("cmpintro");
 
  tick = clock();

  sound_composition_start(clock());

  draw_sprite("spacebar",(DISPLAY_X/2)-106,50);

  while(sound_composition_incomplete())
  {
    sound_composition_tick(clock());

    if(introframe == 0)
    {
      if(clock() > (tick + 200))
      {
        introframe++;
        draw_sprite("tng_st",320,600);
      }
    }
    if(introframe == 1)
    {
      if(clock() > (tick + 600))
      {
        introframe++;
        draw_sprite("tng_te",425,500);
      }
    }
    
    if(input_readkey(98))
      sound_composition_stop();
  }
}
