Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
VIM navigation key bindings for Civilization 5
From 36e239f83d6858f9f0c13c89fa83d8b2de2d9756 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Matthias=20Ku=CC=88ch?= <halde@matthias-kuech.de>
Date: Mon, 31 Oct 2016 18:46:26 +0100
Subject: [PATCH] Added VIM keybindings to Civilization 5
---
UI/InGame/WorldView/WorldView.lua | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/UI/InGame/WorldView/WorldView.lua b/UI/InGame/WorldView/WorldView.lua
index a958521..ffdcc20 100755
--- a/UI/InGame/WorldView/WorldView.lua
+++ b/UI/InGame/WorldView/WorldView.lua
@@ -87,19 +87,19 @@ local DefaultMessageHandler = {};
DefaultMessageHandler[KeyEvents.KeyDown] =
function( wParam, lParam )
- if ( wParam == Keys.VK_LEFT ) then
+ if ( wParam == Keys.VK_LEFT or wParam == Keys.H) then
Events.SerialEventCameraStopMovingRight();
Events.SerialEventCameraStartMovingLeft();
return true;
- elseif ( wParam == Keys.VK_RIGHT ) then
+ elseif ( wParam == Keys.VK_RIGHT or wParam == Keys.L) then
Events.SerialEventCameraStopMovingLeft();
Events.SerialEventCameraStartMovingRight();
return true;
- elseif ( wParam == Keys.VK_UP ) then
+ elseif ( wParam == Keys.VK_UP or wParam == Keys.K) then
Events.SerialEventCameraStopMovingBack();
Events.SerialEventCameraStartMovingForward();
return true;
- elseif ( wParam == Keys.VK_DOWN ) then
+ elseif ( wParam == Keys.VK_DOWN or wParam == Keys.J) then
Events.SerialEventCameraStopMovingForward();
Events.SerialEventCameraStartMovingBack();
return true;
@@ -118,16 +118,16 @@ end
DefaultMessageHandler[KeyEvents.KeyUp] =
function( wParam, lParam )
- if ( wParam == Keys.VK_LEFT ) then
+ if ( wParam == Keys.VK_LEFT or wParam == Keys.H) then
Events.SerialEventCameraStopMovingLeft();
return true;
- elseif ( wParam == Keys.VK_RIGHT ) then
+ elseif ( wParam == Keys.VK_RIGHT or wParam == Keys.L) then
Events.SerialEventCameraStopMovingRight();
return true;
- elseif ( wParam == Keys.VK_UP ) then
+ elseif ( wParam == Keys.VK_UP or wParam == Keys.K) then
Events.SerialEventCameraStopMovingForward();
return true;
- elseif ( wParam == Keys.VK_DOWN ) then
+ elseif ( wParam == Keys.VK_DOWN or wParam == Keys.J) then
Events.SerialEventCameraStopMovingBack();
return true;
end
@@ -137,13 +137,13 @@ end
-- Emergency key up handler
function KeyUpHandler( wParam )
- if ( wParam == Keys.VK_LEFT ) then
+ if ( wParam == Keys.VK_LEFT or wParam == Keys.H) then
Events.SerialEventCameraStopMovingLeft();
- elseif ( wParam == Keys.VK_RIGHT ) then
+ elseif ( wParam == Keys.VK_RIGHT or wParam == Keys.L) then
Events.SerialEventCameraStopMovingRight();
- elseif ( wParam == Keys.VK_UP ) then
+ elseif ( wParam == Keys.VK_UP or wParam == Keys.K) then
Events.SerialEventCameraStopMovingForward();
- elseif ( wParam == Keys.VK_DOWN ) then
+ elseif ( wParam == Keys.VK_DOWN or wParam == Keys.J) then
Events.SerialEventCameraStopMovingBack();
end
end
--
2.8.4 (Apple Git-73)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment