X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fglhanoi.c;h=6f52b3a1014e9f768dfb3cfaed5a24c4610e0c84;hb=aa75c7476aeaa84cf3abc192b376a8b03c325213;hp=d8d3d2a2dd9428ca8d7fd4b60e3a3ab46955a9ec;hpb=5f9c47ca98dd43d8f59b7c27d3fde6edfde4fe21;p=xscreensaver diff --git a/hacks/glx/glhanoi.c b/hacks/glx/glhanoi.c index d8d3d2a2..6f52b3a1 100644 --- a/hacks/glx/glhanoi.c +++ b/hacks/glx/glhanoi.c @@ -345,7 +345,7 @@ static void moveSetup(glhcfg *glhanoi, Disk * disk) int dst = glhanoi->dst; GLfloat theta; GLfloat sintheta, costheta; - double absx, dh; + double dh; double dx, dz; /* total x and z distances from src to dst */ Pole *poleSrc, *poleDst; @@ -385,7 +385,7 @@ static void moveSetup(glhcfg *glhanoi, Disk * disk) /* horizontal distance to travel? */ /* was: absx = sqrt(disk->xmax - disk->xmin); */ dh = distance(poleSrc->position, poleDst->position); - absx = sqrt(dh); + /* absx = sqrt(dh); */ ymax = glhanoi->poleHeight + dh; if(glhanoi->state == FINISHED) { ymax += dh * (double)(glhanoi->numberOfDisks - disk->id); @@ -888,7 +888,6 @@ static int drawTube(GLdouble bottomRadius, GLdouble topRadius, GLint lastSlice = nSlice - 1; GLfloat radius; GLfloat innerRadius; - GLfloat maxRadius; if(bottomThickness > bottomRadius) { bottomThickness = bottomRadius; @@ -902,11 +901,11 @@ static int drawTube(GLdouble bottomRadius, GLdouble topRadius, if(topThickness < 0.0) { topThickness = 0.0; } - if(topRadius >= bottomRadius) { +/* if(topRadius >= bottomRadius) { maxRadius = topRadius; } else { maxRadius = bottomRadius; - } + } */ /* bottom */ y = 0.0; @@ -1666,7 +1665,6 @@ static void initTowers(glhcfg *glhanoi) glPopMatrix(); } - glPopMatrix(); glEndList(); } @@ -1891,6 +1889,11 @@ ENTRYPOINT void init_glhanoi(ModeInfo * mi) (int)((1 - sqrt(frand(1.0))) * (glhanoi->numberOfDisks - 1)); glhanoi->wire = MI_IS_WIREFRAME(mi); + +# ifdef HAVE_JWZGLES /* #### glPolygonMode other than GL_FILL unimplemented */ + glhanoi->wire = 0; +# endif + glhanoi->light = light; glhanoi->fog = fog; glhanoi->texture = texture; @@ -1959,10 +1962,20 @@ ENTRYPOINT void draw_glhanoi(ModeInfo * mi) mi->polygon_count = 0; glLoadIdentity(); + glRotatef(current_device_rotation(), 0, 0, 1); update_glhanoi(glhanoi); updateView(glhanoi); +# 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 + if(!glhanoi->wire && glhanoi->texture) { glEnable(GL_TEXTURE_2D); } @@ -1989,6 +2002,8 @@ ENTRYPOINT Bool glhanoi_handle_event(ModeInfo * mi, XEvent * event) { glhcfg *glhanoi = &glhanoi_cfg[MI_SCREEN(mi)]; + /* #### this is all wrong on iOS -- should be using gltrackball. */ + if(event->xany.type == ButtonPress && event->xbutton.button == Button1) { glhanoi->button_down_p = True; glhanoi->drag_x = event->xbutton.x; @@ -2025,6 +2040,13 @@ ENTRYPOINT Bool glhanoi_handle_event(ModeInfo * mi, XEvent * event) return True; } +#if 0 /* #### doesn't work */ + else if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event)) + { + changeState(glhanoi, START); + return True; + } +#endif return False; }