SDL

From NetHackWiki
Jump to navigation Jump to search

The Simple DirectMedia Layer, commonly SDL, is a library of the C language that provides low-level, cross-platform access to audio and video hardware and input devices. The same SDL user interface can compile and run on at least Mac OS X, Microsoft Windows and X11. An SDL user interface will display either full screen, or in a single window.

SDL provides neither interface controls (as buttons and menus), nor fonts and text, nor audio encodings (as Ogg Vorbis), nor image encodings (as PNG). However, other libraries atop or along SDL can provide these things.

NetHack already has multiple interfaces for different platforms, but SDL is the basis of both the glHack and Vulture's interfaces.


The remainder of this page concerns the SDL interface to SLASH'EM. This is a port of the glHack interface, and resides in the win/gl directory of the SLASH'EM source code. At least one operating system provides a "slashem-sdl" package containing this interface.

Features

The SDL interface can display the map as text or tiles, and can allegedly load the same isometric tiles as the Gtk+ interface. Optionally, the SDL interface may use OpenGL to display the tiles; this compile-time option creates the GL interface.

Except for the map, the SDL interface resembles the tty interface. Messages appear at top, status appears in text at bottom (though in three lines instead of two), and menus appear in text format, without scroll bars or separate windows.

The SDL interface employs its own bitmap fonts to draw text, and the fonts provide full support for IBMgraphics.

Requirements

To build the SDL interface, you need the following:

If you enable OpenGL, then you also need the GL library.

The Makefile rules for this interface use a "%" syntax understood by GNU make, but not BSD make. Bug 1870830 mentions this.

Controls

Most of the controls and options for the SDL interface remain undocumented. One can put "GLOPTIONS" lines in the nethackrc but no document explains the options. However, the basic controls seem to be [PageUp] and [PageDown] to zoom the tiles, and [End] to toggle between tiles and text.