dwss/dwss.cc
2010-11-25 23:06:52 -05:00

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;
#define MAX_ASPECT (16.0/9.0*1.02)
static int n_monitors = 1;
static Mode *current_mode;
static bool expose (GnomeScreensaver & gs)
{
return current_mode->expose(gs);
}
static bool configure (GnomeScreensaver & gs, int width, int height)
{
for (n_monitors = 1;
(double)width/(double)n_monitors/(double)height > MAX_ASPECT;
n_monitors++)
;
return current_mode->configure(gs, width, height);
}
static bool update (GnomeScreensaver & gs)
{
return current_mode->update(gs);
}
int main (int argc, char *argv[])
{
Mode *modes[] = {
new Spin()
};
current_mode = modes[0];
GnomeScreensaver gs(&argc, &argv, configure, expose, update, 12);
gs.mainloop();
for (int i = 0; i < sizeof(modes)/sizeof(modes[0]); i++)
delete modes[i];
return 0;
}