iDoc (1)
iDoc (1)
iDoc (1)
S. M. Shahriar Nirjon
Lecturer, Dept. of CSE, BUET
email: nirjon@cse.buet.ac.bd
Date: Feb 26, 2008
Abstract
1. Setup
Just copy the iGraphics folded in your PC. The folder contains the following files- GLUT.H,
GLUT32.LIB, GLUT32.DLL, iGraphics.h, iMain.cpp and iDoc.pdf.
2. Description of iMain.cpp
Users of iGraphics only have to edit, compile and run iMain.cpp using Vsual C++ 6. See the listing
of iMain.cpp with comments.
# include "iGraphics.h"
/*
Function iDraw() is called again and again by the system.
*/
void iDraw()
{
//place your drawing codes here
}
/*
Function iMouseMove() is called mouse is dragged while pressed.
(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 mouse is pressed/released.
(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 a key is hit.
key- holds the ASCII value of the key pressed.
*/
void iKeyboard(unsigned char key)
{
if(key == 'q')
{
exit(0);
}
//place your codes for other keys here
}
int main()
{
//place your own initialization codes here.
iInitialize(400, 400, "demooo");
return 0;
}
Fig: iMain.cpp
3. Functions in iGraphics.h
void iClear()
Descrition: Clears the screen.
Parameters: none
4. Why iEveryThing( ) ?
All the function names in iGraphics library starts with the character ‘i’. This is done- so
that, functions YOU write in your program don’t match with any library function.
5. Conclusion
iGraphics is still under development. In future versions, more new and exciting features
will be introduced.