Advertisement
apl-mhd

gamev1

Dec 5th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.05 KB | None | 0 0
  1. # include "iGraphics.h"
  2. /*
  3. function iDraw() is called again and again by the system.
  4. */
  5. void iDraw()
  6. {
  7.     //place your drawing codes here
  8.     iClear();
  9.  
  10.     iShowBMP(40, 50, "img/home.bmp");
  11.  
  12.     iShowBMP(150, 300, "img/newGame.bmp");
  13.     //iShowBMP(150, 00, "img/a.bmp");
  14.     iShowBMP(155, 250, "img/setting.bmp");
  15.     iShowBMP(150, 200, "img/highScore.bmp");
  16.     iShowBMP(160, 150, "img/exit.bmp");
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.     //void iText(GLdouble x, GLdouble y, char *str, void* font = GLUT_BITMAP_8_BY_13)
  26.  
  27. }
  28. /*
  29. function iMouseMove() is called when the user presses and drags the mouse.
  30. (mx, my) is the position where the mouse pointer is.
  31. */
  32. void iMouseMove(int mx, int my)
  33. {
  34.     //place your codes here
  35. }
  36. /*
  37. function iMouse() is called when the user presses/releases the mouse.
  38. (mx, my) is the position where the mouse pointer is.
  39. */
  40. void iMouse(int button, int state, int mx, int my)
  41. {
  42.     if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
  43.     {
  44.         //place your codes here
  45.     }
  46.     if (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN)
  47.     {
  48.         //place your codes here
  49.     }
  50. }
  51. /*
  52. function iKeyboard() is called whenever the user hits a key in keyboard.
  53. key- holds the ASCII value of the key pressed.
  54. */
  55. void iKeyboard(unsigned char key)
  56. {
  57.     if (key == 'q')
  58.     {
  59.         //do something with 'q'
  60.     }
  61.     //place your codes for other keys here
  62. }
  63. /*
  64. function iSpecialKeyboard() is called whenver user hits special keys likefunction
  65. keys, home, end, pg up, pg down, arraows etc. you have to use
  66. appropriate constants to detect them. A list is:
  67. GLUT_KEY_F1, GLUT_KEY_F2, GLUT_KEY_F3, GLUT_KEY_F4, GLUT_KEY_F5, GLUT_KEY_F6,
  68. GLUT_KEY_F7, GLUT_KEY_F8, GLUT_KEY_F9, GLUT_KEY_F10, GLUT_KEY_F11,
  69. GLUT_KEY_F12, GLUT_KEY_LEFT, GLUT_KEY_UP, GLUT_KEY_RIGHT, GLUT_KEY_DOWN,
  70. GLUT_KEY_PAGE UP, GLUT_KEY_PAGE DOWN, GLUT_KEY_HOME, GLUT_KEY_END,
  71. GLUT_KEY_INSERT */
  72. void iSpecialKeyboard(unsigned char key)
  73. {
  74.     if (key == GLUT_KEY_END)
  75.     {
  76.         exit(0);
  77.     }
  78.     //place your codes for other keys here
  79. }
  80. int main()
  81. {
  82.     //place your own initialization codes here.
  83.     iInitialize(400, 400, "demooo");
  84.     return 0;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement