High-level changes:
[xuni.git] / TODO
blob06446061254f490d721a9de07abb5bd234117ba2
1 ---- Current todo list ----
2 [done] Handle SDL_VIDEOEXPOSE instead of repainting the whole menu every screen. This could involve passing paint_menu() et al information about which part of the screen to repaint.
4 [done] Create a settings file which saves the screen mode etc. strtol() is a good idea.
6 [done] theme_t::boxw and theme_t::boxh are currently just shortcuts for box[0].corners.image->[wh]. Should the corners of buttons all be the same size? If not, should there be get_button_corner_size() functions, complicated inline code, or separate images like box[x].upperleftcorner?
8 Currently, the entire screen is repainted when fullscreen is toggled, whether or not it succeeded in any way. Perhaps the screen does not need to be repainted if SDL_WM_ToggleFullScreen() succeeds?
10 [done -- see error.c::log_message()] The warning messages are vague at best. Perhaps a varargs print_warning() etc is in order?
12 Currently, load_icon() frees the SDL_Surface it passes to SDL_WM_SetIcon(). This is good for this system, because Valgrind shows a memory leak otherwise. But is this standard?
14 [done -- see ~/perl/func_need_be_unstatic.pl] Determine which functions ought to be static and make them so.
16 [started] Split graphics.c up into several files -- it's too long and complicated.
18 [done] De-obfuscate paint_button().
20 [done] Allow paint_button() to be passed the width (and height?) of the button.
22 [done] Should the frame rate change according to the mode? Since the menu does not paint all of the time, it could be running at twice the FPS. The menu could even use SDL_WaitEvent() and not be frame-limited at all . . .
24 [done] Check to make sure that the return value of set_graphics_mode() is always used, as toggle_fullscreen() does.
26 Pass specific information to SDL_UpdateRect to repaint only a widget if that is all that has changed.
28 [changed] The screen doesn't need repainting upon an SDL_MOUSEBUTTONUP event inside a checkbox widget.
30 [done] Handle SDL_ActiveEvent in the game loop, and pause if neccessary.
32 [done] Should keys repeat? It makes using SDL_KEYDOWN (which is more natural as opposed to SDL_KEYUP) tough to use to detect menu keys etc. Maybe its setting could change between screens?
34 [done] Add support for using the keyboard to navigate menus.
36 [done] Use a pointer to a widget when the mouse is held down as well as when a widget is selected (like a textbox). This will require changing struct smode_t.
38 [done] Move screen into struct smode_t? Or use SDL_GetVideoSurface() all of the time? (Otherwise normal functions can't toggle fullscreen etc.)
40 [done, used function pointers] Get rid of all of those unused parameters. Either that or use some function pointers.
42 [done -- it was "repaint ||" instead of "|| repaint" in loop.c] Fix the app-focus bugs for all platforms.
44 [possible] Add an option to init_checkbox() to make the checkbox just the right width.
46 Create a help source file. (Textareas should be implemented before doing this.)
48 [done] Have a "previous text" member for textboxes, so that when escape is pressed they may revert to their former text.
50 Add a "disabled" widget artwork set?
52 Separating artwork for different widgets? (Textbox art is counter-intuitive with button/box artwork.)
54 [added some typedefs, though not for bool] Some typedefs, especially one for bool, might not be a bad idea. (fullscreen, enabled, checked, ...)
56 Add code to detect if xuni is running way below the proper FPS; and if it is, forgo delaying entirely?
58 [started, with libexpat] Use libxml2 instead of or in addition to settings.c?
60 Actually write out the settings back to .xuni -- but only if they have changed? Or just write the settings file immediately after every change? (Bad if a change crashes the program, for example, a screen mode that is too large.)
62 [done] Add in support for using SDL_gfx's SDL_gfxPrimitives_font.h instead of SDL_ttf, eliminating dependency on one of the only required external resources, a font?
64 Create a proper strings_t data structure, possibly much like codeform's; as well as a more complicated one which supports text editing (scrolling, arrow keys, insertion, remembering where the cursor is, restoring the old data when escape is pressed, etc).
66 [fixed] Bug: when the xuni window is resized, many strange things occur, such as textboxes resetting to their original text. (To fix this, init_textbox() must not set the data of the textbox.)
68 Separate the gui/widget code from the xuni code as much as possible -- maybe even make it a separate library eventually. This might entail:
69     [done] Creating a widget_array_t structure to dynamically hold allocated widgets. (This would allow external configuration files to change the gui layout etc.) [important]
70     Simplifying the code which detects if a widget is active. (set_menu_widget_sel(), ...)
71     Allowing different box types, such as a stretched image for the centre, to allow a textured box image. This could be done by making paint_box() etc create a new SDL_Surface.
72     [done with function pointers] Rather than each frame having its own set_*_widget_sel() etc, find a way to describe this with data or function pointers.
74 Improve the gui/widget code itself:
75     [done] Allow widgets to be disabled; such widgets would not do anything when the mouse clicked on them. (Widgets would be allowed to switch between enabled and disabled states, of course.)
76     [started] Allow only specified widgets to be repainted instead of repainting the whole screen when only one widget needs it.
78 Only count a button as clicked if the mouse is over an opaque part of the button? [What about, e.g., alpha=1?]
80 [irrelevant, used strings] Use consistent and unique ids for widgets.
82 [done, used panel_type_t] Unify loop_mode_t, options_mode_t, game_mode_t, and panel_type_t.
84 Have post-settings which apply after menu_data, game_data, and options_data have been initialized, to support mainmenu.quality?
86 Somehow allow different themes for different panels? (For example, shadow for the main menu and outline elsewhere.)
88 [done -- see xuni_t] Put all structures (smode_t, theme_t, font_t, gui_t, etc) into one structure?
90 If SDL_SetVideoMode() is called a second time, and fails, is the previous SDL_Surface pointer still valid? try_resizing_screen() assumes so.
92 Use an SDL_FilterEvent function instead of loop.c's process_event()?
94 [done] Use the default cursor if cursor.png could not be loaded.
96 [almost done, old cursor not erased] Re-enable the default cursor if the window focus is lost.
98 Implement a simple garbage collector?
100 Convert the TODO file to a more readable format.
102 Widgets to consider adding include: tooltips, comboboxes, spinners, scrollbars, progress bars . . . .
104 Split free_widget() into fake, when-the-window-is-being-resized freeing and real, genuine, complete freeing code. Otherwise there are issues because real freeing must recurse into composite widgets, while fake freeing should not. (Either that or introduce yet another parameter . . . int all, int fake . . . .)
106 Create an archive, libxuni.a.
108 Implement an undo/redo tree instead of just undo/redo? (Would be very difficult, but very impressive.)
110 [done with hack, bug not fixed] Check for focus whenever the screen is resized.
112 [done] Store all information in structures that is required to resize widgets automatically -- including text and positions.
114 [done] Develop a method of representing complex resizable positions -- a whole new coordinate system, really.
116 [done] Create "text" and "image" widgets, and make the theme menu's fontsample as well as the main menu's code into widgets. (Maybe not the background, as it is never resized.)
118 [done] Specify checkboxes as composite text and button widgets.
120 Detect keydowns and only handle escape etc for matching keyups? (Otherwise, pressing ALT-TAB-SHIFT-TAB-ESCAPE registers an escape keypress in xuni.)
122 Determine where widget_t::compose and widget_t::pos need to be checked against NULL. (Make widget_t::pos a structure once more instead of a pointer?)
124 [semi-done -- used xuni_t instead] Create a structure to pass to each panel-handling function -- i.e. one for init_func_t, one for start_func_t, etc.
126 [done] Allow left-aligned as well as centre-aligned labels.
128 Allow click repeating, for scrollbars?
130 Move what is really scrollbar code out of listbox sections.
132 Make overlapping widgets semi-work.
134 Where did menu.c's mysterious .69 come from?
136 Hide the check images of checkboxes when the it is not checked.
138 Modify WIDGET_LABEL for use in textboxes.
140 Fix the offset bugs for listboxes and textboxes.
142 Make all widgets clip-able, perhaps with SDL_SetClipRect().
144 ---- External bugs discovered ----
145 The only member of the structure located in file:///usr/share/doc/libsdl1.2-dev/docs/html/sdlexposeevent.html is missing a semicolon.
147 In file:///usr/share/doc/libsdl1.2-dev/docs/html/sdlexposeevent.html, the description belongs with SDL_QUITEVENT:
148     SDL_ExposeEvent -- Quit requested event