Advertisement
apl-mhd

Mamun

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