"*count: 200 \n" \
"*cycles: 1000 \n" \
"*ncolors: 32 \n" \
- "*titleFont: -*-helvetica-bold-r-normal-*-180-*\n" \
+ "*titleFont: -*-helvetica-bold-r-normal-*-*-180-*-*-*-*-*-*\n" \
"*showFPS: False \n" \
"*wireframe: False \n" \
# define refresh_juggle 0
+# define release_juggle 0
#undef countof
#define countof(x) (sizeof((x))/sizeof((*x)))
#include "tube.h"
#include "rotator.h"
#include "gltrackball.h"
-#include "glxfonts.h"
+#include "texfont.h"
#include <ctype.h>
#ifdef USE_GL /* whole file */
}
static void
-free_juggle(jugglestruct *sp) {
+free_juggle(ModeInfo *mi) {
+ jugglestruct *sp = &juggles[MI_SCREEN(mi)];
+
if (sp->head != NULL) {
while (sp->head->next != sp->head) {
trajectory_destroy(sp->head->next);
}
static Bool
-add_throw(jugglestruct *sp, char type, int h, Notation n, const char* name)
+add_throw(ModeInfo *mi, char type, int h, Notation n, const char* name)
{
+ jugglestruct *sp = &juggles[MI_SCREEN(mi)];
Trajectory *t;
ADD_ELEMENT(Trajectory, t, sp->head->prev);
if(t == NULL){ /* Out of Memory */
- free_juggle(sp);
+ free_juggle(mi);
return False;
}
t->object = NULL;
static Bool
program(ModeInfo *mi, const char *patn, const char *name, int cycles)
{
- jugglestruct *sp = &juggles[MI_SCREEN(mi)];
const char *p;
int w, h, i, seen;
Notation notation;
case ' ':
if (seen) {
i++;
- if (!add_throw(sp, type, h, notation, title))
+ if (!add_throw(mi, type, h, notation, title))
return False;
title = NULL;
type=' ';
}
}
if (seen) { /* end of sequence */
- if (!add_throw(sp, type, h, notation, title))
+ if (!add_throw(mi, type, h, notation, title))
return False;
title = NULL;
}
/* ..nm.. -> .. LTn LC RTm RC .. */
static Bool
-part(jugglestruct *sp)
+part(ModeInfo *mi)
{
+ jugglestruct *sp = &juggles[MI_SCREEN(mi)];
Trajectory *t, *nt, *p;
Hand hand = (LRAND() & 1) ? RIGHT : LEFT;
t->action = CATCH;
ADD_ELEMENT(Trajectory, nt, p);
if(nt == NULL){
- free_juggle(sp);
+ free_juggle(mi);
return False;
}
nt->object = NULL;
GLfloat gcolor1[4] = { 0, 0, 0, 1 };
GLfloat gcolor2[4] = { 1, 1, 1, 1 };
int slices = 16;
- int divs = s->divisions;
- divs = 4;
+ int divs = 4;
/* 6 6
+-+
**************************************************************************/
-ENTRYPOINT void
-release_juggle (ModeInfo * mi)
-{
- if (juggles != NULL) {
- int screen;
-
- for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++)
- free_juggle(&juggles[screen]);
- free(juggles);
- juggles = (jugglestruct *) NULL;
- }
-}
-
/* FIXME: refill_juggle currently just appends new throws to the
* programme. This is fine if the programme is empty, but if there
* are still some trajectories left then it really should take these
name(sp);
- if (!part(sp))
+ if (!part(mi))
return;
lob(mi);
positions(sp);
if (!projectile(sp)) {
- free_juggle(sp);
+ free_juggle(mi);
return;
}
jugglestruct *sp = 0;
int wire = MI_IS_WIREFRAME(mi);
- if (!juggles) {
- juggles = (jugglestruct *)
- calloc (MI_NUM_SCREENS(mi), sizeof (jugglestruct));
- if (!juggles) {
- fprintf(stderr, "%s: out of memory\n", progname);
- exit(1);
- }
- }
+ MI_INIT (mi, juggles, free_juggle);
sp = &juggles[MI_SCREEN(mi)];
- sp->glx_context = init_GL(mi);
+ if (!sp->glx_context) /* re-initting breaks print_texture_label */
+ sp->glx_context = init_GL(mi);
sp->font_data = load_texture_font (mi->dpy, "titleFont");
/* create circular trajectory list */
ADD_ELEMENT(Trajectory, sp->head, sp->head);
if(sp->head == NULL){
- free_juggle(sp);
+ free_juggle(mi);
return;
}
/* create circular object list */
ADD_ELEMENT(Object, sp->objects, sp->objects);
if(sp->objects == NULL){
- free_juggle(sp);
+ free_juggle(mi);
return;
}
}
}
- print_gl_string (mi->dpy, sp->font_data,
- mi->xgwa.width, mi->xgwa.height,
- 10, mi->xgwa.height - 10,
- sp->pattern, False);
+ glColor3f (1, 1, 0);
+ print_texture_label (mi->dpy, sp->font_data,
+ mi->xgwa.width, mi->xgwa.height,
+ 1, sp->pattern);
#ifdef MEMTEST
if((int)(sp->time/10) % 1000 == 0)
if (future < sp->time + 100 * THROW_CATCH_INTERVAL) {
refill_juggle(mi);
} else if (sp->time > 1<<30) { /* Hard Reset before the clock wraps */
- release_juggle(mi);
init_juggle(mi);
}