Advertisement
apl-mhd

rapidblockdebug

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