//Daca "Game over" e adavarat,naspa,daca nu continuam jocul.
if(!gameOver){
GameStatus();
DrawFood();
DrawSnake();
}
else
WelcomeScreen();
getFPS();
// Updatam ecranul
glutPostRedisplay();
glutSwapBuffers();
}
void Special(int key, int x, int y){
switch(key){
case GLUT_KEY_RIGHT :
if(direction != LEFT)
direction = RIGHT;
break;
case GLUT_KEY_LEFT :
if(direction != RIGHT)
direction = LEFT;
break;
case GLUT_KEY_UP :
if(direction != UP)
direction = Down;
break;
case GLUT_KEY_DOWN :
if(direction != Down)
direction = UP;
break;
}
}
void keyboard (unsigned char key, int x, int y)//Functii de baza pt miscarea viermelui
{
switch (key) {
//Toate rotatiile viermelui peste unghiurile X, Y, Z
case 'n' : Reset() ;//Functie de reset,care noi il mintim pe utilizator ca este de fapt pentru inceperea jocului (HAHA HIHI HEHE HOHO)
glutPostRedisplay();
break;
//ESC pentru a iesi.
case 27:
exit(0);
break;
default:
break;
}
}
int main(void){
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(_w,_h);
glutInitWindowPosition(80,80);
glutCreateWindow("Snake Game - (Marin Alexandru)");
glutSpecialFunc(Special);
glutKeyboardFunc(keyboard);
glutDisplayFunc(Display);
glutReshapeFunc(resize);
newFood();
Run(0);
Initialize();
glutMainLoop();}
The problem is that i am trying to change the camera mode to follow the head object.The problem is that i've find the function gluLookAt(),but i don't understand what variables to put in there. Should i put something like: