Patch: WASD patch v0.1
Moderator: OpenTTD Developers
Patch: WASD patch v0.1
Deprecated..?
You can use another patch OpenTTD-ScrollHotkey Patch v0.1 (https://github.com/zzoru/OpenTTD-TinyPa ... roll.patch)
OpenTTD-WASD Patch v0.2
For my HHKB2, I want to play OpenTTD using wasd keys instead of arrow keys.
So, I made a WASD patch.
Git url: https://github.com/zzoru/OpenTTD-TinyPatches
Usage
Just apply this patch & compile & execute (How to patch: viewtopic.php?f=33&t=21678)
Also, you need to modify hotkeys.cfg (Delete usage of wasd keys likes GLOBAL+A)
Tested on macOS Sierra
(and maybe available on Windows, Linux, etc....)
TODO
* Make a option menu for wasd feature enable/disable.
* Auto disable hotkeys using wasd keys.
* Configureable keymaps for scrolling mainview. (But need to renaming wasd patch to other )
* Code refactoring
You can use
You can use another patch OpenTTD-ScrollHotkey Patch v0.1 (https://github.com/zzoru/OpenTTD-TinyPa ... roll.patch)
OpenTTD-WASD Patch v0.2
For my HHKB2, I want to play OpenTTD using wasd keys instead of arrow keys.
So, I made a WASD patch.
Git url: https://github.com/zzoru/OpenTTD-TinyPatches
Usage
Just apply this patch & compile & execute (How to patch: viewtopic.php?f=33&t=21678)
Also, you need to modify hotkeys.cfg (Delete usage of wasd keys likes GLOBAL+A)
Tested on macOS Sierra
(and maybe available on Windows, Linux, etc....)
TODO
* Make a option menu for wasd feature enable/disable.
* Auto disable hotkeys using wasd keys.
* Configureable keymaps for scrolling mainview. (But need to renaming wasd patch to other )
* Code refactoring
You can use
Last edited by zzoru on 04 Aug 2017 19:50, edited 3 times in total.
Re: Patch: WASD patch v0.1
Why not make a patch that extends the hotkeys file?
Being a retired OpenTTD developer does not mean I know what I am doing.
Re: Patch: WASD patch v0.1
That is one of my todo list.Alberth wrote:Why not make a patch that extends the hotkeys file?
I think that this patch is a fastest(also, easiest) way to apply wasd keys for scrolling mainview.
and also It seems that OpenTTD hotkey system doesn't completely support simultaneous alphabet key input now (Hotkey system needs to support it because of scrolling upleft, upright, etc...), isn't it? (I make some codes for testing this.)
Re: Patch: WASD patch v0.1
I make sample code using hotkey system.zzoru wrote:That is one of my todo list.Alberth wrote:Why not make a patch that extends the hotkeys file?
I think that this patch is a fastest(also, easiest) way to apply wasd keys for scrolling mainview.
and also It seems that OpenTTD hotkey system doesn't completely support simultaneous alphabet key input now (Hotkey system needs to support it because of scrolling upleft, upright, etc...), isn't it? (I make some codes for testing this.)
src/video/cocoa/event.mm
Code: Select all
static Hotkey test_hotkeys[] = {
Hotkey('W', "scroll_up", GHK_SCROLL_UP),
Hotkey('S', "scroll_down", GHK_SCROLL_DOWN),
Hotkey('A', "scroll_left", GHK_SCROLL_LEFT),
Hotkey('D', "scroll_right", GHK_SCROLL_RIGHT),
HOTKEY_LIST_END
};
HotkeyList *hotkeys = new HotkeyList("test", test_hotkeys);
static bool QZ_KeyEvent(unsigned short keycode, unsigned short unicode, BOOL down)
{
bool interpret_keys = true;
int hotkey = hotkeys->CheckMatch(QZ_MapKey(keycode));
switch (hotkey) {
case GHK_SCROLL_UP: SB(_dirkeys, 1, 1, down); break;
case GHK_SCROLL_DOWN: SB(_dirkeys, 3, 1, down); break;
case GHK_SCROLL_LEFT: SB(_dirkeys, 0, 1, down); break;
case GHK_SCROLL_RIGHT: SB(_dirkeys, 2, 1, down); break;
}
switch (keycode) {
case QZ_TAB: _tab_is_down = down; break;
case QZ_RETURN:
case QZ_f:
if (down && (_current_mods & NSCommandKeyMask)) {
VideoDriver::GetInstance()->ToggleFullscreen(!_fullscreen);
}
break;
case QZ_v:
if (down && EditBoxInGlobalFocus() && (_current_mods & (NSCommandKeyMask | NSControlKeyMask))) {
HandleKeypress(WKC_CTRL | 'V', unicode);
}
break;
case QZ_u:
if (down && EditBoxInGlobalFocus() && (_current_mods & (NSCommandKeyMask | NSControlKeyMask))) {
HandleKeypress(WKC_CTRL | 'U', unicode);
}
break;
}
but, OnHotKey API can't handle simultaneous key input
Re: Patch: WASD patch v0.1
No. It seems that you took proper direction already.zzoru wrote:I think that hotkey must be handled by OnHotKey API.
don't worry, be happy and checkout my patches
Re: Patch: WASD patch v0.1
I already made another patch.adf88 wrote:No. It seems that you took proper direction already.zzoru wrote:I think that hotkey must be handled by OnHotKey API.
https://github.com/zzoru/OpenTTD-TinyPa ... roll.patch
-
- Engineer
- Posts: 1
- Joined: 22 Aug 2019 08:21
Re: Patch: WASD patch v0.1
Hi.
I try to compile the code after applying the wasd patch but there are errors while compiling.
I'm using tortoiseSVN to download the latest source code and apply the patch, and VSC 2019 to compile.
I try to compile the code after applying the wasd patch but there are errors while compiling.
I'm using tortoiseSVN to download the latest source code and apply the patch, and VSC 2019 to compile.
Re: Patch: WASD patch v0.1
I'm not familiar with this patch at all, but considering the warnings are on four consecutive lines, I'm going to take a guess that the OpenTTD source code changed and that the code you need to modify is no longer on those line numbers. You may need to go through the source code and locate the new lines, then modify the patch.
Also, the original author hasn't visited this site since he last updated the patch in 2017. This patch may be DOA.
Also, the original author hasn't visited this site since he last updated the patch in 2017. This patch may be DOA.
Do you like drones, quadcopters & flying toys? Check out Drone Strike Force!
Base Music Sets: OpenMSX | Scott Joplin Anthology | Traditional Winter Holiday Music | Modern Motion Music
Other Projects: 2CC Trams | Modern Waypoints | Sprite Sandbox & NewGRF Releases | Ideabox | Town Names | Isle of Sodor Scenario | Random Sprite Repository
Misc Topics: My Screenshots | Forgotten NewGRFs | Unfinished Graphics Sets | Stats Shack | GarryG's Auz Sets
Base Music Sets: OpenMSX | Scott Joplin Anthology | Traditional Winter Holiday Music | Modern Motion Music
Other Projects: 2CC Trams | Modern Waypoints | Sprite Sandbox & NewGRF Releases | Ideabox | Town Names | Isle of Sodor Scenario | Random Sprite Repository
Misc Topics: My Screenshots | Forgotten NewGRFs | Unfinished Graphics Sets | Stats Shack | GarryG's Auz Sets
Re: Patch: WASD patch v0.1
I've played with wasd recently and fixed those errors. It's for citymania client though so line numbers can be off a bit.
https://bitbucket.org/citymania/cmclien ... 5e?at=wasd
https://bitbucket.org/citymania/cmclien ... 5e?at=wasd
Who is online
Users browsing this forum: No registered users and 3 guests