1 /* Bumps, Copyright (c) 1999 Shane Smit <blackend@inconnect.com>
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
15 * Header file for module "Bumps.cpp"
17 * Modification History:
18 * [10/01/99] - Shane Smit: Creation
19 * [10/08/99] - Shane Smit: Port to C. (Ick)
28 #include "screenhack.h"
29 #include <X11/Xutil.h>
34 #define PI 3.141592654
35 #define RANDOM() ((int) (random() & 0X7FFFFFFFL))
37 typedef signed char int8_;
38 typedef unsigned char uint8_;
40 typedef unsigned short uint16_;
42 typedef unsigned long uint32_;
43 typedef unsigned char BOOL;
47 char *progclass = "Bumps";
56 #ifdef __sgi /* really, HAVE_READ_DISPLAY_EXTENSION */
62 XrmOptionDescRec options [] = {
63 { "-degrees", ".degrees", XrmoptionSepArg, 0 },
64 { "-color", ".color", XrmoptionSepArg, 0 },
65 { "-colorcount", ".colorcount", XrmoptionSepArg, 0 },
66 { "-delay", ".delay", XrmoptionSepArg, 0 },
67 { "-soften", ".soften", XrmoptionSepArg, 0 },
68 { "-invert", ".invert", XrmoptionNoArg, "TRUE" },
73 /* This structure handles everything to do with the spotlight, and is designed to be
74 * a member of TBumps. */
81 uint16_ nDiameter, nRadius;
82 float nAngleX, nAngleY; /* Spotlight's movement direction. */
83 float nVelocityX, nVelocityY;
84 uint16_ iWinXCenter, iWinYCenter;
87 void CreateSpotLight( SSpotLight *, uint16_, uint16_ );
88 void CreateTables( SSpotLight * );
89 void CalcLightPos( SSpotLight *, uint16_ *, uint16_ * );
90 void DestroySpotLight( SSpotLight *pSpotLight ) { free( pSpotLight->aLightMap ); free( pSpotLight->aSinTable ); }
93 /* The entire program's operation is contained within this structure. */
96 /* XWindows specific variables. */
103 uint8_ nColorCount; /* Number of colors used. */
104 uint16_ iWinWidth, iWinHeight;
105 uint16_ *aBumpMap; /* The actual bump map. */
107 SSpotLight SpotLight;
110 void CreateBumps( SBumps *, Display *, Window );
111 void Execute( SBumps * );
112 void DestroyBumps( SBumps * );
114 void SetPalette( SBumps *, XWindowAttributes * );
115 void InitBumpMap( SBumps *, XWindowAttributes * );
116 void SoftenBumpMap( SBumps * );
119 #endif /* _BUMPS_H */
123 * End of Module: "Bumps.h"