main.cpp #6

  • //
  • guest/
  • sam_stafford/
  • scenesaver/
  • main.cpp
  • View
  • Commits
  • Open Download .zip Download (918 B)
#ifdef Scenesaver_GLUT

#include <GL/glut.h>
#include <stdio.h>

#include "pixel.h"
#include "world.h"

World* world;

void display()
{
	world->Display();
	glutSwapBuffers();
	glFlush();
}

void keyboard( unsigned char c, int, int )
{
	switch ( c )
	{
	case 'b':
		world->CycleDisplayBuffer();
		break;
	case 'c':
		world->CycleCameraMode();
		break;
	case 's':
		world->Save();
		break;
	}
	display();
}

void resize( int w, int h )
{
	world->Resize( w, h );
	display();
}

void timer( int )
{
	world->Step();
	glutPostRedisplay();
	glutTimerFunc( 1, timer, 0 );
}

int main( int argc, char** argv )
{
	world = new World( argc - 1, argv + 1 );

	glutInit( &argc, argv );
	glutInitDisplayMode( GLUT_DOUBLE | GLUT_ALPHA );
	glutCreateWindow( "Scenesaver" );

	glutDisplayFunc( display );
	glutKeyboardFunc( keyboard );
	glutReshapeFunc( resize );
	glutTimerFunc( 100, timer, 0 );

	glutMainLoop();
	return 0;
}

#endif
# Change User Description Committed
#6 4454 Sam Stafford Made "Scenesaver" the canonical capitalization throughout the output
strings.  Checking in a binary.
#5 4448 Sam Stafford Turn this thing into a Windows screensaver.
#4 4446 Sam Stafford Finished neural inputs, made size hereditary, auto-rotation of images
once a certain amount of diffs have been consumed, saving genomes at
finish.
#3 4441 Sam Stafford Ported chase-cam view.
#2 4433 Sam Stafford More work on this little project.
 The AI is still nonexistent.
#1 4429 Sam Stafford A bit of work in progress that currently works as a crude image diff
tool.