Commit Graph

86 Commits (master)

Author SHA1 Message Date
Nicolas Hake 1cd3534740 C4KeyboardInput: Replace std::bind2nd &c by lambda
std::ptr_fun and std::bind_2nd have been deprecated since C++11, and
are no longer part of the standard since C++17.
2018-07-24 14:21:42 +02:00
Julius Michaelis 9d61cc9bc9 Fix Mac build broken in b11564168, attempt 2 2018-01-19 13:01:26 +01:00
Julius Michaelis 914d3798a4 Addedum to the control fixes in b11564168 (#1693, #1982):
- Allow configuring keyboard keys with modifier keys
 - Allow using Alt as a key in game on linux
   (I'm still puzzled why only Ctrl and Shift where implemented in so many places)
 - Adjust the deserializer and PlayerControls.txt to match the serializer for mouse keys
 - Refactor C4PlayerControl::DoMouseInput a little bit
 - Try to fix the Mac build (attempt 1)
 - Fix a bug in C4KeyCodeEx::CompileFunc where it set an incorrect KeyComboItem::sKeyName
 - Fix(?) StdCompilerConfigRead not doing anything on NoSeparator
2018-01-19 11:23:51 +01:00
Lukas Werling df979bb537 Fix restoring single-digit scancodes (#1944)
Most scancodes are two hex digits long, e.g. "$24" (J). However, there
are also a couple keys like Backspace ("$e") and Escape ("$1") with a
single-digit scancode. These previously weren't restored correctly.
2017-12-28 20:50:03 +01:00
Tushar Maheshwari 3a4f49ad90 Revisit #includes
Consolidate the include statements scattered across the code in accordance
with the comment in C4Include.h. The advantages are listed in the same
comment.
Furthermore, it follows llvm-include-order which is the logical
extrapolation of the project's style guideline wherever possible
(C4Include.h being the most-frequent exception).
2017-05-15 13:24:59 +02:00
Tushar Maheshwari e58a7884e4 Automatic fixes using clang-tidy
See http://forum.openclonk.org/topic_show.pl?tid=3376 for discussion.

Close GH-41
2017-05-03 20:30:45 +02:00
Nicolas Hake 41f4779d74 StdCompiler: Use terms "Serializer" and "Deserializer"
Instead of "Compiler" and "Decompiler", which make me look up what's
even going on each time I see them, use the standard terms "serializer"
and "deserializer".
2017-03-11 15:05:41 +01:00
Sven Eberhardt ebda8193ef Replace NULL by nullptr in C++ sources
We don't support pre-C++0x any more, so nullptr should be fine everywhere (except in the plain C source files)
2016-11-02 19:58:02 -04:00
Lukas Werling 9c98227a03 Fix all -Wformat warnings 2016-10-31 23:39:45 +01:00
Lukas Werling 2044fc3c06 SDL: Fix wrong keyboad button labels 2016-08-20 23:16:31 +02:00
Lukas Werling 26a552473c Add support for two extra mouse buttons (#mantis-is-down-right-now)
This also fixes a missing definition for "MiddleDouble". Only
implemented for SDL and Qt, someone else will have to do Windows.
2016-08-18 22:43:42 +02:00
Lukas Werling b7359e0c27 Remove the GTK platform (USE_GTK)
The GTK code does not work with the Qt editor. The simpler SDL2 platform
does, so we have little reason to keep the GTK code.

Note that GTK is still a dependency for mape.

Discussion: http://forum.openclonk.org/topic_show.pl?tid=3328
2016-08-03 16:25:46 +02:00
Sven Eberhardt 881534bee0 Qt Editor: Shape properties 2016-04-25 16:17:10 -04:00
Nicolas Hake eabca223f5 Update all copyright notices for 2016 2016-04-03 20:24:42 +02:00
Nicolas Hake 493c276126 Rewrite header inclusions to #include "path/to/file.h" style 2016-04-03 20:24:42 +02:00
Lukas Werling 9e0143b998 Remove gamepad ids from key codes
We want one gamepad key mapping to work with multiple gamepads, so
including the id there doesn't make sense.

Additionally, the gamepad id may change during the game (controller
hot-plugging).
2016-02-21 18:27:02 +01:00
Lukas Werling 9f69c650d6 Use icons for all controller buttons
The icons currently only show Xbox 360 controller labeling. The icon set
also includes icons for PlayStation controllers, so we could extend this
in the future.
2016-02-21 18:27:02 +01:00
Lukas Werling aa42d1deb7 Make controller button strings nicer
This also removes the controller id from the control definitions,
instead defaulting to 0. This doesn't change anything for now as we only
had definitions for controller 0 anyways.
2016-02-21 18:27:01 +01:00
Lukas Werling 24622f3a9c Update main menu GUI gamepad control bindings
It is now possible to control all GUI menus using the left stick or the
dpad, along with the A and B buttons on the controller.

This also doubles the button emulation dead zone to make navigating the
menus with the stick easier.
2016-02-21 18:26:44 +01:00
Lukas Werling 937ddaf722 Update key code strings for game controllers
With the SDL_GameController interface, buttons and axes have actual
names we can refer to. This also allows for advanced mappings using both
sticks (this probably needs script changes) as well as the triggers.
2016-02-13 23:28:00 +01:00
Günther Brammer 408dfff96e Fix indentation of the KeyCodeMap table
It used a mix of tabs and spaces for indentation, and tabs to separate the
columns, which doesn't work with variable tab sizes and variable column
widths. Use tabs for indentation and spaces for column separation.
2016-02-06 16:50:47 +01:00
Günther Brammer 934b519bb4 Update the SDL port to SDL2
SDL2 is a much closer match to the other platform code, and
allows the creation of OpenGL 3 core contexts, which is
now required.
2016-02-06 16:48:21 +01:00
Günther Brammer 59e5a327b2 gtk: Add support for microsoft windows 2016-02-06 16:47:44 +01:00
Günther Brammer 93f12150c4 CMake: Remove obsolete USE_X11 option and add USE_WIN32_WINDOWS
USE_WIN32_WINDOWS was previously defined in PlatformAbstraction.h. Move it
to CMakeLists.txt and config.h like its peers. Replace USE_X11 with USE_GTK
or GDK_WINDOWING_X11 as appropriate.
2016-01-23 20:36:34 +01:00
Sven Eberhardt afab6ef464 func PlayerControl: Send nil instead of 0 for non-mouse controls.
The main script function always assumed this, but it was not actually implemented that way.
2016-01-16 22:06:19 -05:00
Sven Eberhardt e89779a8c7 Handle key-up events corresponding to keys that were down even if scope is not matched #1145 2016-01-09 00:19:38 -04:00
Günther Brammer 5db59e8665 Fix C4MessageBoard key binding lifetime
I think C4Game::InitKeyboard relies on the callback targets outliving the
keybindings and every other class is prepared to be deleted before
C4KeyboardInput::Clear(), so needs to hold a ref to the keybinding to
delete that in its destructor.

C4KeyBinding is the class that is used for that, and it sets the reference
count to 1 in the constructor, to represent the reference held in the
owning class.

On the other hand, C4CustomKey gets immediately forgotten by C4Game and the
only reference is held in the keymap.

To prevent this from happening again, make the C4CustomKey constructors
protected and C4Game a friend of the class.

Also remove an unused C4CustomKey constructor.
2016-01-01 16:24:43 +01:00
Nicolas Hake f0eeb3f6b3 Make headless build compile again 2015-12-15 19:45:32 +01:00
Armin Burgmeier bbdec40075 Fix a free/delete/g_free mismatch 2015-10-18 14:45:52 -04:00
Armin Burgmeier ef4ea2d931 Drop support for GTK+ 2
The minimum GTK version is now GTK+ 3.4, which is available since 2012.
It's part of Ubuntu LTS 12.04, and so should be available on any halfway
modern linux distribution.

This should allow getting rid of using deprecated GTK+ API much easier.
2015-10-18 14:45:52 -04:00
Sven Eberhardt 15a1a62521 Automatically deduce shift state in combo keys with Control/Shift combo. 2015-09-01 19:11:13 -04:00
Sven Eberhardt 95baaa7934 Enable usage of LeftControl, RightControl, LeftShift and RightShift as player control keys. 2015-08-31 20:50:54 -04:00
Nicolas Hake e0dc30c59a Update copyright notices
As discussed in http://forum.openclonk.org/topic_show.pl?tid=2917, I
have merged all copyright notices into a single file and referenced that
merged file from each source file.

For the updated source files, the timeline has been split into three
parts:
 1. Pre-RWD code (before 2001)
 2. RWD code (2001 through 2009)
 3. OpenClonk code (2009 and later)
All pre-RWD copyright notices have been left intact, as have RWD-era
copyright notices where the file did not have a RedWolf design copyright
notice but only individual author ones. All copyright notices of the
OpenClonk era have been replaced by a single notice ranging from the
first recorded year to the current year (2013). Mape code did not get a
OpenClonk Team copyright notice because it is somewhat separate from the
main OpenClonk codebase and has only been touched by Armin Burgmeier.
2013-12-23 13:03:19 +01:00
Tobias Zwick 61ee6d393f Correct the scancode numbers for windows
Also reduce the duplication of these numbers in C4Window.h and C4KeyboardInput.cpp.
2013-05-26 18:07:09 +02:00
Martin Plicht 1d829361f7 mac: Minimal fix after scancode merge 2013-05-24 19:55:56 +02:00
Günther Brammer 346842470d Clean up some superfluous includes 2013-03-24 18:33:01 +01:00
Oliver Schneider 582e75d3da Use scancodes instead of localized key (#729)
The options dialog still shows localized keys, but the config files use US-Layout keys (when loading default files) and scancodes when saving player changes.
2013-02-09 01:05:27 +01:00
Günther Brammer 864c5c7ea8 copyright notices update 2012 2013-01-12 16:31:40 +01:00
Armin Burgmeier cf159068b3 Fix warning about undefined backspace key on Linux 2012-10-13 16:15:01 +02:00
Armin Burgmeier 56861e4601 Implement key by scancode in PlayerControls.txt on X11
Unfortunately they seem to be different in linux and windows
2012-10-13 16:03:47 +02:00
Sven Eberhardt 420a91f5fd fix build 2012-10-09 19:04:11 +02:00
Sven Eberhardt 8bdd761027 PlayerControls: Allow usage of keyboard scan codes instead of virtual key names using $%x format (Win32 only)
Also re-resolves keys if the keyboard layout changed at runtime.
2012-10-09 00:54:34 +02:00
Armin Burgmeier e11e9845d1 Fix Windows build 2012-04-23 21:45:01 +02:00
Sven Eberhardt 80d5f01642 Added FnGetPlayerControlAssignment: Get key/button assigned to a control.
To be used by tutorial messages explaining controls.
2012-04-17 17:06:16 +02:00
Günther Brammer 40de33ca3c win32: Make sdl-mainloop option work
As it doesn't have the editor, this is only useful for compiling
more of our code on more platforms.
2012-03-23 22:53:56 +01:00
Bernhard Bonigl 03729bdbf1 Experimental: Added Interaction-Hotkeys on <> to . (the row below the home row).
Made the Keys <> on German Keyboards an \| and ;: on US Keyboards usable
2012-03-21 21:52:32 +01:00
Bernhard Bonigl 7ab6dde1b3 Fixed Apostrophe beeing mapped to VK_OEM_5 (\| on US) to VK_OEM_7 ('" on US) 2012-03-20 15:14:47 +01:00
Sven Eberhardt c287c093cc PlayerControl: Mouse coordinate space (viewport vs landscape) is now a control property; not an assignment property.
This is in preparation for proper custom control assignments
2011-11-20 21:49:38 +01:00
Günther Brammer 1cafba4be8 Rename files implementing C4AbstractApp and C4Window 2011-10-03 17:19:24 +02:00
Günther Brammer 2fcdd4d929 Convert keyboard key names to utf-8 2011-09-28 01:12:45 +02:00