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 / defs.h < prev    next >
C/C++ Source or Header  |  1995-02-10  |  2KB  |  96 lines

  1. #include <stdio.h>
  2.  
  3. #include <X11/Xlib.h>
  4. #include <X11/Intrinsic.h>
  5. #include <X11/StringDefs.h>
  6. #include <X11/Shell.h>
  7.  
  8. #define UWIDTH          10      /* canvas size in units */
  9. #define UHEIGHT         30
  10.  
  11. #define STANDARD_SPEED    10        /* minimum speed you must start 
  12.                                    at in order to get into the high score table */
  13.  
  14. #ifndef HIGH_SCORE_TABLE
  15. #define HIGH_SCORE_TABLE    "tetris.scores"
  16. #endif
  17.  
  18. static Arg args[20];
  19.  
  20. Boolean running;
  21. Boolean paused;
  22.  
  23. Widget     
  24.     toplevel, frame,
  25.     score_frame, score_text,
  26.     about_frame, about_text,
  27.     canvas, shadow, nextobject, start_bt, pause_bt, newgame_bt,
  28.     score_item, level_item, rows_item, game_over;
  29.  
  30. GC       gc, erasegc, cleargc;
  31. Pixmap     tetris_icon;
  32.  
  33. int    end_of_game, score_position;
  34. int     shape_no, xpos, ypos, rot, score, rows;
  35. int    next_no, next_rot;
  36. char   *name;    /* Name of player */
  37. char *programname;
  38.  
  39. struct resource_struct
  40. {
  41.   Pixel foreground;
  42.   Pixel background;
  43.   Boolean usescorefile;
  44.   Pixmap erasestipple;
  45.   Pixmap boxstipple;
  46.   Dimension boxsize;
  47.   Dimension speed;
  48.   String scorefile;
  49.   String customization;
  50.   Boolean quayle;
  51. }
  52. resources;
  53.  
  54. typedef struct
  55. {
  56.   unsigned long unitson;  /* an array of 4x4 = 16 bits, indicating the on 
  57.                  units in this order:
  58.  
  59.     X11 coordinates         <0,0> <1,0> <2,0> <3,0>   <0,1> <1,1> <2,1> <3,1>  <0,2> <1,2> <2,2> <3,2> ... <3,3>*/
  60.  
  61.  
  62.   int points;             /* Points for acceptance in this position. */
  63.   XRectangle urect[2];    /* Rectangles to draw in unit form */
  64.   XRectangle rect[2];     /* Rectangles to draw in pixel form */
  65.   short nrect;
  66.  
  67.   short shadowx;
  68.   unsigned short shadowwidth;
  69.   
  70.   short highesty[4];      /* highest non-zero y in unitson, for each x */
  71.   short highestx[4];      /* highest non-zero x in unitson, for each y */
  72.   short lowestx[4];       /* lowest non-zero y in unitson, for each y */
  73. }
  74. rotshape_type, *rotshape_ptr;
  75.  
  76. typedef struct shape_table {
  77.   rotshape_type forms[4];
  78.   Pixel   foreground;
  79.   Pixel   background;
  80.   GC      gc;
  81. } shape_type, *shape_ptr;
  82.  
  83. shape_ptr grid[UWIDTH][UHEIGHT];
  84.  
  85. extern shape_type shape[];
  86.  
  87. void    print_high_scores(), done_proc(), quit_proc(), start_proc(), pause_proc(), newgame_proc();
  88. void    resume_proc(), about_proc();
  89. void    drop_block(), restore_widget(), show_score(), end_game(), left_proc(), right_proc();
  90. void    clock_proc(), anti_proc(), fast_proc();
  91.  
  92. void store_shape();
  93. void create_shape();
  94.  
  95.   XtAppContext context;
  96.