1 #ifndef _global_h 2 #define _global_h 3 4 #include <stdlib.h> 5 #include <stdio.h> 6 #include <math.h> 7 #include <X11/Xlib.h> 8 #include <X11/Xutil.h> 9 10 // 11 // The basic floating point class can be exchanged between doubles and 12 // floats. The latter one is faster on my 386. 13 #ifndef __TURBOC__ 14 # define REAL_IS_FLOAT 0 15 #else 16 # define REAL_IS_FLOAT 1 17 #endif 18 19 // 20 // A real C++-Class can be used for real arithmetic. Unfortunately 21 // that really slows the calculation down, even though the whole class 22 // is defined inline. 23 #define REAL_IS_CLASS 0 24 25 // 26 // There are some specialized vector classes for 2 and 3 dimensionaL 27 // vectors, which can also be realized by inheriting from an universaL 28 // vector-class (but again, that's expensive) 29 #define Vec2IsVector 0 30 #define Vec3IsVector 0 31 32 // 33 // constants to overcome the problem with unprecise real-arithmetics 34 #if (REAL_IS_FLOAT) 35 # define EPS 1e-4 36 #else 37 # define EPS 1e-10 38 #endif 39 40 #ifdef DEBUG 41 42 #define DBG0(f) printf( f ) 43 #define DBG1(f,a) printf( f,a ) 44 #define DBG2(f,a,b) printf( f,a,b ) 45 #define DBG3(f,a,b,c) printf( f,a,b,c ) 46 #define DBG4(f,a,b,c,d) printf( f,a,b,c,d ) 47 48 #else 49 50 #define DBG0(f) 51 #define DBG1(f,a) 52 #define DBG2(f,a,b) 53 #define DBG3(f,a,b,c) 54 #define DBG4(f,a,b,c,d) 55 56 #endif 57 58 59 // 60 // here come something very unlike OO, but its just easier ... 61 // all common variables are defined in the xjig.C file 62 // 63 extern Display *dpy; // the display connection 64 extern int scr; // the current screen 65 extern Window win; // the main window (can be root in shape-mode) 66 extern GC gc; // the main graphic context 67 68 extern int verbose; 69 extern int texture_mode; // mode for texture mapping depending on depth 70 71 extern Cursor normal_cursor, move_cursor, pull_cursor, idle_cursor, no_cursor; 72 73 extern int zoom_factor; // current zooming stage (default: 20) 74 extern int win_size_x; 75 extern int win_size_y; 76 77 extern int offx; // half tilesize as offset to frames 78 extern int offy; 79 extern int width; // height of image 80 extern int height; // width of image 81 extern int dx; // number of tiles in x-direction 82 extern int dy; // number of tiles in y-direction 83 extern int tile_size; // average tile size 84 85 extern int shared; // flag about usage of MIT-SHM 86 extern int shapes; // flag about usage of the shape extension 87 88 extern int shadow_size; // pixels in shadow frame 89 90 extern double fliptimebase; // base time for flipping 91 extern double fliptimedelta; // added to base for each tile 92 extern int maxfliptiles; // max. number of tiles for automated flip 93 extern int minadjustcount; // number of tiles to start 90 degrees autoadjust 94 extern double flipsave; // dont let the tile come close to a vertical 95 // position during the flip ... 96 97 extern double turntimebase; // base time for 90 degree rotation 98 extern double turntimedelta; // added to base for each additional tile 99 extern int maxturntiles; // max. number of tiles for rotation animation 100 101 extern int maxsnapretries; // max. possible retries to snap the snapped 102 103 extern class Puzzle *p; // Collection of all puzzle pieces 104 extern class GifPixmap *pm; // Original pixmap for the puzzle tiles 105 extern class Port *port; // Port (Display synonym) for color mapping 106 extern class ObjectStack *stk; // administrator object for all viewable objects 107 extern class ImageBuffer *img_buf;// memory for rotating image (probably shared) 108 109 110 #define WARP_NO_LOCK -2000 111 extern int warp_center; // help information to safely warp the pointer 112 extern int warp_lock_x; 113 extern int warp_lock_y; 114 115 extern int side_lock; // which side (of TwinPixmap) as default 116 extern int distortion; // factor to control distortion of the tiles 117 extern double maxang; // maxmum offset angle at startup 118 extern int shuffle; // shuffle tile as default 119 extern int straight_setup; // offset for straight debugging setup 120 extern int angle; // preset angles for debugging 121 122 extern int quit; // global flag to initiate quitting 123 124 extern double GetCurrentTime(int busy=0); // to query current time 125 extern int my_rand(void); // private randomizer 126 127 #define XPix(x) ((int)(x)) 128 #define YPix(y) ((int)(y)) 129 #define AnyButtonMask (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask) 130 131 #endif 132