hexagon.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #include "fxlib.h"
  2. #include "MonochromeLib.h"
  3. #include "math.h"
  4. #include "ECode.h"
  5. #include "struct.h"
  6. #include "wall.h"
  7. #include "syscall.h"
  8. #include "states.h"
  9. int AddIn_main(int isAppli, unsigned short OptionNum)
  10. {
  11. Game_Data data; //no init, switch_to_state handles it
  12. //variables for fps calculation
  13. unsigned int fps = 0, frame = 0, tempsOrigine = RTC_GetTicks();
  14. //char string to display the fps
  15. unsigned char fps_text[8] = {0};
  16. //rand initialisation
  17. srand(RTC_GetTicks());
  18. switch_to_state(GAME, &data);
  19. while(KeyUp(K_EXIT)){ //main loop
  20. if(RTC_GetTicks() - tempsOrigine >= 32 ){//if 1/4 seconds elapsed
  21. fps = frame*4;
  22. frame = 0;
  23. tempsOrigine = RTC_GetTicks();
  24. }
  25. frame++;
  26. update(&data);
  27. draw(&data);
  28. //printing debug information
  29. intToStr(fps_text, fps);
  30. PrintMini(0, 0, fps_text, MINI_OVER);
  31. //updating the screen
  32. ML_display_vram();
  33. ML_clear_vram();
  34. Sleep(1/0.06);
  35. }
  36. return 1;
  37. }
  38. #pragma section _BR_Size
  39. unsigned long BR_Size;
  40. #pragma section
  41. #pragma section _TOP
  42. int InitializeSystem(int isAppli, unsigned short OptionNum)
  43. {
  44. return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
  45. }
  46. #pragma section