Advertisement
apl-mhd

rapidRoolFixFirstBlock

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