"*fpsTop: True \n" \
"*wireframe: False \n"
-# define refresh_sproingies 0
+# define release_sproingies 0
# define sproingies_handle_event 0
# include "xlockmore.h" /* from the xscreensaver distribution */
#else /* !STANDALONE */
#ifdef USE_MODULES
ModStruct sproingies_description =
-{"sproingies", "init_sproingies", "draw_sproingies", "release_sproingies",
- "refresh_sproingies", "init_sproingies", NULL, &sproingies_opts,
+{"sproingies", "init_sproingies", "draw_sproingies", NULL,
+ "refresh_sproingies", "init_sproingies", "free_sproingies", &sproingies_opts,
1000, 5, 0, 400, 4, 1.0, "",
"Shows Sproingies! Nontoxic. Safe for pets and small children", 0, NULL};
#include <time.h>
-void NextSproingie(int screen);
-void NextSproingieDisplay(int screen,int pause);
-void DisplaySproingies(int screen,int pause);
-void ReshapeSproingies(int w, int h);
-void CleanupSproingies(int screen);
-void InitSproingies(int wfmode, int grnd, int mspr, int smrtspr,
- int screen, int numscreens, int mono);
-
typedef struct {
GLfloat view_rotx, view_roty, view_rotz;
GLint gear1, gear2, gear3;
GLXContext *glx_context;
int mono;
Window window;
+ sp_instance si;
} sproingiesstruct;
static sproingiesstruct *sproingies = NULL;
sproingiesstruct *sp;
int wfmode = 0, grnd = 0, mspr, w, h;
- if (sproingies == NULL) {
- if ((sproingies = (sproingiesstruct *) calloc(MI_NUM_SCREENS(mi),
- sizeof (sproingiesstruct))) == NULL)
- return;
- }
+ MI_INIT (mi, sproingies);
sp = &sproingies[screen];
sp->mono = (MI_IS_MONO(mi) ? 1 : 0);
mspr = 100;
/* wireframe, ground, maxsproingies */
- InitSproingies(wfmode, grnd, mspr, smrt_spr, MI_SCREEN(mi), MI_NUM_SCREENS(mi), sp->mono);
+ InitSproingies(&sp->si, wfmode, grnd, mspr, smrt_spr, sp->mono);
/* Viewport is specified size if size >= MINSIZE && size < screensize */
if (size == 0) {
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- DisplaySproingies(MI_SCREEN(mi),mi->pause);
+ DisplaySproingies(&sp->si);
} else {
MI_CLEARWINDOW(mi);
glDrawBuffer(GL_BACK);
glXMakeCurrent(display, window, *(sp->glx_context));
- NextSproingieDisplay(MI_SCREEN(mi),mi->pause); /* It will swap. */
+ glPushMatrix();
+ glRotatef(current_device_rotation(), 0, 0, 1);
+ NextSproingieDisplay(&sp->si); /* It will swap. */
+ glPopMatrix();
if (mi->fps_p) do_fps (mi);
glFinish();
ENTRYPOINT void
-release_sproingies (ModeInfo * mi)
+free_sproingies (ModeInfo * mi)
{
- if (sproingies != NULL) {
- int screen;
-
- for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) {
- sproingiesstruct *sp = &sproingies[screen];
-
- if (sp->glx_context) {
+ sproingiesstruct *sp = &sproingies[MI_SCREEN(mi)];
- glXMakeCurrent(MI_DISPLAY(mi), sp->window, *(sp->glx_context));
- CleanupSproingies(MI_SCREEN(mi));
- }
- }
+ if (sp->glx_context) {
- (void) free((void *) sproingies);
- sproingies = NULL;
+ glXMakeCurrent(MI_DISPLAY(mi), sp->window, *(sp->glx_context));
+ CleanupSproingies(&sp->si);
}
- FreeAllGL(mi);
}
XSCREENSAVER_MODULE ("Sproingies", sproingies)