#ifdef USE_GL /* whole file */
-#ifndef HAVE_COCOA
+#ifndef HAVE_JWXYZ
# include <GL/glu.h>
#endif
} topBlockSTATE;
/* parameter vars */
-Bool override;
-Bool rotate;
-Bool follow;
-Bool drawCarpet;
-Bool drawBlob;
-Bool drawNipples;
-GLfloat rotateSpeed;
-GLfloat camX;
-GLfloat camY;
-GLfloat camZ;
-GLfloat dropSpeed;
-int maxFalling;
-int maxColors;
-int size;
-int spawn;
-int resolution;
+static Bool override;
+static Bool rotate;
+static Bool follow;
+static Bool drawCarpet;
+static Bool drawBlob;
+static Bool drawNipples;
+static GLfloat rotateSpeed;
+static GLfloat camX;
+static GLfloat camY;
+static GLfloat camZ;
+static GLfloat dropSpeed;
+static int maxFalling;
+static int maxColors;
+static int size;
+static int spawn;
+static int resolution;
static XrmOptionDescRec opts[] = {
{ "-size", ".size", XrmoptionSepArg, 0 },
static topBlockSTATE *tbs = NULL;
-ModeSpecOpt topBlock_opts = {countof(opts), opts, countof(vars), vars, NULL};
+static ModeSpecOpt topBlock_opts = {countof(opts), opts, countof(vars), vars, NULL};
/* Window management, etc */
ENTRYPOINT void
tb->eyeY=20;
tb->eyeZ=0;
}
- tb->trackball = gltrackball_init ();
+ tb->trackball = gltrackball_init (False);
}
/* provides the per frame entertainment */
followBlock(mi);
}
- glScalef (-1, 1, 1);
- glTranslatef (0, 0, -10);
- glRotatef(-current_device_rotation(), 0, 0, 1);
+ /* Rotate the scene around a point that's a little higher up. */
+ glTranslatef (0, 0, -5);
gltrackball_rotate (tb->trackball);
- glRotatef(current_device_rotation(), 0, 0, 1);
- glTranslatef (0, 0, 10);
- glScalef (-1, 1, 1);
+ glTranslatef (0, 0, 5);
/* rotate the world */
glRotatef(tb->rotation, 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
+
llCurrent = tb->blockNodeRoot;
if (drawCarpet) {
/* center carpet */
topBlock_handle_event (ModeInfo *mi, XEvent *event)
{
topBlockSTATE *tb = &tbs[MI_SCREEN(mi)];
- if (event->xany.type == KeyPress) {
+
+ if (gltrackball_event_handler (event, tb->trackball,
+ MI_WIDTH (mi), MI_HEIGHT (mi),
+ &tb->button_down_p))
+ return True;
+ else if (event->xany.type == KeyPress) {
KeySym keysym;
char c = 0;
XLookupString (&event->xkey, &c, 1, &keysym, 0);
return True;
}
}
- if (event->xany.type == ButtonPress &&
- event->xbutton.button == Button1)
- {
- tb->button_down_p = True;
- gltrackball_start (tb->trackball,
- event->xbutton.x, event->xbutton.y,
- MI_WIDTH (mi), MI_HEIGHT (mi));
- return True;
- }
- else if (event->xany.type == ButtonRelease &&
- event->xbutton.button == Button1)
- {
- tb->button_down_p = False;
- return True;
- }
- else if (event->xany.type == ButtonPress &&
- (event->xbutton.button == Button4 ||
- event->xbutton.button == Button5 ||
- event->xbutton.button == Button6 ||
- event->xbutton.button == Button7))
- {
- gltrackball_mousewheel (tb->trackball, event->xbutton.button, 10,
- !!event->xbutton.state);
- return True;
- }
- else if (event->xany.type == MotionNotify &&
- tb->button_down_p)
- {
- gltrackball_track (tb->trackball,
- event->xmotion.x, event->xmotion.y,
- MI_WIDTH (mi), MI_HEIGHT (mi));
- return True;
- }
- return False;
+
+ return False;
}
/* this is tha main change for v5 compatability and acompanying ENTRYPOINTS */