Advertisement
apl-mhd

RapidRollV4

Dec 22nd, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.23 KB | None | 0 0
  1. # include "iGraphics.h"
  2.  
  3. int circleY = 590,  circleX = 190;
  4. int firstX, firstY, firstMidY;
  5. //int firstX = 0, firstY = 0, firstMidY = 75;
  6.  
  7. struct xyCordinate{
  8.  
  9.     int leftX;
  10.     int leftY;
  11.  
  12.     int midX;
  13.     int midY;
  14.  
  15.     int rightX;
  16.     int rightY;
  17.  
  18.  
  19. };
  20. struct xyCordinate xyAxis[5];
  21.  
  22.  
  23. void assignXY(){  /* assign xy cordinate in a structer varuab*/
  24.  
  25.    
  26. }
  27.  
  28. void incrementY(){
  29.  
  30.     if (firstY >= 585){
  31.         firstY = 0;
  32.     }
  33.     else
  34.  
  35.         firstY += 4;
  36.     if (firstMidY >= 585)
  37.         firstMidY = 75;
  38.     else
  39.         firstMidY += 4;
  40.    
  41.     if (circleY < 0){/*circle incrementing decrementing section and initialize*/
  42.  
  43.         circleY = 590;
  44.  
  45.     }
  46.     else{
  47.         if ((circleY - firstMidY) <= 25 && circleX <260 && circleX>150){
  48.        
  49.             circleY += 4;
  50.  
  51.         }
  52.         else{
  53.             circleY -= 4;
  54.         }
  55.     }
  56.  
  57.    
  58. }
  59.  
  60. //leftX.xyAxis[1] = 100;
  61.  
  62. void iDraw()
  63. {
  64.  
  65.     iClear();
  66.     iSetColor(100, 200, 50);
  67.     iFilledCircle(circleX, circleY, 10);
  68.  
  69.     iSetColor(224, 91, 63); /* start first block*/
  70.  
  71.     iFilledRectangle(50, firstY, 100, 15); //first left block
  72.  
  73.     iFilledRectangle(150, firstMidY, 100, 15);  //mid
  74.  
  75.     iFilledRectangle(250, firstY, 100, 15);  //  first right Block
  76.  
  77.     /******Start second Block******/
  78.  
  79.     iSetColor(232, 44, 11);/*red*/
  80.  
  81.     iFilledRectangle(100, 150, 100, 15); //left
  82.  
  83.  
  84.  
  85.     iFilledRectangle(300, 150, 100, 15);  //right  end first Block
  86.  
  87.  
  88. }
  89.  
  90. void iMouseMove(int mx, int my)
  91. {
  92.  
  93.  
  94.     printf(" %d %d\n", mx, my);
  95. }
  96.  
  97. void iMouse(int button, int state, int mx, int my)
  98. {
  99.     if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
  100.     {
  101.  
  102.     }
  103.     if (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN)
  104.     {
  105.  
  106.     }
  107. }
  108.  
  109. void iKeyboard(unsigned char key)
  110. {
  111.     if (key == 'q')
  112.     {
  113.  
  114.     }
  115.  
  116. }
  117.  
  118.  
  119. void iSpecialKeyboard(unsigned char key)
  120. {
  121.     if (key == GLUT_KEY_UP)
  122.     {
  123.  
  124.  
  125.         //exit(0);
  126.     }
  127.  
  128.     if (key == GLUT_KEY_DOWN)
  129.     {
  130.         /*
  131.         if ((circleY - firstMidY) <= 25 && circleX <250 && circleX>150){
  132.             circleY = 590;
  133.  
  134.         }
  135.         else
  136.             circleY -= 4;
  137.         printf("%d\n", circleX);
  138.         //exit(0);
  139.         */
  140.     }
  141.  
  142.  
  143.     if (key == GLUT_KEY_LEFT)
  144.     {
  145.  
  146.         circleX -= 4;
  147.  
  148.         //exit(0);
  149.     }
  150.  
  151.     if (key == GLUT_KEY_RIGHT)
  152.     {
  153.         circleX += 4;
  154.  
  155.         //exit(0);
  156.     }
  157.  
  158. }
  159. int main()
  160. {
  161.     firstX = 0, firstY = 0, firstMidY = 75;
  162.  
  163.  
  164.     iSetTimer(10, incrementY);
  165.     iInitialize(400, 600, "demooo");
  166.     return 0;
  167. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement