Made parsing multiple XML files work correctly. This involved mainly adding new code...
commita389ebd525243bebcf4510131c45dd8cd7648837
authordwk <dwk@b022f027-f587-4676-bc72-f0cf7b603704>
Tue, 25 Dec 2007 22:14:37 +0000 (25 22:14 +0000)
committerdwk <dwk@b022f027-f587-4676-bc72-f0cf7b603704>
Tue, 25 Dec 2007 22:14:37 +0000 (25 22:14 +0000)
tree8080ad0aaae30f89e54a83e192303ad71b2f5469
parentd551790794394ac5aa707c07ddd60c1b207aeb22
Made parsing multiple XML files work correctly. This involved mainly adding new code to resource.c, such as process_resource_includes() and include_resources(). However, some bugs also had to be fixed, such as initializing the list to zero in add_new_element() and changing the sizeof() to be the right type in a malloc() call. There were other changes as well; init_resource() is now public and is called in main().

Changed paths in the XML files to be relative to xuni's executable until proper directory handling in written in resource.c (like codeform).

Introduced a new floating-point coordinate system, with xuni's window being 100x100. That is, half of the window is 50 and a third of it is 33.333333.

The widget_t::pos SDL_Rect has been replaced with a struct pos_t, which has double values for the rescalable coordinates and an embedded SDL_Rect for the real ones. This involved changing most of the code which previously referenced widget_t::pos to reference widget_t::real::pos (especially in gui.c).

Redid the widget initializing and rescaling/resizing code again. Now widgets are allocated with add_allocate_widget(), positioned with set_widget(), and set with widget-type-specific data with functions like set_button() -- all in the panel initialization functions like init_menu(). The only function to be called when the window is resized (at the moment) is the new function rescale_widget(), which calculates real coordinates from the scalable ones. This can be called automatically. However, it needs to be augmented with code specific to each widget type -- right now, for example, button text is not resized.

There are still some bugs to be worked out: for example, scrollbars are not positioned correctly.

Added gui/data.xml, which is the beginning of xuni-specific XML data files which specify the GUI that xuni actually uses. Also added some new, hack-ish code which reads widgets from XML files and displays them on the main menu, most of which is in menu.c (but not, for example, resource.c::find_resource_text()). Two buttons are painted as an example.

Added yet more into the TODO file.
16 files changed:
TODO
gui/data.xml [new file with mode: 0644]
gui/gui.xml
gui/theme.xml
src/depend
src/game.c
src/graphics.c
src/graphics.h
src/gui.c
src/loop.c
src/menu.c
src/options.c
src/resource.c
src/resource.h
src/xuni.c
xuni.xml