Commit graph

180 commits

Author SHA1 Message Date
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 708cd027f0 Use member initialisation list for dcx::window constructor in response to feedback. 2016-10-03 11:10: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
Chris Taylor f117df9eee Allow dcx::window struct to be subclassed - step 2
Allow dcx::window struct to be subclassed step 2. This step renames and reconfigures window_create in window.cpp to be the main constructor. Also add a template constructor that allows an event handler that takes a subclass of window.
2016-10-02 14:49:22 +08:00
Chris Taylor 15e9f4a383 Allow dcx::window struct to be subclassed - step 1
Allow dcx::window struct to be subclassed step 1. This step moves the definition for the window struct into window.h, keeping all member variables private and declaring the window related functions as 'friends'. This avoids changes to source files that use the window struct at this stage. Also moving some of the simpler functions in window.cpp into the struct definition to inline them. I would prefer to use class methods, so changing some of these to class methods as well.
2016-10-02 14:32:30 +08:00
Kp 4894117d70 Rename MAX_HATS_PER_JOYSTICK to DXX_MAX_HATS_PER_JOYSTICK
Rename symbol MAX_HATS_PER_JOYSTICK to DXX_MAX_HATS_PER_JOYSTICK
to show that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_HATS_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_HATS_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp 94937de128 Rename MAX_BUTTONS_PER_JOYSTICK to DXX_MAX_BUTTONS_PER_JOYSTICK
Rename symbol MAX_BUTTONS_PER_JOYSTICK to DXX_MAX_BUTTONS_PER_JOYSTICK
to show that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_BUTTONS_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_BUTTONS_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp 7d38a9f0be Rename MAX_AXES_PER_JOYSTICK to DXX_MAX_AXES_PER_JOYSTICK
Rename symbol MAX_AXES_PER_JOYSTICK to DXX_MAX_AXES_PER_JOYSTICK to show
that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_AXES_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_AXES_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp f24e9f836c Rename MAX_JOYSTICKS to DXX_MAX_JOYSTICKS
Rename symbol MAX_JOYSTICKS to DXX_MAX_JOYSTICKS to show that it is a DXX
symbol, not one inherited from a library.

git grep -lzw MAX_JOYSTICKS -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_JOYSTICKS\>/DXX_&/g'
2016-09-25 04:52:48 +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
Kp fcb0b4fa66 Replace SDL CD_INDRIVE with equivalent that uses C++ static_cast
<=gcc-5 with -Wold-style-cast warn when expansions of SDL macro
CD_INDRIVE produce an old style cast, even though the cast comes from a
system header.  Undefine it and define an equivalent that uses a C++
cast, so that uses do not provoke a warning.
2016-09-04 19:10:43 +00:00
Kp a09dce6ead Remove char[N] overload for PHYSFSX_getRealPath 2016-08-06 19:55:25 +00:00
zico a8ed0aaa9c Added breaks in event.cpp to prevent unwanted events if -nomouse and/or -nojoystick is given; Added automap_apply_input() to prevent multiple inputs per frame causing multiple movement applications. 2016-05-30 13:17:42 +02:00
Kp ae722cbb8b Shorten maybe_send_z_move 2016-04-03 17:50:42 +00:00
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +00:00
Kp b57f08c798 Use partial_const_range 2016-02-12 04:02:28 +00:00
Kp 455ab60c4a Switch OGL extension include to <SDL.h>
The new OGL extension code included <SDL/SDL.h>, which works when the
SDL headers are installed in a directory named SDL and that directory is
in a system search directory.  Those conditions usually hold on Linux,
both for /usr/include and /usr/local/include.  However, non-Linux users
sometimes install SDL in other places.  Kreator reports that the OGL
build on OS X failed because his SDL headers were on the search path,
but not in a directory named SDL on the search path.  Switch the
include directive to an unqualified name to match other SDL includes.

