Advertisement
apl-mhd

gameRapidRool

Dec 18th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.07 KB | None | 0 0
  1. # include "iGraphics.h"
  2. /*
  3. function iDraw() is called again and again by the system.
  4. */
  5.  
  6. double counter = 0, increse = 50, circleYaxis = 20, circleXaxis=200;
  7.  
  8.  
  9.  
  10.  
  11. void ipointIncrese(){
  12.  
  13.     increse += 1;
  14.  
  15.     circleYaxis -= 1;
  16.  
  17.        
  18. }
  19.  
  20.  
  21. void iDraw()
  22. {
  23.     //place your drawing codes here
  24.     iClear();
  25.  
  26.     //iSetColor(255, 255, 255);
  27.  
  28.     //iShowBMP(0, 0, "img/home.bmp");
  29.  
  30.     //iShowBMP(150, 300, "img/newGame.bmp");
  31.     //iShowBMP(150, 00, "img/a.bmp");
  32.     //iShowBMP(155, 250, "img/setting.bmp");
  33.     //iShowBMP(150, 200, "img/highScore.bmp");
  34.     //iShowBMP(160, 150, "img/exit.bmp");
  35.  
  36.     iSetColor(255, 255, 0);
  37.     //iPoint(0, 0, increse);
  38.     iFilledCircle(circleXaxis, circleYaxis, 10);
  39.  
  40.     if (circleXaxis == 0 && circleYaxis == 0){
  41.    
  42.         circleXaxis = 500;
  43.         circleYaxis = 20;
  44.     }
  45.  
  46.     if (increse == 500){
  47.         increse = 50;
  48.  
  49.     }
  50.    
  51.     if (circleYaxis < increse){
  52.    
  53.         circleYaxis += 1;
  54.  
  55.     }
  56.  
  57.     iFilledRectangle(10, increse, 100, 10);
  58.     iFilledRectangle(300, increse, 100, 10);
  59.     iFilledRectangle(150, increse+30, 100, 10);
  60.  
  61.     //iFilledRectangle(10, 500, 100, 20);
  62.     //void iText(GLdouble x, GLdouble y, char *str, void* font = GLUT_BITMAP_8_BY_13)
  63.  
  64. }
  65. /*
  66. function iMouseMove() is called when the user presses and drags the mouse.
  67. (mx, my) is the position where the mouse pointer is.
  68. */
  69. void iMouseMove(int mx, int my)
  70. {
  71.  
  72.  
  73. printf(" %d %d\n",  mx, my);
  74. }
  75. /*
  76. function iMouse() is called when the user presses/releases the mouse.
  77. (mx, my) is the position where the mouse pointer is.
  78. */
  79. void iMouse(int button, int state, int mx, int my)
  80. {
  81.     if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
  82.     {
  83.        
  84.  
  85.        
  86.         //xCo = 10;
  87.         //iSetColor(255, 0, 0);
  88.  
  89.         //iRectangle(10, 20, 100, 200);
  90.  
  91.     }
  92.     if (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN)
  93.     {
  94.         //place your codes here
  95.     }
  96. }
  97. /*
  98. function iKeyboard() is called whenever the user hits a key in keyboard.
  99. key- holds the ASCII value of the key pressed.
  100. */
  101. void iKeyboard(unsigned char key)
  102. {
  103.     if (key == 'q')
  104.     {
  105.         //do something with 'q'
  106.     }
  107.     //place your codes for other keys here
  108. }
  109. /*
  110. function iSpecialKeyboard() is called whenver user hits special keys likefunction
  111. keys, home, end, pg up, pg down, arraows etc. you have to use
  112. appropriate constants to detect them. A list is:
  113. GLUT_KEY_F1, GLUT_KEY_F2, GLUT_KEY_F3, GLUT_KEY_F4, GLUT_KEY_F5, GLUT_KEY_F6,
  114. GLUT_KEY_F7, GLUT_KEY_F8, GLUT_KEY_F9, GLUT_KEY_F10, GLUT_KEY_F11,
  115. GLUT_KEY_F12, GLUT_KEY_LEFT, GLUT_KEY_UP, GLUT_KEY_RIGHT, GLUT_KEY_DOWN,
  116. GLUT_KEY_PAGE UP, GLUT_KEY_PAGE DOWN, GLUT_KEY_HOME, GLUT_KEY_END,
  117. GLUT_KEY_INSERT */
  118. void iSpecialKeyboard(unsigned char key)
  119. {
  120.     if (key == GLUT_KEY_UP)
  121.     {
  122.         if (circleYaxis<=500)
  123.         circleYaxis += 20;
  124.         //exit(0);
  125.     }
  126.  
  127.     if (key == GLUT_KEY_DOWN)
  128.     {
  129.  
  130.         circleYaxis -= 20;
  131.         //exit(0);
  132.     }
  133.  
  134.  
  135.     if (key == GLUT_KEY_LEFT)
  136.     {
  137.  
  138.         circleXaxis -= 20;
  139.         //exit(0);
  140.     }
  141.  
  142.     if (key == GLUT_KEY_RIGHT)
  143.     {
  144.  
  145.         circleXaxis += 20;
  146.         //exit(0);
  147.     }
  148.  
  149.  
  150.     //place your codes for other keys here
  151. }
  152. int main()
  153. {
  154.     //place your own initialization codes here.
  155.  
  156.     iSetTimer(1, ipointIncrese);
  157.     iInitialize(400, 600, "demooo");
  158.     return 0;
  159. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement