home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / xap / xgames / xtetris-.6 / xtetris- / xtetris-2.6 / draw.c < prev    next >
C/C++ Source or Header  |  1991-08-30  |  1KB  |  63 lines

  1. #include "defs.h"
  2.  
  3. draw_shadow(shape_no, xpos, rot )
  4.   int shape_no, xpos, rot;
  5.   
  6. {
  7.   rotshape_ptr sh = &shape[shape_no].forms[rot];
  8.   
  9.   XClearArea( XtDisplay(shadow), XtWindow(shadow), 0, 0, 0, 0, False );
  10.  
  11.   XFillRectangle(XtDisplay(shadow), XtWindow(shadow), shape[shape_no].gc,
  12.          xpos*resources.boxsize + sh->shadowx, 0, sh->shadowwidth, resources.boxsize);
  13.   XFlush(XtDisplay(toplevel));
  14. }
  15.  
  16. show_next()
  17. {
  18.   XClearArea( XtDisplay(nextobject), XtWindow(nextobject), 0,0,0,0, False );
  19.   print_shape( nextobject, next_no, 0, 0, next_rot, False );
  20. }
  21.  
  22. print_shape_window( d, w, shape_no, x, y, rot, clear )
  23.   Display *d;
  24.   Drawable w;
  25.   int shape_no, x, y, rot;
  26.   unsigned char clear;
  27. {
  28.   rotshape_ptr sh = &shape[shape_no].forms[rot];
  29.   long xmin, ymin;
  30.   XRectangle rect[2];
  31.   int i;
  32.   
  33.   ymin = y* resources.boxsize;
  34.   xmin = x*resources.boxsize;
  35.  
  36.   /* Fill or clear the rectangles */
  37.       
  38.   for (i = 0; i < sh->nrect; i++)
  39.     {
  40.       XRectangle *r = &rect[i], *shr = &sh->rect[i];
  41.       
  42.       *r = *shr;
  43.       r->x += xmin;
  44.       r->y += ymin;
  45.       if (clear) 
  46.     XClearArea( d, w, r->x, r->y, r->width, r->height, FALSE );
  47.     }
  48.   
  49.   if (!clear)
  50.     {
  51.       XFillRectangles( d, w, shape[shape_no].gc, rect, sh->nrect );
  52.       XFlush(d);
  53.     }
  54. }
  55.  
  56. print_shape( w, shape_no, x, y, rot, clear )
  57.   Widget w;
  58.   int shape_no, x, y, rot;
  59.   unsigned char clear;
  60. {
  61.   print_shape_window( XtDisplay(w), XtWindow(w), shape_no, x, y, rot, clear );
  62. }
  63.