1$NHDT-Date: 1524689294 2018/04/25 20:48:14 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.11 $
2# Copyright (c) 2003 by David Cohrs
3# NetHack may be freely redistributed.  See license for details.
4
5This document describes the installation of NetHack with an X11 interface.
6
7There are no explicit UNIX dependencies in this code, but we have only
8tested it under UNIX, using X11R4, X11R5, or X11R6.  We have two reports
9that the code also works under DesqView/X on MS-DOS with djgpp, but you
10will have to add dependencies for the X code to that makefile before you
11can use it.  Other X11R4+ platforms may work as well, with some tweaking
12likely.  Follow WIN* in sys/unix/Makefile.src for compilation hints.
13
14(If you try to compile it with X11R3 or earlier, you will get many errors,
15starting with complaints about XtPointer not being declared.  If you get
16around the compilation problems, you will still need a recent library of
17Athena Widgets to link against.  Once compiled, you can probably run it
18under an R3 X server, though.)
19
20The reason this uses the Athena widget set is that the Athena widgets come
21free from MIT (like X11).  Unfortunately, the companies that resell X11
22(value subtracted er, added software; yea, yea, that's the ticket) usually
23discourage its use by either omitting the set or putting it on the
24"unsupported" portion of their tape.  If you do not have the Athena
25widgets, you may obtain them via anonymous ftp from ftp.x.org.
26
27
28To use this code, define X11_GRAPHICS in include/config.h.  (You can comment
29out TTY_GRAPHICS or change DEFAULT_WINDOW_SYS if you want to, but there's
30little reason to do so.  The X11 version almost requires a config file
31for full effect, so you can just as well set windowtype there; also, you
32or someone else might just possibly be stuck in a situation where you can't
33use the X version -- over a non-blindingly-fast modem, say.)  You may also
34want to define USE_XPM or GRAPHIC_TOMBSTONE as discussed below.
35
36In src/Makefile, add $(WINX11SRC), $(WINX11OBJ), and $(WINX11LIB) to
37WINSRC, WINOBJ, and WINLIB respectively, and compile.  This will give you
38an executable supporting both X11 and tty windowing.
39
40
41If you want to use the optional tiles (multicolored pictures instead of a
42replacement font), you will need to have the win/share files and change
43the VARDATND setting in the top Makefile to contain the tile files before
44you do your 'make all'.
45
46If you get a linker error referring to `substitute_tiles' then most
47likely you have overlooked the WINSRC, WINOBJ, WINLIB step above.
48Alternatively, you are building with more than one non-tty interface
49specified but haven't followed the direction in src/Makefile to remove
50all but one instance of tile.o from the WINxxxOBJ values used for WINOBJ.
51
52When using tiles, you have the option of defining USE_XPM in config.h.
53This causes NetHack to use the XPM file format for the "x11tiles" file
54rather than a custom format.  Since the XPM format can be processed by
55existing tools such as PBMPlus and XV, you can modify the tiles to suit
56your environment.  However, you need to make sure the number of tiles
57in each row of the image remains the same (currently 40), as the code
58depends on this to calculate the size of each tile. For example, you may
59magnify them for display on high-resolution screens using the following
60command:
61    xpmtoppm x11tiles | pnmscale -xscale 1 -yscale 1.6875 |
62        pnmdepth 255 | ppmquant 100 | ppmtoxpm >x11tiles_big.xpm
63To use XPM, you must have the free XPM libraries installed in your system.
64Official xpm releases can be found by ftp on:
65    ftp.x.org       (198.4.202.8)  contrib/libraries     (Boston, USA)
66    avahi.inria.fr  (138.96.12.1)  pub/xpm     (Sophia Antipolis, France)
67If you do choose to define USE_XPM, be sure to add "-lXpm" to WINX11LIB
68in src/Makefile.
69
70If you define USE_XPM in config.h, you may also define GRAPHIC_TOMBSTONE
71which causes the closing tombstone to be displayed from the image file
72specified by the "tombstone" X resource (rip.xpm by default).  In this
73case, make sure the top Makefile VARDATND also contains rip.xpm.
74
75
76Whether or not you install tile support, you can provide support for
77special graphics symbols via alternate fonts.  (The fonts and tiles
78cannot be used at the same time, but the same executable handles both.)
79The two included X11 fonts use the general NetHack map area remapping
80to represent object/dungeon/trap/effect characters (see win/X11/nethack.rc
81and the Guidebook) as monocolored symbols and monsters as monocolored
82letters.  For instance, a ruby potion will show up as a potion symbol in
83red.  It's easier to see the difference between fonts and tiles than to
84describe it. :-)  Unless you are the only one using your executable and
85you already know which you prefer, we suggest installing the optional files
86for both possibilities and letting each person decide for themselves.
87
88To use the included fonts, you will need to install one or both of them
89and then use the symbol mappings found in nethack.rc.  The fonts are found
90in nh10.bdf and ibm.bdf.  You first need to convert the bdf files to whatever
91form your X11 server recognizes (usually using a command called bdftosnf
92for R4 servers or bdftopcf for R5 servers).  Then run mkfontdir on the
93directory containing your font files (you might want to copy them to HACKDIR,
94from the top Makefile, after you've done "make install").  If these commands
95aren't familiar, talk to your local X11 guru and read the man pages.
96
97nethack.sh automatically adds HACKDIR to your font search path.  If
98you (assuming you are a system administrator) can install the fonts in your
99standard X11 font directory the relevent lines in nethack.sh can be removed.
100Alternatively, all persons playing nethack must add that "xset fp+"
101command to their .xinitrc file, or whatever file they execute when starting
102X11.  See the note below for the alternative installation procedure
103for Sun's OpenWindows.
104
105
106If your X11 include files and libraries are not installed in a standard
107place (i.e. /usr/include/X11 and /usr/lib respectively) you will need to
108prepend an appropriate -I<idirectory> parameter to CFLAGS and a
109-L<ldirectory> parameter to LFLAGS, setting <?directory> to the place to
110find the include and library files for X11.
111
112
113Finally, to ensure NetHack's windows look the way they were intended to
114look, make sure the top Makefile VARDATND also contains NetHack.ad.  If it
115does, running nethack will automatically take the appropriate steps to
116cause this file to be used to initialize NetHack's X11 resources.
117
118
119Three icon suggestions to the window manager are supported:  nh72, nh56,
120and nh32.  Data for them comes from the source files nh72icon, nh56icon,
121and nh32icon; they are compiled into the program via #includes in winX.c.
122Selection between them is controlled by the "icon" resource in NetHack.ad;
123the default is nh72.
124
125
126Sorry, an Imakefile is not included.  Unlike many X11 programs, X11
127support is only a small, optional, part of nethack, and the Makefile is
128needed for systems that don't use X11.
129
130
131Notes for AIX 3.2:
132    1.  AIX 3.2 includes the Athena Widget Toolkit library (and other things)
133	under the /usr/lpp/X11/Xamples tree, so you will have to add
134	-L/usr/lpp/X11/Xamples/lib to LFLAGS.  If you can't find libXaw.a on
135	your first build, go into /usr/lib/X11/Xamples, read the README file,
136	and build the library.
137
138Notes for XFree86 - (on linux and BSD386 platforms)
139
140    1.  Edit src/Makefile for linux/BSD386. Use the
141	standard X11 object and library options.
142
143    2.  Follow the standard installation directions defined above.
144
145
146File				Description
147---------	---------------------------------------------------------------
148nethack.rc	- A sample configuration file for fonts nh10 and ibm.
149nh10.bdf	- A modified version of the 10x20 standard font.
150ibm.bdf		- A modified version of one of the ibm (8x14) nethack font.
151		  Must be used in conjunction with NetHack.ad or nethack.rc.
152nh32icon	- A 32x32 icon bitmap for use with window managers.
153nh56icon	- A 56x56 icon bitmap for use with window managers.
154nh72icon	- A 72x72 icon bitmap for use with window managers.
155nh_icon.xpm	- A color icon for use with window managers.
156NetHack.ad	- A sample .Xdefaults for a color screen.
157../../include/Window.h
158../../include/WindowP.h
159Window.c	- A bare-bones widget that has 16 colors and a drawing canvas.
160../../include/winX.h
161		- Defines for the X window-port.
162win*.c		- Code for the X window-port
163dialogs.c	- A better dialog widget.  Original code (modified slightly
164		  by Dean Luick) distributed under the X copyright by Tim
165		  Theisen.  This is from his Ghostview program (which is under
166		  the GNU public license, v2 or higher).
167pet_mark.xbm	- A pet indicator bitmap for tiles.
168pilemark.xbm	- Item pile indicator for tiles.
169rip.xpm		- A graphical tombstone.
170tile2x11.c	- Converts win/share tiles for X11 use.
171