remove width and height arguments from configure callback; call configure callback after instantiating a new mode
This commit is contained in:
1 parent
e2dc328996
commit
d87a116957
6 files changed
+37
-38
No files matched your search
+1
-2
@@ -8,8 +8,7 @@ class Mode
|
||||
{
|
||||
public:
|
||||
virtual bool expose (GnomeScreensaver & gs) = 0;
|
||||
virtual bool configure (GnomeScreensaver & gs, int width,
|
||||
int height) = 0;
|
||||
virtual bool configure (GnomeScreensaver & gs) = 0;
|
||||
virtual bool update (GnomeScreensaver & gs) = 0;
|
||||
};
|
||||
|
||||
|
||||
+4
-17
@@ -9,39 +9,26 @@ bool Spin::expose (GnomeScreensaver & gs)
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(0, 0, -3.0);
|
||||
|
||||
glRotatef(gs.getTicks() / 1000.0 * 360.0 / 4.0, 0, 1, 0);
|
||||
m_logobox.draw();
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(1, 0.6, 0);
|
||||
glNormal3f(0, 0, 1);
|
||||
glVertex2f(1, 1);
|
||||
glVertex2f(-1, 1);
|
||||
glVertex2f(-1, -1);
|
||||
glVertex2f(1, 0);
|
||||
glEnd();
|
||||
glPopMatrix();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Spin::configure (GnomeScreensaver & gs, int width, int height)
|
||||
bool Spin::configure (GnomeScreensaver & gs)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
glViewport(0, 0, gs.getWidth(), gs.getHeight());
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(60.0, (double)width/(double)height, 0.01, 1000.0);
|
||||
gluPerspective(60.0, gs.getAspectRatio(), 0.01, 1000.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
// gluLookAt(0, 0, 0, 0, 0, 4, 0, 1, 0);
|
||||
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-2
@@ -10,8 +10,7 @@ class Spin : public Mode
|
||||
{
|
||||
public:
|
||||
bool expose (GnomeScreensaver & gs);
|
||||
bool configure (GnomeScreensaver & gs, int width,
|
||||
int height);
|
||||
bool configure (GnomeScreensaver & gs);
|
||||
bool update (GnomeScreensaver & gs);
|
||||
protected:
|
||||
LogoBox m_logobox;
|
||||
|
||||
Reference in new issue
Block a user