2
0
Эх сурвалжийг харах

Make escape key name consistent between keycode and scancode.

cosmy 9 жил өмнө
parent
commit
b057434bfa

+ 1 - 1
Docs/Reference.dox

@@ -303,7 +303,7 @@ public:
 
 
         // Check for pressing ESC. Note the engine_ member variable for convenience access to the Engine object
         // Check for pressing ESC. Note the engine_ member variable for convenience access to the Engine object
         int key = eventData[P_KEY].GetInt();
         int key = eventData[P_KEY].GetInt();
-        if (key == KEY_ESC)
+        if (key == KEY_ESCAPE)
             engine_->Exit();
             engine_->Exit();
     }
     }
 };
 };

+ 1 - 1
Source/Samples/26_ConsoleInput/ConsoleInput.cpp

@@ -118,7 +118,7 @@ void ConsoleInput::HandleUpdate(StringHash eventType, VariantMap& eventData)
 void ConsoleInput::HandleEscKeyDown(StringHash eventType, VariantMap& eventData)
 void ConsoleInput::HandleEscKeyDown(StringHash eventType, VariantMap& eventData)
 {
 {
     // Unlike the other samples, exiting the engine when ESC is pressed instead of just closing the console
     // Unlike the other samples, exiting the engine when ESC is pressed instead of just closing the console
-    if (eventData[KeyDown::P_KEY].GetInt() == KEY_ESC && GetPlatform() != "Web")
+    if (eventData[KeyDown::P_KEY].GetInt() == KEY_ESCAPE && GetPlatform() != "Web")
         engine_->Exit();
         engine_->Exit();
 }
 }
 
 

+ 1 - 1
Source/Samples/41_DatabaseDemo/DatabaseDemo.cpp

@@ -139,7 +139,7 @@ void DatabaseDemo::HandleUpdate(StringHash eventType, VariantMap& eventData)
 void DatabaseDemo::HandleEscKeyDown(StringHash eventType, VariantMap& eventData)
 void DatabaseDemo::HandleEscKeyDown(StringHash eventType, VariantMap& eventData)
 {
 {
     // Unlike the other samples, exiting the engine when ESC is pressed instead of just closing the console
     // Unlike the other samples, exiting the engine when ESC is pressed instead of just closing the console
-    if (eventData[KeyDown::P_KEY].GetInt() == KEY_ESC)
+    if (eventData[KeyDown::P_KEY].GetInt() == KEY_ESCAPE)
         engine_->Exit();
         engine_->Exit();
 }
 }
 
 

+ 1 - 1
Source/Samples/Sample.inl

@@ -222,7 +222,7 @@ void Sample::HandleKeyUp(StringHash eventType, VariantMap& eventData)
     int key = eventData[P_KEY].GetInt();
     int key = eventData[P_KEY].GetInt();
 
 
     // Close console (if open) or exit when ESC is pressed
     // Close console (if open) or exit when ESC is pressed
