Commit graph

147 commits

Author SHA1 Message Date
Kp 4f6c8575f2 Cache canvas in listbox_create_structure 2017-04-30 16:25:19 +00:00
Kp 8d2bc05624 Cache canvas in listbox_draw 2017-04-30 16:25:19 +00:00
Kp 170d0ac777 Pass canvas &to nm_draw_background 2017-04-08 16:48:20 +00:00
Kp aaf7874235 Remove canvas juggling in nm_draw_background 2017-04-08 16:48:19 +00:00
Kp d827e73de9 Pass canvas &to draw_item 2017-04-08 16:48:19 +00:00
Kp 795eeecb3f Move marquee data to substructure 2017-03-26 21:53:47 +00:00
Kp 6c0be636ea Combine draw_item case branches 2017-03-11 19:56:29 +00:00
Kp a245e47fcc Pass canvas to nm_string_inputbox 2017-03-11 19:56:29 +00:00
Kp b21fc54ba4 Pass canvas to nm_string_black 2017-03-11 19:56:29 +00:00
Kp a7344b7dd0 Pass canvas to nm_string_slider 2017-03-11 19:56:29 +00:00
Kp 51a69a5a65 Pass canvas to nm_draw_background1 2017-03-11 19:56:29 +00:00
Kp b10ec2cb01 Cache canvas in newmenu_create_structure 2017-03-10 01:22:33 +00:00
Kp 569d64e927 Propagate Hack_DblClick_MenuMode 2017-02-11 21:42:47 +00:00
Kp d8638c6c89 Pass canvas to UP_ARROW_MARKER, DOWN_ARROW_MARKER 2017-02-11 21:42:43 +00:00
Kp 6b8f08142f Pass canvas to LINE_SPACING
Macro LINE_SPACING previously used global grd_curcanv implicitly.
Change it to take a canvas argument.  Change all callers to pass
grd_curcanv, so that usage is explicit.
2017-02-11 21:42:42 +00:00
Kp ed9fe62d85 Expand GHEIGHT
As a macro, it always refers to the global grd_curcanv.  This interferes
with converting canvas handling to be an argument.  Expand GHEIGHT so
that uses of grd_curcanv can be changed individually.
2017-02-11 21:42:42 +00:00
Kp 03c43b1d7f Expand GWIDTH
As a macro, it always refers to the global grd_curcanv.  This interferes
with converting canvas handling to be an argument.  Expand GWIDTH so
that uses of grd_curcanv can be changed individually.
2017-02-11 21:42:42 +00:00
Kp 6f81d13c41 Pass canvas to gr_set_curfont 2017-02-11 21:42:38 +00:00
Kp f88cfd9901 Cache canvas in newmenu_mouse MBTN_LEFT 2017-02-11 21:42:38 +00:00
Kp 3becce8cb1 Pass canvas to nm_rstring 2017-02-11 21:42:36 +00:00
Kp fbc16efa0f Pass canvas to nm_string 2017-02-11 21:42:36 +00:00
Kp 725ec77006 Avoid unnecessary allocations in nm_string
Only allocate a temporary string if a tab exists to be overwritten.
2017-02-11 21:42:36 +00:00
Kp 2c6e8fd446 Simplify nm_string 2017-02-11 21:42:36 +00:00
Kp d65ad71099 Cache newmenu_mouse LINE_SPACING 2017-02-11 21:42:35 +00:00
Kp ae33aaafc1 Pass canvas to gr_set_fontcolor 2017-02-11 21:42:32 +00:00
Kp 43a700a200 Prefer grs_main_bitmap::reset() to direct reinitialization
This ensures that any allocated resources are always freed.
2017-02-11 21:42:31 +00:00
Kp 5da784dbed Pass canvas to gr_{,u}string 2017-01-08 22:32:00 +00:00
Kp 1ef6b9d5bc Pass font to gr_get_string_size 2017-01-08 22:31:59 +00:00
Kp 0480ba8030 Pass canvas to gr_string(int,int,const char*,int,int) 2017-01-08 22:31:59 +00:00
Kp 0905aefa0a Pass canvas to gr_rect 2017-01-01 00:45:45 +00:00
Kp 794dcce327 Pass canvas to gr_urect 2017-01-01 00:45:44 +00:00
Kp 77c22d3a7f Pass canvas to gr_settransblend 2017-01-01 00:45:44 +00:00
Kp 1b57e9a5ff Pass canvas to show_fullscr 2017-01-01 00:45:43 +00:00
zico a10d9e0bba Prevent access of potentially uninitialized r.value in nm_trigger_radio_button() 2016-12-28 20:36:00 +01:00
Kp bb6b548540 Remove unused listbox_get_window 2016-12-22 05:21:16 +00:00
Kp ad806a8251 Reorder newmenu length test to skip key_ascii() call 2016-11-26 22:51:48 +00:00
Chris Taylor 21e41b15a9 Use listbox_subfunction_t template for listbox_callback member (for convenience of possible future modification) 2016-10-31 14:35:29 +08:00
Chris Taylor a62ca93498 Use a tracking variable for newmenu_do2 (and simpler) polling loop
Add 'track' method to dcx::window, which takes a bool and will set it to 'false' when the window closes. Use for newmenu_do2 and simpler newmenu_do's, since there's the possibility of another window without its own polling loop opening on top - meaning window_event_result::deleted would be returned for that window, not the one we're polling on.
2016-10-28 16:49:53 +08:00
Chris Taylor c351588bba Remove use of window_exists in newmenu_handler
Replace with a disabled check for window_event_result::deleted, which will be enabled when all newmenu subfunctions return a window_event_result. There are currently no instances of a subfunction closing the window itself (which is preferred).
2016-10-28 08:22:36 +08:00
Chris Taylor 48e9061960 Make the listbox handlers return a window_event_result
Make the listbox handlers and all sub-handlers (when_selected callbacks) return a window_event_result. Makes code more readable and removes one use of window_close, making it easier to inform event system if a window closes in future.
2016-10-27 15:22:41 +08:00
Kp d955eda96f Fix fullscreen checkbox handling
Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/224>
Fixes: 7128141c55 ("Use enum for newmenu item type")
2016-10-18 02:26:30 +00:00
Kp 2d54a0c57d Fix infinite recursion when newmenu_scroll has only one valid item 2016-10-15 17:51:47 +00:00
Kp 01f2932824 Pass grs_canvas &to window_create 2016-10-15 00:53:20 +00:00
Chris Taylor bc1c9ebd97 Merge branch 'unification/master' into allow_dialog_subclass
Conflicts:
	common/arch/sdl/window.cpp - Remove unused EVENT_WINDOW_CLOSED and w_callback local var
	common/ui/dialog.cpp - Remove unused EVENT_WINDOW_CLOSED
