From 1ce4e3a81b2c9af330cdefaaab85d70df95eb67a Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 11 Oct 2011 16:14:49 -0400 Subject: [PATCH] add skeleton Tunnel mode, no content yet --- modes/Tunnel.cc | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ modes/Tunnel.h | 28 ++++++++++++++++++++++++++++ src/dwss.cc | 3 ++- 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 modes/Tunnel.cc create mode 100644 modes/Tunnel.h diff --git a/modes/Tunnel.cc b/modes/Tunnel.cc new file mode 100644 index 0000000..f230bf4 --- /dev/null +++ b/modes/Tunnel.cc @@ -0,0 +1,49 @@ + +#include +#include +#include +#include +#include + +#include +#include + +#include "Tunnel.h" + +Tunnel::Tunnel() +{ + m_last_ticks = 0; + srand(time(NULL) + getpid()); +} + +Tunnel::~Tunnel() +{ +} + +bool Tunnel::expose (GnomeScreensaver & gs) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + return true; +} + +bool Tunnel::configure (GnomeScreensaver & gs) +{ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(60.0, gs.getAspectRatio() / gs.getNumMonitors(), + 0.01, 1000.0); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0); + + glViewport(0, 0, gs.getWidth(), gs.getHeight()); + + return true; +} + +bool Tunnel::update (GnomeScreensaver & gs) +{ + return true; +} diff --git a/modes/Tunnel.h b/modes/Tunnel.h new file mode 100644 index 0000000..1136e0d --- /dev/null +++ b/modes/Tunnel.h @@ -0,0 +1,28 @@ + +#ifndef TUNNEL_H +#define TUNNEL_H + +#include "LogoBox.h" +#include "Mode.h" +#include "GnomeScreensaver.h" + +class Tunnel : public Mode +{ + public: + Tunnel(); + ~Tunnel(); + bool expose (GnomeScreensaver & gs); + bool configure (GnomeScreensaver & gs); + bool update (GnomeScreensaver & gs); + protected: + LogoBox m_logobox; + int m_num_monitors; + uint64_t m_last_ticks; + void initMonitorInfo(); + void getRandomAxis(float (*axis)[3]); + uint32_t getRandomSwitchTime(); + float getRandomSpeed(); +}; + +#endif /* TUNNEL_H */ + diff --git a/src/dwss.cc b/src/dwss.cc index 96ea7b1..f515de7 100644 --- a/src/dwss.cc +++ b/src/dwss.cc @@ -34,8 +34,9 @@ static Mode *getMode(GnomeScreensaver & gs) { #if 0 return new Starfield(gs); -#endif return new Spin(); +#endif + return new Tunnel(); } int main (int argc, char *argv[])