X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fglsnake.c;h=1d8ef965a10a73c398d5125e300d8ebd0d5cec13;hb=4361b69d3178d7fc98d0388f9a223af6c2651aba;hp=2117a93889529911070e23ae08ac47baca399dd6;hpb=6afd6db0ae9396cd7ff897ade597cd5483f49b0e;p=xscreensaver diff --git a/hacks/glx/glsnake.c b/hacks/glx/glsnake.c index 2117a938..1d8ef965 100644 --- a/hacks/glx/glsnake.c +++ b/hacks/glx/glsnake.c @@ -28,13 +28,16 @@ #ifdef HAVE_GLUT # include #else -# ifdef HAVE_COCOA +# ifdef HAVE_JWXYZ # define HAVE_GETTIMEOFDAY # else # include # include # endif #endif +# ifdef HAVE_ANDROID +# include +#endif #ifdef HAVE_JWZGLES # include "jwzgles.h" @@ -149,15 +152,15 @@ static GLfloat angvel; #define DEFAULTS "*delay: 30000 \n" \ "*count: 30 \n" \ "*showFPS: False \n" \ - "*labelfont: -*-helvetica-medium-r-normal-*-180-*\n" \ - + "*suppressRotationAnimation: True\n" \ + "*labelfont: -*-helvetica-medium-r-normal-*-*-180-*-*-*-*-*-*\n" \ #undef countof #define countof(x) (sizeof((x))/sizeof((*x))) #include "xlockmore.h" -#include "glxfonts.h" +#include "texfont.h" static XrmOptionDescRec opts[] = { { "-explode", ".explode", XrmoptionSepArg, DEF_EXPLODE }, @@ -1458,13 +1461,7 @@ ModeInfo * mi struct glsnake_cfg * bp; /* set up the conf struct and glx contexts */ - if (!glc) { - glc = (struct glsnake_cfg *) calloc(MI_NUM_SCREENS(mi), sizeof(struct glsnake_cfg)); - if (!glc) { - fprintf(stderr, "%s: out of memory\n", progname); - exit(1); - } - } + MI_INIT(mi, glc, NULL); bp = &glc[MI_SCREEN(mi)]; if ((bp->glx_context = init_GL(mi)) != NULL) { @@ -1733,10 +1730,9 @@ static void draw_title( glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, s[i++]); } #else - print_gl_string(mi->dpy, bp->font_data, - mi->xgwa.width, mi->xgwa.height, - 10.0, (float) mi->xgwa.height - 10.0, - s, False); + print_texture_label (mi->dpy, bp->font_data, + mi->xgwa.width, mi->xgwa.height, + 1, s); #endif } glPopMatrix(); @@ -2265,6 +2261,15 @@ ENTRYPOINT void glsnake_display( glRotatef(yspin, 0.0, 1.0, 0.0); glRotatef(zspin, 0.0, 0.0, 1.0); +# ifdef HAVE_MOBILE /* Keep it the same relative size when rotated. */ + { + GLfloat h = MI_HEIGHT(mi) / (GLfloat) MI_WIDTH(mi); + int o = (int) current_device_rotation(); + if (o != 0 && o != 180 && o != -180) + glScalef (1/h, 1/h, 1/h); + } +# endif + /* now draw each node along the snake -- this is quite ugly :p */ mi->polygon_count = 0; for (i = 0; i < NODE_COUNT; i++) {