Textscreen

From Chocolate Doom
Jump to: navigation, search
ENDOOM screen for Memento Mori displayed using libtextscreen.

libtextscreen is an internal library used in Chocolate Doom. It simulates a DOS text mode display, and is used to display the ENDOOM screen when exiting the game (see Accurate ENDOOM emulation)

Originally intended solely for this purpose, it has since been extended to include a small windowing toolkit that is used as the basis of the Chocolate Doom setup program.

Base library[edit]

The basic part of the library simply emulates a DOS text mode display using LibSDL. It is contained in the file txt_sdl.c. The library accurately reproduces all of the characters in the DOS Extended ASCII range and also supports blinking text.

The library uses an 8x16 pixel font by default (giving a 640x480 pixel window), but on small screens, an alternative font is used based on the Atari-Small font. This alternative font uses characters in a 4x8 dimension (giving a 320x240 pixel window). This feature is useful for low resolution devices such as palmtops. A screenshot of the small font in use can be seen here.

The Chocolate Doom setup tool, demonstrating the textscreen widget toolkit.
Setup tool running on Windows Mobile, showing the alternative half-height font.

GUI toolkit[edit]

The textscreen library includes a full text mode windowing toolkit, designed to appear similar in style to the Doom Setup program. The toolkit is used as the basis for Chocolate Doom's setup program. The toolkit and base library are built as a single library, but there is no dependency of the base library on the higher level toolkit code.

The library is written in C, although with an "object oriented" style. The API for the toolkit is inspired by the Gtk+ toolkit used for Gnome. Windows can be opened and widgets packed into tables within the windows. Many different comment widget types are supported, including:

  • Buttons
  • Check boxes
  • Dropdown list boxes
  • Input boxes for entering string and integer values
  • Labels
  • Radio buttons
  • Scrollable panes
  • Separators (used to divide a window into sections)
  • Spin controls (to control integer and floating point values)
  • Struts (used to add spacing to a window)

The library is event-based, and callbacks may be set to be invoked when particular actions occur (eg. a button is pressed).

At present, the windowing toolkit is only used for the setup program and for the multiplayer waiting screen. It may be used for other purposes in the future.

Further links[edit]