Commit graph

62 commits

Author SHA1 Message Date
Dmitry Grigoryev fbd05a1592 optimize include files (include what you use) 2021-02-06 21:38:50 +01:00
Kp 2ded2b2d0c Make kmatrix background optional
Previously, if the background failed to load, the kmatrix window was
immediately aborted.  Change the logic so that a failure to load uses a
blank black background, but still shows the kmatrix window.
2020-12-26 21:17:29 +00:00
Kp 479884288c Always delegate to window_create for send_creation_events 2020-12-20 20:39:07 +00:00
Kp ae657007fe Remove send_creation_events parameter
It is always nullptr.
2020-10-22 02:26:16 +00:00
Kp b3c3066a38 Fix no-joystick build
When joystick support is not present, `event_joystick_get_button` is not
declared in joy.h.

Fixes: c24864b180 ("make menus controllable with joystick")
2020-09-11 03:08:02 +00:00
Kp c038805a9b Make credits window inherit from dcx::window 2020-08-28 00:18:45 +00:00
Martin Fiedler c24864b180 make menus controllable with joystick
In most menus, keyboard commands are synthesized
from controller buttons, leveraging the existing
axis-to-button translation.

Menu controls are currently fixed:
- button 0 (A) is confirm (Enter)
- button 1 (B) is cancel (Esc)
- button 2 (X) is switch (Space)
- button 3 (Y) is delete (Delete)
- axes 0 and 1 (main analog pad) maps to cursor keys
- all hats (D-pads) map to cursor keys

Title screens and credits can be confirmed
with any joystick button or axis motion too.
2020-06-28 17:08:26 +02:00
Kp db7b4b3f88 Refer to <memory> directly, not through "compiler-make_unique.h" 2020-05-02 21:18:43 +00:00
Kp cc38cdf4b8 Qualify uses of std::make_unique 2020-05-02 21:18:42 +00:00
Kp 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +00:00
Kp 597cb41717 Downgrade PCX failures from Error to CON_URGENT
There is no need to kill the program due to a missing or malformed PCX file.
2019-07-07 22:00:02 +00:00
Kp d355ef4030 Pass font to various drawing functions 2018-05-19 23:21:42 +00:00
Kp 08446f0ab6 Pass font to gr_string,gr_printf 2018-05-19 23:21:42 +00:00
Kp 49c0cdae2e Simplify calls to gr_set_default_canvas
Rather than use an inline wrapper and rely on the compiler optimizer to
redirect gr_set_current_canvas(nullptr) to gr_set_default_canvas,
rewrite all relevant calls directly in the source.

git grep -l 'gr_set_current_canvas' | xargs sed -i -e 's:gr_set_current_canvas(\s*NULL\|nullptr\s*);:gr_set_default_canvas();:'
2017-11-05 20:49:08 +00:00
Kp 86880af317 Cache canvas in credits_handler 2017-03-11 19:56:23 +00:00
Kp 5736804a23 Fold gr_set_curfont calls in credits_handler 2017-02-11 21:42:45 +00:00
Kp 6f81d13c41 Pass canvas to gr_set_curfont 2017-02-11 21:42:38 +00:00
Kp 5da784dbed Pass canvas to gr_{,u}string 2017-01-08 22:32:00 +00:00
Kp 1b57e9a5ff Pass canvas to show_fullscr 2017-01-01 00:45:43 +00:00
Chris Taylor 143ed30fee Merging in unification/master, resolving conflict in similar/main/kmatrix.cpp 2016-11-06 14:20:18 +08:00
Kp 3081e69536 Pass grs_main_bitmap to gr_init_bitmap_alloc 2016-10-29 23:16:15 +00:00
Chris Taylor 7ac820248c Use new event_process_all() for event loops that check for window_event_result::deleted (which is most of them) 2016-10-29 20:06:01 +08:00
Chris Taylor 7f7047063a Check for window_event_result::deleted for credits polling loop
This is instead of using window_exists, which could give a false positive if a new window was allocated with the same pointer value as a deleted one.
2016-10-28 15:23:36 +08:00
Chris Taylor 2d587de8dc Make call_default_handler return a window_event_result
Make call_default_handler return a window_event_result to inform the event system in future, particularly if a window was closed.
2016-10-27 16:36:24 +08:00
Kp 01f2932824 Pass grs_canvas &to window_create 2016-10-15 00:53:20 +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 d4b85de49b Remove redundant checks for nullptr before deleting dcx::window instances in response to feedback. 2016-10-03 11:21:11 +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 ee1003f29f Move conditionally compiled code into namespace dsx 2016-08-25 04:05:32 +00:00
Kp 6691a1ff33 Split credits_show special case into dedicated functions 2016-08-19 03:41:42 +00:00
Kp a1ab71f5ad Avoid calling make_unique<...>({})
The compiler may or may not recognize that the temporary T{} passed to
make_unique can be omitted.  Help it by passing nothing, then explicitly
clearing the returned data as a separate step.
2016-08-06 19:55:24 +00:00
Kp 3fb16c1d7a Propagate bm_mode::linear into pcx_read_bitmap 2016-05-28 17:31:26 +00:00
Kp 398596c468 Use enum for bitmap mode 2016-05-28 17:31:26 +00:00
Kp d9cef82f81 Allow nullptr for gr_get_string_size 2015-09-29 02:41:22 +00:00
Kp 17b1943c5e Mark various per-file structures as static 2015-08-12 03:11:46 +00:00
Kp f899aaeaca Move player callsign to player-callsign.h 2015-07-25 23:10:45 +00:00
Kp 6792c1bc4b Enable -Wunused-parameter 2015-04-26 20:15:56 +00:00
Kp fa73ca8a17 Pass gr_remap_bitmap_good arg by & 2015-01-25 05:32:45 +00:00
Kp f7815810e8 Use RAIIPHYSFS_File to manage PHYSFS_File
Fixes a few leaks on error paths.
2015-01-17 18:31:42 +00:00
Kp 68d705a85a Use bool conversion to test PHYSFS_File pointer 2015-01-17 18:31:42 +00:00
Kp 28a31a223f Centralize window_close calls 2015-01-17 18:31:41 +00:00
Kp 137746e442 List initialize credits to zero 2014-12-18 04:12:38 +00:00
Kp 6b56a3020a Fix crash playing credits with poison enabled 2014-12-13 04:11:41 +00:00
Kp c990701d87 Pass show_fullscr arg by & 2014-12-02 03:35:01 +00:00
Kp 95539512d5 Pass pcx_read_bitmap arg by & 2014-12-02 03:35:01 +00:00
Kp 97332b848c Pass gr_free_bitmap_data arg by & 2014-11-30 22:09:20 +00:00
Kp a8f853aa7a Pass d_event arg by const& 2014-10-04 22:36:13 +00:00
Kp 5e932daf16 Propagate for variables in similar/main/credits.cpp 2014-09-26 02:42:08 +00:00
Kp e8f4b20d1d Use special type for PHYSFSX_fgets 2014-09-07 20:07:20 +00:00
Kp a02f78a171 Move saving window pointer into helper 2014-09-07 19:04:07 +00:00