Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. #include "fxlib.h"
  2. #include "MonochromeLib.h"
  3.  
  4. unsigned int key;
  5. int frame = 0;
  6. int veille = 10, x = 0, y =0, x1 = 0, y1 = 0;
  7. char block[] = {255,255,248,31,240,15,240,15,207,243,142,113,142,113,137,145,137,145,142,113,142,113,207,243,240,15,240,15,248,31,255,255};
  8. char cube10[] = {15,192,31,248,31,224,63,248,63,252,63,248,15,240,31,192,63,248,127,252,125,188,127,252,127,252,30,240,60,120,124,124};
  9. char cube11[] = {15,192,31,248,30,64,52,64,54,32,56,120,0,0,31,192,63,248,127,252,13,176,7,224,15,240,30,240,60,120,124,124};
  10. char cube20[] = {7,224,15,252,15,240,31,252,31,254,31,252,7,248,63,224,255,255,255,127,239,246,31,254,63,254,126,126,120,0,60,0};
  11. char cube21[] = {7,224,15,252,15,32,26,32,27,16,28,60,0,0,63,224,31,248,15,124,15,246,31,254,63,254,126,126,120,0,60,0};
  12. char cube30[] = {0,0,7,224,15,252,15,240,31,252,31,254,31,252,7,248,15,248,31,252,63,248,63,240,63,240,127,224,99,192,3,224};
  13. char cube31[] = {0,0,7,224,15,252,15,32,26,32,27,16,28,60,0,0,15,224,7,224,7,224,63,240,63,240,127,224,99,192,3,224};
  14. int tableau[4][8] = {{0,0,0,0,0,1,0,1}, {0,1,0,0,0,1,0,1}, {0,0,0,1,0,0,0,1} ,{1,0,0,0,0,1,0,0}};
  15.  
  16. void dessin ()
  17. {
  18. ML_clear_vram();
  19. x1=0;y1=0;
  20. frame = frame +1;
  21. if (frame == 25)
  22. {
  23. frame = 0;
  24. }
  25.  
  26. while (y1<4)
  27. {
  28. if (tableau[y1][x1] == 1)
  29. {
  30. ML_bmp_16_or(block, (x1*16), (y1*16));
  31. }
  32.  
  33. x1++;
  34. if (x1 == 8)
  35. {
  36. x1=0;
  37. y1++;
  38. }
  39. }
  40. if (frame < 9)
  41. {
  42. ML_bmp_16_or(cube10, x, y);
  43. ML_bmp_16_and(cube11, x, y);
  44. }
  45. else if (frame < 17)
  46. {
  47. ML_bmp_16_or(cube20, x, y);
  48. ML_bmp_16_and(cube21, x, y);
  49. }
  50.  
  51. else
  52. {
  53. ML_bmp_16_or(cube30, x, y);
  54. ML_bmp_16_and(cube31, x, y);
  55. }
  56.  
  57. ML_display_vram();
  58. }
  59.  
  60. int AddIn_main(int isAppli, unsigned short OptionNum)
  61. {
  62.  
  63. ML_clear_vram();
  64.  
  65. //dessin sur fond noir
  66.  
  67. while (y1<4)
  68. {
  69. if (tableau[y1][x1] == 1)
  70. {
  71. ML_bmp_16_or(block, (x1*16), (y1*16));
  72. }
  73.  
  74. x1++;
  75. if (x1 == 8)
  76. {
  77. x1=0;
  78. y1++;
  79. }
  80. }
  81.  
  82. ML_bmp_16_and(cube10, x, y);
  83. ML_bmp_16_or(cube11, x, y);
  84. ML_display_vram();
  85.  
  86. while(IsKeyDown(KEY_CTRL_EXE))
  87. {}
  88. while(1){
  89. if(IsKeyDown(KEY_CTRL_LEFT)&&x>0&&tableau[y/16][(x-1)/16] == 0)
  90. {
  91. x--;
  92. dessin();
  93. Sleep(veille);
  94. }
  95. if(IsKeyDown(KEY_CTRL_RIGHT)&&x<112&&tableau[y/16][(x+16)/16] == 0)
  96. {
  97. x++;
  98. dessin();;
  99. Sleep(veille);
  100. }
  101. if(IsKeyDown(KEY_CTRL_UP)&&y>0&&tableau[(y-1)/16][(x)/16] == 0)
  102. {
  103. y--;
  104. dessin();
  105. Sleep(veille);
  106. }
  107. if(IsKeyDown(KEY_CTRL_DOWN)&&y<48&&tableau[(y+16)/16][(x)/16] == 0)
  108. {
  109. y++;
  110. dessin();;
  111. Sleep(veille);
  112. }
  113. if(IsKeyDown(KEY_CTRL_AC))return;
  114. }
  115. }
  116.  
  117. //A NE PAS TOUCHER
  118. #pragma section _BR_Size
  119. unsigned long BR_Size;
  120. #pragma section
  121. #pragma section _TOP
  122. int InitializeSystem(int isAppli, unsigned short OptionNum){return INIT_ADDIN_APPLICATION(isAppli, OptionNum);}
  123. #pragma section
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement