forked from karpathy/scriptsbots
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
43 lines (33 loc) · 1.25 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "GLView.h"
#include "World.h"
#include "config.h"
#ifdef LOCAL_GLUT32
#include "glut.h"
#else
#include <GL/glut.h>
#endif
#include <stdio.h>
GLView* GLVIEW = new GLView(0);
int main(int argc, char **argv) {
srand(time(0));
if (conf::WIDTH%conf::CZ!=0 || conf::HEIGHT%conf::CZ!=0) printf("CAREFUL! The cell size variable conf::CZ should divide evenly into both conf::WIDTH and conf::HEIGHT! It doesn't right now!");
printf("p= pause, d= toggle drawing (for faster computation), f= draw food too, += faster, -= slower\n");
printf("Pan around by holding down right mouse button, and zoom by holding down middle button.\n");
World* world = new World();
GLVIEW->setWorld(world);
//GLUT SETUP
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(30,30);
glutInitWindowSize(conf::WWIDTH,conf::WHEIGHT);
glutCreateWindow("Scriptbots");
glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
glutDisplayFunc(gl_renderScene);
glutIdleFunc(gl_handleIdle);
glutReshapeFunc(gl_changeSize);
glutKeyboardFunc(gl_processNormalKeys);
glutMouseFunc(gl_processMouse);
glutMotionFunc(gl_processMouseActiveMotion);
glutMainLoop();
return 0;
}