57 lines
1.0 KiB
C++
57 lines
1.0 KiB
C++
|
|
#include <math.h>
|
|
#include <stdlib.h>
|
|
#include <sysexits.h>
|
|
#include <time.h>
|
|
#include <sys/time.h>
|
|
|
|
#include <GL/gl.h>
|
|
#include <GL/glu.h>
|
|
|
|
#include "GnomeScreensaver.h"
|
|
#include "modes.h"
|
|
|
|
using namespace std;
|
|
|
|
static Mode *current_mode = NULL;
|
|
|
|
static bool expose (GnomeScreensaver & gs)
|
|
{
|
|
return current_mode != NULL ? current_mode->expose(gs) : true;
|
|
}
|
|
|
|
static bool configure (GnomeScreensaver & gs)
|
|
{
|
|
return current_mode != NULL ? current_mode->configure(gs) : true;
|
|
}
|
|
|
|
static bool update (GnomeScreensaver & gs)
|
|
{
|
|
return current_mode != NULL ? current_mode->update(gs) : true;
|
|
}
|
|
|
|
int main (int argc, char *argv[])
|
|
{
|
|
GnomeScreensaver gs(&argc, &argv, configure, expose, update, 12);
|
|
|
|
Mode *modes[] = {
|
|
new Spin(),
|
|
new Flip()
|
|
};
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
glEnable(GL_LIGHTING);
|
|
glEnable(GL_LIGHT0);
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
modes[0]->configure(gs);
|
|
current_mode = modes[0];
|
|
|
|
gs.mainloop();
|
|
|
|
for (int i = 0; i < sizeof(modes)/sizeof(modes[0]); i++)
|
|
delete modes[i];
|
|
|
|
return 0;
|
|
}
|