vtimerlist.o vtimeredit.o voptionsmenu.o vrecordingmenu.o \
vchannellist.o vwelcome.o vvideolive.o vvideorec.o vepgsettimer.o \
vchannelselect.o vserverselect.o vconnect.o vepg.o vrecmove.o \
- vradiorec.o vaudioselector.o \
+ vradiorec.o vaudioselector.o vscreensaver.o \
vtabsviewman.o vremoteconfig.o \
widget.o wselectlist.o wjpeg.o wsymbol.o wbutton.o \
woptionbox.o wtextbox.o wwss.o \
--- /dev/null
+/*
+ Copyright 2004-2005 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "vscreensaver.h"
+
+VScreensaver::VScreensaver()
+{
+ setScreenPos(0, 0);
+ Video* video = Video::getInstance();
+ screenWidth = video->getScreenWidth();
+ screenHeight = video->getScreenHeight();
+ area.w = screenWidth;
+ area.h = screenHeight;
+ surface = Surface::getScreen();
+}
+
+VScreensaver::~VScreensaver()
+{
+ surface = NULL; // it's the screen. stop view base from killing it.
+ threadCancel();
+}
+
+void VScreensaver::draw()
+{
+ setBackgroundColour(Colour::BLACK);
+ View::draw();
+ threadStart();
+}
+
+int VScreensaver::handleCommand(int command)
+{
+ threadCancel();
+
+ return 4;
+}
+
+void VScreensaver::threadMethod()
+{
+ threadSetKillable();
+
+ // Config
+ int h = 50; // length of line
+ float deviation = 0.2; // how quickly can it change direction
+
+
+
+ int x[h];
+ int y[h];
+ int i;
+ float direction = 0;
+ float fx;
+ float fy;
+ float dd;
+ const float pi = 3.14159;
+ const float pi2 = 6.28318;
+ float halfdeviation = deviation / 2;
+
+ for(i = 1; i < h; i++)
+ {
+ x[i] = -1;
+ y[i] = -1;
+ }
+
+ fx = x[0] = 50;
+ fy = y[0] = 50;
+
+ while(1)
+ {
+ // Undraw oldest pixel
+ if ((x[h-1] != -1) && (y[h-1] != -1))
+ {
+ surface->drawPixel(x[h-1], y[h-1], Colour::BLACK.rgba());
+ }
+
+ for(i = h - 1; i > 0; i--)
+ {
+ x[i] = x[i-1];
+ y[i] = y[i-1];
+ }
+
+ dd = ((rand() / (double)RAND_MAX) * deviation) - halfdeviation;
+ direction += dd;
+
+ if (direction >= pi2) direction -= pi2;
+ if (direction < 0) direction += pi2;
+
+ fx += sin(direction);
+ fy += cos(direction);
+
+ if (fx < 0){ printf("AAA\n"); fx += screenWidth; }
+ if (fx >= screenWidth){ printf("BBB\n"); fx -= screenWidth; }
+ if (fy < 0){ printf("CCC\n"); fy += screenHeight; }
+ if (fy >= screenHeight){ printf("DDD\n"); fy -= screenHeight; }
+
+ x[0] = (int)fx;
+ y[0] = (int)fy;
+
+ surface->drawPixel(x[0], y[0], Colour::SELECTHIGHLIGHT.rgba());
+ MILLISLEEP(10);
+ }
+}
--- /dev/null
+/*
+ Copyright 2007 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef VSCREENSAVER_H
+#define VSCREENSAVER_H
+
+#include <stdlib.h>
+#include <time.h>
+#include <math.h>
+
+#include "defines.h"
+#include "log.h"
+#include "view.h"
+#include "remote.h"
+#include "colour.h"
+#include "video.h"
+#include "video.h"
+
+#ifdef WIN32
+#include "threadwin.h"
+#else
+#include "threadp.h"
+#endif
+
+
+class VScreensaver : public View, public Thread_TYPE
+{
+ public:
+ VScreensaver();
+ ~VScreensaver();
+
+ int handleCommand(int command);
+ void draw();
+
+ private:
+
+ virtual void threadMethod();
+ virtual void threadPostStopCleanup() {};
+
+ int screenHeight;
+ int screenWidth;
+};
+
+#endif