X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fflurry.c;h=f2b74ff862230ed60029e682af73a7fc78797466;hb=7b34ef992563d7bcbb64cc5597dc45fa24470b05;hp=63b89f666a83b42b49d62fa14a66e14e4a44325d;hpb=2c902d6065f9856adf31e8540a94f1e42e68e905;p=xscreensaver diff --git a/hacks/glx/flurry.c b/hacks/glx/flurry.c index 63b89f66..f2b74ff8 100644 --- a/hacks/glx/flurry.c +++ b/hacks/glx/flurry.c @@ -37,29 +37,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* flurry */ -#if !defined( lint ) && !defined( SABER ) +#if 0 static const char sccsid[] = "@(#)flurry.c 4.07 97/11/24 xlockmore"; - #endif -/*- - * due to a Bug/feature in VMS X11/Intrinsic.h has to be placed before xlock. - * otherwise caddr_t is not defined correctly - */ - -#define DEF_PRESET "classic" +#define DEF_PRESET "random" #define DEF_BRIGHTNESS "8" -#include - -# define PROGCLASS "Flurry" -# define HACK_INIT init_flurry -# define HACK_DRAW draw_flurry -# define HACK_RESHAPE reshape_flurry -# define flurry_opts xlockmore_opts -# define DEFAULTS "*showFPS: False \n" \ - "*preset: " DEF_PRESET " \n" +# define DEFAULTS "*delay: 10000 \n" \ + "*showFPS: False \n" +# define refresh_flurry 0 +# define flurry_handle_event 0 # include "xlockmore.h" /* from the xscreensaver distribution */ #ifdef USE_GL @@ -71,12 +60,12 @@ static XrmOptionDescRec opts[] = { }; static argtype vars[] = { - {(caddr_t *) &preset_str, "preset", "Preset", DEF_PRESET, t_String}, + {&preset_str, "preset", "Preset", DEF_PRESET, t_String}, }; #define countof(x) (sizeof((x))/sizeof((*x))) -ModeSpecOpt flurry_opts = {countof(opts), opts, countof(vars), vars, NULL}; +ENTRYPOINT ModeSpecOpt flurry_opts = {countof(opts), opts, countof(vars), vars, NULL}; #ifdef USE_MODULES ModStruct flurry_description = { @@ -97,18 +86,21 @@ ModStruct flurry_description = { #endif -#include - #include "flurry.h" global_info_t *flurry_info = NULL; static double gTimeCounter = 0.0; +static double currentTime(void) { struct timeval tv; - - gettimeofday(&tv, NULL); +# ifdef GETTIMEOFDAY_TWO_ARGS + struct timezone tzp; + gettimeofday(&tv, &tzp); +# else + gettimeofday(&tv); +# endif return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0; } @@ -132,6 +124,8 @@ static int IsAltiVecAvailable(void) #endif #endif + +static void delete_flurry_info(flurry_info_t *flurry) { int i; @@ -142,9 +136,10 @@ void delete_flurry_info(flurry_info_t *flurry) { free(flurry->spark[i]); } - free(flurry); + /* free(flurry); */ } +static flurry_info_t *new_flurry_info(global_info_t *global, int streams, ColorModes colour, float thickness, float speed, double bf) { int i,k; @@ -189,6 +184,7 @@ flurry_info_t *new_flurry_info(global_info_t *global, int streams, ColorModes co return flurry; } +static void GLSetupRC(global_info_t *global) { /* setup the defaults for OpenGL */ @@ -228,6 +224,7 @@ void GLSetupRC(global_info_t *global) #endif /* 0 */ } +static void GLRenderScene(global_info_t *global, flurry_info_t *flurry, double b) { int i; @@ -312,6 +309,7 @@ void GLRenderScene(global_info_t *global, flurry_info_t *flurry, double b) glDisable(GL_TEXTURE_2D); } +static void GLResize(global_info_t *global, float w, float h) { global->sys_glWidth = w; @@ -319,7 +317,7 @@ void GLResize(global_info_t *global, float w, float h) } /* new window size or exposure */ -void reshape_flurry(ModeInfo *mi, int width, int height) +ENTRYPOINT void reshape_flurry(ModeInfo *mi, int width, int height) { global_info_t *global = flurry_info + MI_SCREEN(mi); @@ -339,7 +337,7 @@ void reshape_flurry(ModeInfo *mi, int width, int height) GLResize(global, (float)width, (float)height); } -void +ENTRYPOINT void init_flurry(ModeInfo * mi) { int screen = MI_SCREEN(mi); @@ -405,7 +403,7 @@ init_flurry(ModeInfo * mi) case PRESET_FIRE: { flurry_info_t *flurry; - flurry = new_flurry_info(global, 12, slowCyclicColorMode, 10000.0, 0.0, 1.0); + flurry = new_flurry_info(global, 12, slowCyclicColorMode, 10000.0, 0.2, 1.0); flurry->next = global->flurry; global->flurry = flurry; break; @@ -477,7 +475,7 @@ init_flurry(ModeInfo * mi) } } -void +ENTRYPOINT void draw_flurry(ModeInfo * mi) { static int first = 1; @@ -545,7 +543,7 @@ draw_flurry(ModeInfo * mi) glXSwapBuffers(display, window); } -void +ENTRYPOINT void release_flurry(ModeInfo * mi) { if (flurry_info != NULL) { @@ -569,4 +567,6 @@ release_flurry(ModeInfo * mi) FreeAllGL(mi); } +XSCREENSAVER_MODULE ("Flurry", flurry) + #endif