Advertisement
apl-mhd

gamev1

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