From http://www.jwz.org/xscreensaver/xscreensaver-5.36.tar.gz
[xscreensaver] / README.hacking
index 9be7b88d697d780a58af705553dd3d897dec66ed..3cceb5773c0be4ea083002a2a73d604d23b7e9d2 100644 (file)
@@ -5,6 +5,19 @@
 
 ==========================================================================
 
+Any program that can be made to render on an X window created by another
+process can be used as a screen saver.  Just get the window ID out of
+$XSCREENSAVER_WINDOW, draw on that, and you're done.
+
+In theory, you can write a screen saver in any language you like.  In
+practice, however, languages other than C or C++ tend not to allow you to
+draw to windows that they did not create themselves.  Unfortunately, this
+means that if you want to write a screen saver, you must write it in C.
+
+Given that you're going to be writing in C, you might as well take
+advantage of the various utility functions that I have written to make
+that easier.  Writing a new screen saver in C using the frameworks
+included with xscreensaver simplifies things enormously.
 
 Generally, the best way to learn how to do something is to find a similar
 program, and play around with it until you understand it.  Another
@@ -14,8 +27,8 @@ xscreensaver demos, included in the "hacks/" directory, rename the file,
 and edit it until it does what you want.
 
 The "Greynetic" and "Deluxe" hacks are probably good ones to start with,
-since they are so very simple.  For GL programs, "DangerBall" is a good
-example.
+since they are so very simple.  For OpenGL programs, "DangerBall" is a
+good example.
 
 
 ==========================================================================
@@ -126,15 +139,18 @@ Programming Tips
   - Don't make assumptions about the depth of the display, or whether it
     is colormapped.  You must allocate all your colors explicitly: do not
     assume you can construct an RGB value and use that as a pixel value
-    directly.  Use the utility routines provided by "utils/colors.h" to
-    simplify color allocation.
+    directly.  In particular, you can't make assumptions about whether
+    pixels are RGB, RGBA, ARGB, ABGR, or even whether they are 32, 24,
+    16 or 8 bits.  Use the utility routines provided by "utils/colors.h"
+    to simplify color allocation.
 
   - It is better to eliminate flicker by double-buffering to a Pixmap
     than by erasing and re-drawing objects.  Do not use drawing tricks
     involving XOR.
 
-  - If you use double-buffering, have a resource to turn it off. (MacOS
-    has double-buffering built in, so you'd be triple-buffering.)
+  - If you use double-buffering, have a resource to turn it off. (MacOS,
+    iOS and Android have double-buffering built in, so you'd end up
+    triple-buffering.)
 
   - Understand the differences between Pixmaps and XImages, and keep in
     mind which operations are happening in client memory and which are in
@@ -147,21 +163,16 @@ Programming Tips
 
 
 ==========================================================================
-The MacOS X Port
+MacOS, iOS and Android
 ==========================================================================
 
   Though XScreenSaver started its life as an X11 program, it also now runs
-  on MacOS X.  If you do your development on an X11 system, and follow the
+  on MacOS, iOS and Android, due to a maniacal collection of compatibility
+  shims.  If you do your development on an X11 system, and follow the
   usual XScreenSaver APIs, you shouldn't need to do anything special for
-  it to also work on MacOS.
-
-  The preprocessor macro HAVE_COCOA will be defined when being compiled in
-  a MacOS (Cocoa/Quartz) environment, and will be undefined when compiling
-  against "real" Xlib.
+  it to also work on MacOS and on phones.
 
-  To compile on MacOS, use the XCode project included in the source
-  distribution.  You shouldn't need to have X11 installed, and shouldn't
-  need to run "configure" first.  MacOS 10.4.0 and XCode 3.1 or newer are
-  required.
+  See the READMEs in the OSX/ and android/ directories for instructions on
+  compiling for those platforms.
 
 ==========================================================================