2016-10-10 14:40:11 +08:00
Kp 1af65071d7 Remove unused EVENT_WINDOW_CLOSED
Every callee that recognized EVENT_WINDOW_CLOSED did so only to
explicitly ignore it.  Remove the code to send it and all sites that
ignored it.
2016-10-10 00:25:15 +00:00
Chris Taylor 60ac1eaad3 Replace delete dcx::window kludge with a better solution
Replace delete dcx::window kludge with a better solution: instead of requiring every handler to delete the window, add a window_event_result::deleted, which gets returned if the window was deleted by the handler, so window_close knows not to attempt to delete it again.
2016-10-04 14:05:44 +08:00
Chris Taylor 87617e8ac9 Allow dcx::window struct to be subclassed - step 3
Allow dcx::window struct to be subclassed step 3. This step adds the window destructor and both requires and implements the window to be deleted by the event handler/client in all cases.
2016-10-02 17:49:19 +08:00
Kp 8d25cf4162 Define newmenu_item::*_specific_type::nm_type
The *_specific_type structures have a static member `nm_type`.  In -O0
builds, an out-of-line definition of this member is required, but was
not present.  In -O2 builds, the optimizer happened to remove all
references to the out-of-line definition, so the link succeeded despite
not having a definition.  Add that definition.
2016-09-28 01:56:12 +00:00
Kp 62b58e9890 Move OGL to dxxsconf.h; rename to DXX_USE_OGL
Rename symbol OGL to DXX_USE_OGL to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -lzw OGL -- '*.h' '*.cpp' | xargs -0 sed -i -e 's/\(\s*#\s*if\)def\s*OGL/\1 DXX_USE_OGL/' -e 's/\(\s*#\s*if\)ndef OGL/\1 !DXX_USE_OGL/' -e 's/\(\s*#\s*if !\?\)defined(OGL)/\1DXX_USE_OGL/'
2016-09-24 18:06:11 +00:00
zico ff331732ba Re-enabled timer_delay2 for general menu handlers and adjusted them to sleep according to set FPS and not sleep at all for Multiplayer since calc_frame_time() is active in that case. Modified sleeping towards 1ms in calc_frame_time() to allow for more precise target FPS and be able to relay packets in multiplayer with less delay. 2016-08-29 16:04:46 +02:00