Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include "iGraphics.h"
- /*
- function iDraw() is called again and again by the system.
- */
- void iDraw()
- {
- //place your drawing codes here
- iClear();
- iShowBMP(40, 50, "img/home.bmp");
- iShowBMP(150, 300, "img/newGame.bmp");
- //iShowBMP(150, 00, "img/a.bmp");
- iShowBMP(155, 250, "img/setting.bmp");
- iShowBMP(150, 200, "img/highScore.bmp");
- iShowBMP(160, 150, "img/exit.bmp");
- //void iText(GLdouble x, GLdouble y, char *str, void* font = GLUT_BITMAP_8_BY_13)
- }
- /*
- function iMouseMove() is called when the user presses and drags the mouse.
- (mx, my) is the position where the mouse pointer is.
- */
- void iMouseMove(int mx, int my)
- {
- //place your codes here
- }
- /*
- function iMouse() is called when the user presses/releases the mouse.
- (mx, my) is the position where the mouse pointer is.
- */
- void iMouse(int button, int state, int mx, int my)
- {
- if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
- {
- //place your codes here
- }
- if (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN)
- {
- //place your codes here
- }
- }
- /*
- function iKeyboard() is called whenever the user hits a key in keyboard.
- key- holds the ASCII value of the key pressed.
- */
- void iKeyboard(unsigned char key)
- {
- if (key == 'q')
- {
- //do something with 'q'
- }
- //place your codes for other keys here
- }
- /*
- function iSpecialKeyboard() is called whenver user hits special keys likefunction
- keys, home, end, pg up, pg down, arraows etc. you have to use
- appropriate constants to detect them. A list is:
- GLUT_KEY_F1, GLUT_KEY_F2, GLUT_KEY_F3, GLUT_KEY_F4, GLUT_KEY_F5, GLUT_KEY_F6,
- GLUT_KEY_F7, GLUT_KEY_F8, GLUT_KEY_F9, GLUT_KEY_F10, GLUT_KEY_F11,
- GLUT_KEY_F12, GLUT_KEY_LEFT, GLUT_KEY_UP, GLUT_KEY_RIGHT, GLUT_KEY_DOWN,
- GLUT_KEY_PAGE UP, GLUT_KEY_PAGE DOWN, GLUT_KEY_HOME, GLUT_KEY_END,
- GLUT_KEY_INSERT */
- void iSpecialKeyboard(unsigned char key)
- {
- if (key == GLUT_KEY_END)
- {
- exit(0);
- }
- //place your codes for other keys here
- }
- int main()
- {
- //place your own initialization codes here.
- iInitialize(400, 400, "demooo");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement