Difference between revisions of "SDL"

From NetHackWiki
Jump to navigation Jump to search
(A description of SDL, a horizontal rule, and an article about the SDL interface to SLASH'EM.)
 
m (remove redlinks)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
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.
+
{{wikipedia|Simple DirectMedia Layer}}
 +
{{RogueBasin}}
  
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.
+
The ''Simple DirectMedia Layer'', commonly '''SDL''', is a library of the [[ANSI C|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.
 
[[NetHack]] already has multiple interfaces for different platforms, but SDL is the basis of both the [[glHack]] and [[Vulture's]] interfaces.
Line 10: Line 13:
  
 
== Features ==
 
== 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.
+
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. [[Message]]s appear at top, status appears in text at bottom (though in three lines instead of two), and [[menu]]s appear in text format, without scroll bars or separate windows.
+
Except for the map, the SDL interface resembles the [[tty]] interface. [[Message]]s 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]].
 
The SDL interface employs its own bitmap fonts to draw text, and the fonts provide full support for [[IBMgraphics]].
Line 19: Line 22:
 
To build the SDL interface, you need the following:
 
To build the SDL interface, you need the following:
 
* the SDL library
 
* the SDL library
* the [[PNG]] library, to load the tiles
+
* the [[wikipedia:libpng|PNG library]], to load the tiles
 
* [[GNU]] [[make]]
 
* [[GNU]] [[make]]
  

Latest revision as of 05:59, 11 March 2020

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.