Moved the error handling functions from xuni.c into the new file error.c, and re...
commit71c8b2568751bbf522f2703feeafafebafa4cd7a
authordwk <dwk@b022f027-f587-4676-bc72-f0cf7b603704>
Fri, 19 Oct 2007 22:08:49 +0000 (19 22:08 +0000)
committerdwk <dwk@b022f027-f587-4676-bc72-f0cf7b603704>
Fri, 19 Oct 2007 22:08:49 +0000 (19 22:08 +0000)
treeb4dc48a99adeb2f9743fa0055646a0bb111cf336
parent8cb92cda4183a36ee953ed2ede3bb79505293cec
Moved the error handling functions from xuni.c into the new file error.c, and re-wrote them, and re-wrote them again. The latest error handling interface is contained in one public function, log_message(). log_message() is quite flexible and takes a variable number of arguments, so that error messages can be much more specific. It takes different error types and flags to customize the errors.

Translated all calls to print_warning() and fatal_error() into calls to log_message(), making many of the error messages more specific in the process.

Added support for using the 8x8 hard-coded monospace SDL_gfx font when no external fonts could be loaded. There are still some issues with it -- for example, the created text surfaces have to be semi-transparent with an annoying background, since stringColor() and stringRGBA() (SDL_gfx functions) use their alpha component as an existing percentage of the existing alpha channel -- e.g., the background has to be at least as opaque as the text.

Added new_surface(), which is required for the built-in font support, since the SDL_gfx text functions blit to an existing surface rather than returning a new one, as SDL_ttf does.

Added font_string_width(), which is just like TTF_FontWidth(), but works for the built-in font as well. The code which uses this could be a lot more efficient, though.

xuni now runs with no external resources, just the executable -- though it doesn't look very good.

Got rid of the SDL_EnableUNICODE(-1) checks and just set the UNICODE translation directly; examining the SDL source code showed that this was more efficient.

Ran xuni through splint, which resulted in a few minor changes to the source code -- like some casts to (int).

Changed the return type of render_restricted_text() from int to size_t.

Fixed a bug in load_theme(), where the scrollbar resizing code was using the dimensions of the cursor -- and crashed when the cursor could not be loaded.

Spaced out the system header files from the library header files from my own header files with a single newline.

Modified TODO slightly.

Removed some commented-out code.

Some of the gui code messes up in screen modes with extreme ratios -- very tall or very wide. The fault lies mainly with paint_box().
21 files changed:
.xuni
TODO
doc/Doxyfile
gui/FreeMono.ttf
gui/FreeSans.ttf
src/Makefile
src/depend
src/error.c [new file with mode: 0644]
src/error.h [new file with mode: 0644]
src/font.c
src/font.h
src/game.c
src/graphics.c
src/graphics.h
src/gui.c
src/loop.c
src/menu.c
src/options.c
src/settings.c
src/xuni.c
src/xuni.h