-    if (key == KEY_ESC)
+    if (key == KEY_ESCAPE)
     {
     {
         Console* console = GetSubsystem<Console>();
         Console* console = GetSubsystem<Console>();
         if (console->IsVisible())
         if (console->IsVisible())

+ 1 - 1
Source/Urho3D/AngelScript/InputAPI.cpp

@@ -120,7 +120,7 @@ static void RegisterInputConstants(asIScriptEngine* engine)
     engine->RegisterGlobalProperty("const int KEY_GUI", (void*)&KEY_GUI);
     engine->RegisterGlobalProperty("const int KEY_GUI", (void*)&KEY_GUI);
     engine->RegisterGlobalProperty("const int KEY_PAUSE", (void*)&KEY_PAUSE);
     engine->RegisterGlobalProperty("const int KEY_PAUSE", (void*)&KEY_PAUSE);
     engine->RegisterGlobalProperty("const int KEY_CAPSLOCK", (void*)&KEY_CAPSLOCK);
     engine->RegisterGlobalProperty("const int KEY_CAPSLOCK", (void*)&KEY_CAPSLOCK);
-    engine->RegisterGlobalProperty("const int KEY_ESC", (void*)&KEY_ESC);
+    engine->RegisterGlobalProperty("const int KEY_ESCAPE", (void*)&KEY_ESCAPE);
     engine->RegisterGlobalProperty("const int KEY_SPACE", (void*)&KEY_SPACE);
     engine->RegisterGlobalProperty("const int KEY_SPACE", (void*)&KEY_SPACE);
     engine->RegisterGlobalProperty("const int KEY_PAGEUP", (void*)&KEY_PAGEUP);
     engine->RegisterGlobalProperty("const int KEY_PAGEUP", (void*)&KEY_PAGEUP);
     engine->RegisterGlobalProperty("const int KEY_PAGEDOWN", (void*)&KEY_PAGEDOWN);
     engine->RegisterGlobalProperty("const int KEY_PAGEDOWN", (void*)&KEY_PAGEDOWN);

+ 1 - 1
Source/Urho3D/Input/Input.cpp

@@ -67,7 +67,7 @@ const unsigned TOUCHID_MAX = 32;
 int ConvertSDLKeyCode(int keySym, int scanCode)
 int ConvertSDLKeyCode(int keySym, int scanCode)
 {
 {
     if (scanCode == SCANCODE_AC_BACK)
     if (scanCode == SCANCODE_AC_BACK)
-        return KEY_ESC;
+        return KEY_ESCAPE;
     else
     else
         return SDL_toupper(keySym);
         return SDL_toupper(keySym);
 }
 }

+ 1 - 1
Source/Urho3D/Input/InputEvents.h

@@ -279,7 +279,7 @@ static const int KEY_ALT = SDLK_LALT;
 static const int KEY_GUI = SDLK_LGUI;
 static const int KEY_GUI = SDLK_LGUI;
 static const int KEY_PAUSE = SDLK_PAUSE;
 static const int KEY_PAUSE = SDLK_PAUSE;
 static const int KEY_CAPSLOCK = SDLK_CAPSLOCK;
 static const int KEY_CAPSLOCK = SDLK_CAPSLOCK;
-static const int KEY_ESC = SDLK_ESCAPE;
+static const int KEY_ESCAPE = SDLK_ESCAPE;
 static const int KEY_SPACE = SDLK_SPACE;
 static const int KEY_SPACE = SDLK_SPACE;
 static const int KEY_PAGEUP = SDLK_PAGEUP;
 static const int KEY_PAGEUP = SDLK_PAGEUP;
 static const int KEY_PAGEDOWN = SDLK_PAGEDOWN;
 static const int KEY_PAGEDOWN = SDLK_PAGEDOWN;

+ 1 - 1
Source/Urho3D/LuaScript/pkgs/Input/InputEvents.pkg

@@ -56,7 +56,7 @@ static const int KEY_ALT;
 static const int KEY_GUI;
 static const int KEY_GUI;
 static const int KEY_PAUSE;
 static const int KEY_PAUSE;
 static const int KEY_CAPSLOCK;
 static const int KEY_CAPSLOCK;
-static const int KEY_ESC;
+static const int KEY_ESCAPE;
 static const int KEY_SPACE;
 static const int KEY_SPACE;
 static const int KEY_PAGEUP;
 static const int KEY_PAGEUP;
 static const int KEY_PAGEDOWN;
 static const int KEY_PAGEDOWN;

+ 3 - 3
Source/Urho3D/UI/UI.cpp

@@ -1606,7 +1606,7 @@ void UI::HandleKeyDown(StringHash eventType, VariantMap& eventData)
     int key = eventData[P_KEY].GetInt();
     int key = eventData[P_KEY].GetInt();
 
 
     // Cancel UI dragging
     // Cancel UI dragging
-    if (key == KEY_ESC && dragElementsCount_ > 0)
+    if (key == KEY_ESCAPE && dragElementsCount_ > 0)
     {
     {
         ProcessDragCancel();
         ProcessDragCancel();
 
 
@@ -1614,7 +1614,7 @@ void UI::HandleKeyDown(StringHash eventType, VariantMap& eventData)
     }
     }
 
 
     // Dismiss modal element if any when ESC key is pressed
     // Dismiss modal element if any when ESC key is pressed
-    if (key == KEY_ESC && HasModalElement())
+    if (key == KEY_ESCAPE && HasModalElement())
     {
     {
         UIElement* element = rootModalElement_->GetChild(rootModalElement_->GetNumChildren() - 1);
         UIElement* element = rootModalElement_->GetChild(rootModalElement_->GetNumChildren() - 1);
         if (element->GetVars().Contains(VAR_ORIGIN))
         if (element->GetVars().Contains(VAR_ORIGIN))
@@ -1664,7 +1664,7 @@ void UI::HandleKeyDown(StringHash eventType, VariantMap& eventData)
             }
             }
         }
         }
         // Defocus the element
         // Defocus the element
