X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fatlantis.c;h=04bde12e5a5434f62c8543019428cedc83da6fb3;hb=78add6e627ee5f10e1fa6f3852602ea5066eee5a;hp=c310a69a770a803be4660df2e9ce0062e9131251;hpb=4361b69d3178d7fc98d0388f9a223af6c2651aba;p=xscreensaver diff --git a/hacks/glx/atlantis.c b/hacks/glx/atlantis.c index c310a69a..04bde12e 100644 --- a/hacks/glx/atlantis.c +++ b/hacks/glx/atlantis.c @@ -113,7 +113,7 @@ static const char sccsid[] = "@(#)atlantis.c 5.08 2003/04/09 xlockmore"; "*size: 6000 \n" \ "*wireframe: False \n" # define release_atlantis 0 -# define atlantis_handle_event 0 +# define atlantis_handle_event xlockmore_no_events # include "xlockmore.h" /* from the xscreensaver distribution */ #else /* !STANDALONE */ # include "xlock.h" /* from the xlockmore distribution */ @@ -157,7 +157,7 @@ ENTRYPOINT ModeSpecOpt atlantis_opts = #ifdef USE_MODULES ModStruct atlantis_description = {"atlantis", "init_atlantis", "draw_atlantis", NULL, - "refresh_atlantis", "change_atlantis", NULL, &atlantis_opts, + "refresh_atlantis", "change_atlantis", "free_atlantis", &atlantis_opts, 1000, NUM_SHARKS, SHARKSPEED, SHARKSIZE, 64, 1.0, "", "Shows moving sharks/whales/dolphin", 0, NULL}; @@ -165,19 +165,18 @@ ModStruct atlantis_description = static atlantisstruct *atlantis = NULL; -#include "xpm-ximage.h" +#include "ximage-loader.h" -#include "../images/sea-texture.xpm" +#include "images/gen/sea-texture_png.h" static void parse_image_data(ModeInfo *mi) { atlantisstruct *ap = &atlantis[MI_SCREEN(mi)]; - ap->texture = xpm_to_ximage (mi->dpy, - mi->xgwa.visual, - mi->xgwa.colormap, - sea_texture); + ap->texture = image_data_to_ximage (mi->dpy, mi->xgwa.visual, + sea_texture_png, + sizeof(sea_texture_png)); } static void @@ -322,14 +321,22 @@ Init(ModeInfo *mi) ENTRYPOINT void reshape_atlantis(ModeInfo * mi, int width, int height) { - atlantisstruct *ap = &atlantis[MI_SCREEN(mi)]; + double h = (GLfloat) height / (GLfloat) width; + atlantisstruct *ap = &atlantis[MI_SCREEN(mi)]; + int y = 0; + + if (width > height * 5) { /* tiny window: show middle */ + height = width * 9/16; + y = -height/2; + h = height / (GLfloat) width; + } - glViewport(0, 0, ap->WinW = (GLint) width, ap->WinH = (GLint) height); + glViewport(0, y, ap->WinW = (GLint) width, ap->WinH = (GLint) height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(400.0, (GLdouble) width / (GLdouble) height, 1.0, 2000000.0); - glMatrixMode(GL_MODELVIEW); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(400.0, 1/h, 1.0, 2000000.0); + glMatrixMode(GL_MODELVIEW); } @@ -368,6 +375,9 @@ clear_tank (atlantisstruct * ap) glVertex3f ( 1, 1, 1); glVertex3f (-1, 1, 1); glEnd(); glEnable (GL_LIGHTING); + + /* Need to reset this because jwzgles conflates color and material */ + glColor3f (0.0, 0.1, 0.2); } glPopMatrix(); } @@ -435,8 +445,6 @@ AllDisplay(atlantisstruct * ap) *----------------------------------------------------------------------------- */ -static void free_atlantis(ModeInfo * mi); - /* *----------------------------------------------------------------------------- * Initialize atlantis. Called each time the window changes. @@ -451,7 +459,7 @@ init_atlantis(ModeInfo * mi) Display *display = MI_DISPLAY(mi); Window window = MI_WINDOW(mi); - MI_INIT(mi, atlantis, free_atlantis); + MI_INIT(mi, atlantis); ap = &atlantis[screen]; ap->num_sharks = MI_COUNT(mi); if (ap->sharks == NULL) { @@ -534,7 +542,7 @@ draw_atlantis(ModeInfo * mi) *----------------------------------------------------------------------------- */ -static void +ENTRYPOINT void free_atlantis(ModeInfo * mi) { #if 0 @@ -545,12 +553,12 @@ free_atlantis(ModeInfo * mi) #endif } +#ifndef STANDALONE ENTRYPOINT void refresh_atlantis(ModeInfo * mi) { } -#ifndef STANDALONE ENTRYPOINT void change_atlantis(ModeInfo * mi) {