hexagon.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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;
  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. // Key init
  19. data.shift_latch_value = 0;
  20. data.alpha_latch_value = 0;
  21. switch_to_state(TITLE, &data);
  22. while(KeyUp(K_EXIT)){ //main loop
  23. //fps
  24. if(RTC_GetTicks() - tempsOrigine >= 32 )//if 1/4 seconds elapsed
  25. {
  26. fps = frame*4;
  27. frame = 0;
  28. tempsOrigine = RTC_GetTicks();
  29. }
  30. frame++;
  31. update(&data);
  32. draw(&data);
  33. //printing debug information
  34. // intToStr(fps_text, fps);
  35. // PrintMini(0, 0, fps_text, MINI_OVER);
  36. //updating the screen
  37. ML_display_vram();
  38. ML_clear_vram();
  39. //Sleep(1/0.06);
  40. Sleep(1/0.06);
  41. }
  42. return 1;
  43. }
  44. #pragma section _BR_Size
  45. unsigned long BR_Size;
  46. #pragma section
  47. #pragma section _TOP
  48. int InitializeSystem(int isAppli, unsigned short OptionNum)
  49. {
  50. return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
  51. }
  52. #pragma section