-        else if (key == KEY_ESC && element->GetFocusMode() == FM_FOCUSABLE_DEFOCUSABLE)
+        else if (key == KEY_ESCAPE && element->GetFocusMode() == FM_FOCUSABLE_DEFOCUSABLE)
             element->SetFocus(false);
             element->SetFocus(false);
         // If none of the special keys, pass the key to the focused element
         // If none of the special keys, pass the key to the focused element
         else
         else

+ 1 - 1
bin/Data/LuaScripts/26_ConsoleInput.lua

@@ -89,7 +89,7 @@ end
 
 
 function HandleEscKeyDown(eventType, eventData)
 function HandleEscKeyDown(eventType, eventData)
     -- Unlike the other samples, exiting the engine when ESC is pressed instead of just closing the console
     -- Unlike the other samples, exiting the engine when ESC is pressed instead of just closing the console
-    if eventData["Key"]:GetInt() == KEY_ESC then
+    if eventData["Key"]:GetInt() == KEY_ESCAPE then
         engine:Exit()
         engine:Exit()
     end
     end
 end
 end

+ 1 - 1
bin/Data/LuaScripts/41_DatabaseDemo.lua

@@ -93,7 +93,7 @@ end
 
 
 function HandleEscKeyDown(eventType, eventData)
 function HandleEscKeyDown(eventType, eventData)
     -- Unlike the other samples, exiting the engine when ESC is pressed instead of just closing the console
     -- Unlike the other samples, exiting the engine when ESC is pressed instead of just closing the console
-    if eventData["Key"]:GetInt() == KEY_ESC then
+    if eventData["Key"]:GetInt() == KEY_ESCAPE then
         engine:Exit()
         engine:Exit()
     end
     end
 end
 end

+ 1 - 1
bin/Data/LuaScripts/Utilities/Sample.lua

@@ -149,7 +149,7 @@ end
 function HandleKeyUp(eventType, eventData)
 function HandleKeyUp(eventType, eventData)
     local key = eventData["Key"]:GetInt()
     local key = eventData["Key"]:GetInt()
     -- Close console (if open) or exit when ESC is pressed
     -- Close console (if open) or exit when ESC is pressed
-    if key == KEY_ESC then
+    if key == KEY_ESCAPE then
         if console:IsVisible() then
         if console:IsVisible() then
             console:SetVisible(false)
             console:SetVisible(false)
         else
         else

+ 1 - 1
bin/Data/Scripts/26_ConsoleInput.as

@@ -90,7 +90,7 @@ void HandleUpdate(StringHash eventType, VariantMap& eventData)
 void HandleEscKeyDown(StringHash eventType, VariantMap& eventData)
 void HandleEscKeyDown(StringHash eventType, VariantMap& eventData)
 {
 {
     // Unlike the other samples, exiting the engine when ESC is pressed instead of just closing the console
     // Unlike the other samples, exiting the engine when ESC is pressed instead of just closing the console
-    if (eventData["Key"].GetInt() == KEY_ESC)
+    if (eventData["Key"].GetInt() == KEY_ESCAPE)
         engine.Exit();
         engine.Exit();
 }
 }
 
 

+ 1 - 1
bin/Data/Scripts/41_DatabaseDemo.as