Reported-by: kreatordxx <private mail>
Fixes: db267af6f2 ("add basic OpenGL extension handling")
2016-02-11 03:25:52 +00:00
Kp 16c754f3a2 Split key_toggle_repeat paths at compile time
Every caller passes a literal truth value.  Split the implementation by
the truth value.  This saves loading the value before the call and
testing it inside the call.
2016-01-09 16:38:10 +00:00
Kp dc8c0323d8 Uninline namespace dcx 2015-12-13 18:00:49 +00:00
Kp 2445c8457c Use inline namespace dcx for common/arch/win32 2015-12-05 22:57:24 +00:00
Kp dbe4918f27 Use inline namespace dcx for common/arch/sdl 2015-12-05 22:57:24 +00:00
Kp de6c2b3982 Use inline namespace dcx for common/arch/ogl 2015-12-05 22:57:24 +00:00
Kp 6210d1008b Add if !OGL to SDL-only functions 2015-12-04 03:36:31 +00:00
Kp 40588aaa0a Remove unnecessary key.cpp Installed 2015-11-26 02:56:55 +00:00
Kp dad504cfef Fix some -Wshadow warnings 2015-11-26 02:56:54 +00:00
Kp 2e91f1ac45 Simplify event_key_get_raw 2015-11-24 04:05:36 +00:00
Kp bca44c3199 Make keyd_repeat static 2015-11-24 04:05:35 +00:00
Kp a40d1efcd0 Sort joystick data smallest first 2015-11-01 21:15:40 +00:00
Kp 6111e5adbf Allow configuring max joysticks at build time 2015-11-01 21:15:40 +00:00
Kp 37bffb75dd Use std::tuple for storing d_physical_joystick members
Simplify later cleanup by hiding the members behind accessors.
2015-11-01 21:15:39 +00:00
Kp b639ba151a Remove unused joystick globals n_axes,n_buttons,n_hats
These are used only in one function.  Make them local only.
2015-11-01 21:15:39 +00:00
Kp 04ee450a07 Take local references to joystick text 2015-11-01 21:15:39 +00:00
Kp 78de0ac119 Add fwd-event.h with forward declarations of event.h 2015-10-09 02:46:10 +00:00
Kp e8a4a25639 Use template alias for window_subfunction_t 2015-10-09 02:46:10 +00:00
zico 708372a148 Included compiler-range_for.h into joy.cpp to fix compiler error of undefined range_for 2015-09-29 12:02:49 +02:00
Kp 9642a4c31d Close SDL joystick handles at shutdown 2015-09-29 02:41:22 +00:00
Kp e5dff6d63f Use array<> for d_physical_joystick hat_map, button_map 2015-09-29 02:41:22 +00:00
Kp 46bbdd43af Move Joystick.n_axes, Joystick.n_buttons into local scope 2015-09-29 02:41:22 +00:00
Kp 7821af1303 Move axis values into individual joysticks
SDL2 allows joysticks to come and go.  This conflicts with the unified
virtual joystick.
2015-09-19 23:04:35 +00:00
Kp 21be29e0d4 Optimize out button_last_state
This shrinks struct Joystick and makes joy_hat_handler much shorter.
2015-09-19 23:04:34 +00:00
Kp 69e3762933 Return joystick axis values by reference 2015-09-19 23:04:34 +00:00
Kp 38dc303bf8 Simplify joy_flush 2015-09-19 23:04:34 +00:00
Kp 8185991062 Ignore excess joysticks 2015-09-13 21:02:19 +00:00
Kp 17b1943c5e Mark various per-file structures as static 2015-08-12 03:11:46 +00:00
Kp bc7c469ab2 Use array<> for more globals 2015-08-12 03:11:46 +00:00
Kp 9bfea35e4f Use forward-declaration header for gr.h 2015-07-25 23:10:45 +00:00
Kp cfdffa184f Move similar/arch/sdl/event.cpp -> common/arch/sdl/event.cpp 2015-07-18 21:01:56 +00:00
Kp 04d9f82a50 Move similar/arch/sdl/key.cpp -> common/arch/sdl/key.cpp 2015-07-18 21:01:56 +00:00
Kp c7542fe9fc Move similar/arch/sdl/mouse.cpp -> common/arch/sdl/mouse.cpp 2015-07-18 21:01:56 +00:00
Kp bbcdf9f7d2 Fix LTO -Wodr for GameCfg 2015-07-18 03:49:47 +00:00
Kp 19ed586988 SDL2: SDL_JoystickName parameter changed 2015-07-14 02:42:12 +00:00
Kp b822f4c049 Simplify joystick setup 2015-07-14 02:42:12 +00:00
Kp c03fe30fc2 Move similar/arch/sdl/timer.cpp -> common/arch/sdl/timer.cpp 2015-07-04 21:01:17 +00:00
Kp 371838c74e Use unique_ptr to manage GLsync fence 2015-05-09 17:39:01 +00:00
Kp 5a2c11c7ad Precompute OGL sync wait_timeout milliseconds 2015-05-09 17:39:01 +00:00
Kp 6792c1bc4b Enable -Wunused-parameter 2015-04-26 20:15:56 +00:00
Kp ff83ba95b6 Remove unused ogl_extensions_init return value 2015-03-25 01:59:21 +00:00
Kp 694c522756 Use array<> for OpenGL extension version 2015-03-25 01:59:20 +00:00
derhass bf723efd48 use C++ style reinterpret_casts to pointers from SDL_GetProcAddress to function pointer types 2015-03-23 20:06:23 +01:00
derhass 6d41224638 move GL synchronization code into its own class 2015-03-22 21:19:06 +01:00
derhass db267af6f2 add basic OpenGL extension handling
Currently only used for fence sync objects.
2015-03-22 20:32:14 +01:00
Kp 1f5190bcfd Fix resource leak closing SDL RW ops
Leak introduced in b3d134a6b7 ("merged
physfs branch"), but this fix only applies after the conversion to RAII.
An equivalent change from SDL_FreeRW->SDL_RWclose is needed for pre-RAII
code.

Fixes: d0de0cf963 ("Use unique_ptr for SDL_RWops")
2015-02-28 22:34:07 +00:00
Kp 40fd988a0f Hide local classes in anonymous namespaces 2015-01-23 03:55:06 +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 9a3796d9d1 Pass window_get_next arg by & 2015-01-17 18:31:41 +00:00
Kp 3bf1fd573c Pass window_select arg by & 2015-01-17 18:31:41 +00:00
Kp 4984f46ef4 Pass window_set_visible arg by & 2015-01-17 18:31:41 +00:00
Kp 88bc7454f5 Pass window_is_visible arg by & 2015-01-17 18:31:41 +00:00
Kp b2a8c4502e Pass window_set_modal arg by & 2015-01-17 18:31:41 +00:00
Kp e7c632b741 Pass window_is_modal arg by & 2015-01-17 18:31:40 +00:00
Kp ee50d45e72 Pass window_send_event arg by & 2015-01-17 18:31:40 +00:00
Kp c731558a94 Pass gr_init_sub_canvas arg by & 2015-01-17 18:31:40 +00:00
Kp c2b7990550 Pass window_get_canvas arg by & 2015-01-17 18:31:40 +00:00
Kp f1885ee4d4 Pass creation context to new windows 2014-12-20 04:36:09 +00:00
Bradley Bell 0cc88280ba Simplify by using generic Info.plist, builtin substitions 2014-12-04 18:11:57 -08:00
Bradley Bell 3daa0f63b1 Add search SDL_mixer framework paths for headers instead of using <Framework/Header.h> notation 2014-12-03 15:14:18 -08:00
Kp ec8738ca62 Merge branch 'btb/osx-fixes' into unification/master
Merge Mac OS X specific fixes from btb.  The Windows and Linux builds
are unaffected.  The OS X changes look sane, but cannot be tested here.

Changes not specific to OS X were previously committed separately.

Requested by btb: https://github.com/dxx-rebirth/dxx-rebirth/pull/12
2014-12-01 23:47:10 +00:00
Kp ef539be1ab Pass gr_init_bitmap_data arg by & 2014-11-30 22:09:21 +00:00
Kp 3cbb73c1f2 Fix prototype of Mac msgbox_warning
Reported by btb: https://github.com/dxx-rebirth/dxx-rebirth/pull/12
Fixed by btb: 2f4b2f031c
2014-11-30 17:03:54 +00:00
Bradley Bell 7f10bb28bf use NSAlert for cocoa. Carbon support totally deprecated 2014-11-23 19:53:02 -08:00
Bradley Bell 1adb29da37 Revert "stub. CreateStandardAlert is dead"
This reverts commit f8761b0d11.
2014-11-23 19:40:11 -08:00
Bradley Bell 2f4b2f031c message is constant 2014-11-23 04:26:58 -08:00
Bradley Bell f8761b0d11 stub. CreateStandardAlert is dead 2014-11-23 04:12:29 -08:00
Kp a8f853aa7a Pass d_event arg by const& 2014-10-04 22:36:13 +00:00
Kp 8750b6a4ad Switch d_event subclasses to C++ inheritance 2014-10-04 18:05:26 +00:00
Kp 488713fe93 Propagate for variables in common/arch/sdl/rbaudio.cpp 2014-09-26 02:42:14 +00:00
Kp e2d6174694 Propagate for variables in common/arch/sdl/joy.cpp 2014-09-26 02:42:14 +00:00
Kp 2c8a07cfa7 Use vector<uint8_t> to manage current_music_hndlbuf 2014-09-20 23:14:03 +00:00
Kp 2f7b9a7aa7 Use C++ memory management for window 2014-09-17 02:45:23 +00:00
Kp e77f02700a Use unique_ptr for current_music 2014-08-27 02:52:21 +00:00
Kp 4acbb40ad7 Use enum for window event result 2014-08-07 02:47:48 +00:00
Kp 5c5eb1f1f7 Let WINDOW_SEND_EVENT return a value 2014-08-05 02:34:06 +00:00
Kp ee32a200ea Change window_create<void> to be non-template 2014-08-05 02:33:40 +00:00
Kp a6dcfa2e30 Simplify audio CD discovery 2014-07-22 23:48:23 +00:00
Kp 2a8e0a78c6 Use partial_range with RBAudio 2014-07-14 02:17:40 +00:00
Kp 5339c4873a Use assignment to clear Joystick 2014-07-04 03:43:01 +00:00