X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fglx%2Fqueens.c;h=cd3867cf9af87498d8367146ff71aeb490aafef3;hp=88592b13fe024724aa7c6028d1dee911f68c0e89;hb=4361b69d3178d7fc98d0388f9a223af6c2651aba;hpb=6f5482d73adb0165c0130bb47d852644ab0c4869 diff --git a/hacks/glx/queens.c b/hacks/glx/queens.c index 88592b13..cd3867cf 100644 --- a/hacks/glx/queens.c +++ b/hacks/glx/queens.c @@ -29,7 +29,7 @@ # include "xlock.h" #endif -#ifdef HAVE_COCOA +#ifdef HAVE_JWXYZ # include "jwxyz.h" #else # include @@ -67,7 +67,7 @@ ENTRYPOINT ModeSpecOpt queens_opts = {countof(opts), opts, countof(vars), vars, #ifdef USE_MODULES ModStruct queens_description = -{"queens", "init_queens", "draw_queens", "release_queens", +{"queens", "init_queens", "draw_queens", NULL, "draw_queens", "init_queens", NULL, &queens_opts, 1000, 1, 2, 1, 4, 1.0, "", "Queens", 0, NULL}; @@ -111,37 +111,13 @@ queens_handle_event (ModeInfo *mi, XEvent *event) { Queenscreen *qs = &qss[MI_SCREEN(mi)]; - if (event->xany.type == ButtonPress && - event->xbutton.button == Button1) + if (gltrackball_event_handler (event, qs->trackball, + MI_WIDTH (mi), MI_HEIGHT (mi), + &qs->button_down_p)) + return True; + else if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event)) { - qs->button_down_p = True; - gltrackball_start (qs->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) - { - qs->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 (qs->trackball, event->xbutton.button, 5, - !event->xbutton.state); - return True; - } - else if (event->xany.type == MotionNotify && - qs->button_down_p) - { - gltrackball_track (qs->trackball, - event->xmotion.x, event->xmotion.y, - MI_WIDTH (mi), MI_HEIGHT (mi)); + qs->steps = 1024 - 1; return True; } @@ -436,7 +412,7 @@ static int drawBoard(Queenscreen *qs) return polys; } -static int display(Queenscreen *qs) +static int display(ModeInfo *mi, Queenscreen *qs) { int max = 1024; int polys = 0; @@ -512,26 +488,6 @@ static int display(Queenscreen *qs) return polys; } -static const GLfloat spidermodel[][3] = - { - {0.48, 0.48, 0.22}, - {0.48, 0.34, 0.18}, - {0.34, 0.34, 0.10}, - {0.34, 0.18, 0.30}, - {0.18, 0.14, 0.38}, - {0.14, 0.29, 0.01}, - {0.29, 0.18, 0.18}, - {0.18, 0.18, 0.16}, - {0.18, 0.20, 0.26}, - {0.20, 0.27, 0.14}, - {0.27, 0.24, 0.08}, - {0.24, 0.17, 0.00}, - {0.17, 0.095, 0.08}, - {0.095, 0.07, 0.00}, - {0.07, 0.00, 0.12}, - }; - - #define EPSILON 0.001 #if 0 @@ -577,9 +533,11 @@ ENTRYPOINT void init_queens(ModeInfo *mi) int poly_counts[PIECES]; wire = MI_IS_WIREFRAME(mi); - if(!qss && - !(qss = (Queenscreen *) calloc(MI_NUM_SCREENS(mi), sizeof(Queenscreen)))) - return; +# ifdef HAVE_JWZGLES /* #### glPolygonMode other than GL_FILL unimplemented */ + wire = 0; +# endif + + MI_INIT (mi, qss, NULL); qs = &qss[screen]; qs->window = MI_WINDOW(mi); @@ -589,7 +547,7 @@ ENTRYPOINT void init_queens(ModeInfo *mi) else MI_CLEARWINDOW(mi); - qs->trackball = gltrackball_init (); + qs->trackball = gltrackball_init (False); qs->BOARDSIZE = 8; /* 8 cuz its classic */ @@ -631,7 +589,7 @@ ENTRYPOINT void draw_queens(ModeInfo *mi) else glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - mi->polygon_count = display(qs); + mi->polygon_count = display(mi, qs); mi->recursion_depth = qs->BOARDSIZE; if(mi->fps_p) do_fps(mi);