@@ -94,7 +94,7 @@ void HandleUpdate(StringHash eventType, VariantMap& eventData)
 void HandleEscKeyDown(StringHash eventType, VariantMap& eventData)
 void HandleEscKeyDown(StringHash eventType, VariantMap& eventData)
 {
 {
     // Unlike the other samples, exiting the engine when ESC is pressed instead of just closing the console
     // Unlike the other samples, exiting the engine when ESC is pressed instead of just closing the console
-    if (eventData["Key"].GetInt() == KEY_ESC)
+    if (eventData["Key"].GetInt() == KEY_ESCAPE)
         engine.Exit();
         engine.Exit();
 }
 }
 
 

+ 1 - 1
bin/Data/Scripts/Editor/EditorColorWheel.as

@@ -181,7 +181,7 @@ void HandleColorWheelKeyDown(StringHash eventType, VariantMap& eventData)
 
 
     int key = eventData["Key"].GetInt();
     int key = eventData["Key"].GetInt();
 
 
-    if (key == KEY_ESC)
+    if (key == KEY_ESCAPE)
     {
     {
         SendEvent(eventTypeWheelDiscardColor, eventData);
         SendEvent(eventTypeWheelDiscardColor, eventData);
         HideColorWheel();
         HideColorWheel();

+ 2 - 2
bin/Data/Scripts/Editor/EditorUI.as

@@ -1291,7 +1291,7 @@ void HandleHotKeysBlender( VariantMap& eventData)
     int key = eventData["Key"].GetInt();
     int key = eventData["Key"].GetInt();
     int viewDirection = eventData["Qualifiers"].GetInt() == QUAL_CTRL ? -1 : 1;
     int viewDirection = eventData["Qualifiers"].GetInt() == QUAL_CTRL ? -1 : 1;
 
 
-    if (key == KEY_ESC)
+    if (key == KEY_ESCAPE)
     {
     {
         if (uiHidden)
         if (uiHidden)
             UnhideUI();
             UnhideUI();
@@ -1481,7 +1481,7 @@ void HandleHotKeysStandard(VariantMap& eventData)
     int key = eventData["Key"].GetInt();
     int key = eventData["Key"].GetInt();
     int viewDirection = eventData["Qualifiers"].GetInt() == QUAL_CTRL ? -1 : 1;
     int viewDirection = eventData["Qualifiers"].GetInt() == QUAL_CTRL ? -1 : 1;
 
 
-    if (key == KEY_ESC)
+    if (key == KEY_ESCAPE)
     {
     {
         if (uiHidden)
         if (uiHidden)
             UnhideUI();
             UnhideUI();

+ 1 - 1
bin/Data/Scripts/Editor/EditorView.as

@@ -1347,7 +1347,7 @@ void UpdateView(float timeStep)
     {
     {
         changeCamViewButton = input.mouseButtonDown[MOUSEB_MIDDLE] || cameraFlyMode;
         changeCamViewButton = input.mouseButtonDown[MOUSEB_MIDDLE] || cameraFlyMode;
 
 
-        if (input.mouseButtonPress[MOUSEB_RIGHT] || input.keyDown[KEY_ESC])
+        if (input.mouseButtonPress[MOUSEB_RIGHT] || input.keyDown[KEY_ESCAPE])
             cameraFlyMode = false;
             cameraFlyMode = false;
     }
     }
 
 

+ 1 - 1
bin/Data/Scripts/NinjaSnowWar.as

@@ -469,7 +469,7 @@ void HandleKeyDown(StringHash eventType, VariantMap& eventData)
 {
 {
     int key = eventData["Key"].GetInt();
     int key = eventData["Key"].GetInt();
 
 
-    if (key == KEY_ESC)
+    if (key == KEY_ESCAPE)
     {
     {
         if (!console.visible)
         if (!console.visible)
             engine.Exit();
             engine.Exit();

+ 1 - 1
bin/Data/Scripts/Utilities/Sample.as

@@ -158,7 +158,7 @@ void HandleKeyUp(StringHash eventType, VariantMap& eventData)
     int key = eventData["Key"].GetInt();
     int key = eventData["Key"].GetInt();
 
 
     // Close console (if open) or exit when ESC is pressed
     // Close console (if open) or exit when ESC is pressed
-    if (key == KEY_ESC)
+    if (key == KEY_ESCAPE)
     {
     {
         if (console.visible)
         if (console.visible)
             console.visible = false;
             console.visible = false;