Forráskód Böngészése

Pass window resized event (due to device orientation change) from SDL to Urho3D::Graphics class for both Android and iOS as well. Note that the event is only sent when the application has not locked the orientation. Minor code cleaned up on LuaScript subsystem.

Wei Tjong Yao 12 éve
szülő
commit
5d04c531a1

+ 1 - 1
Bin/Data/LuaScripts/01_HelloWorld.lua

@@ -49,4 +49,4 @@ end
 
 
 function HandleUpdate(eventType, eventData)
 function HandleUpdate(eventType, eventData)
     -- Do nothing for now, could be extended to eg. animate the display
     -- Do nothing for now, could be extended to eg. animate the display
-end
+end

+ 0 - 1
Bin/Data/LuaScripts/05_AnimatingScene.lua

@@ -180,4 +180,3 @@ function Rotator.Update(self, eventType, eventData)
     local z = self.rotationSpeed[3] * timeStep
     local z = self.rotationSpeed[3] * timeStep
     self.node:RotateXYZ(x, y, z)
     self.node:RotateXYZ(x, y, z)
 end
 end
-

+ 1 - 1
Bin/Data/LuaScripts/TestScene.lua

@@ -580,4 +580,4 @@ function CreateRagdollConstraint(root, boneName, parentName, type, axis, parentA
     constraint:SetOtherAxis(parentAxis)
     constraint:SetOtherAxis(parentAxis)
     constraint.highLimit = highLimit
     constraint.highLimit = highLimit
     constraint.lowLimit = lowLimit
     constraint.lowLimit = lowLimit
-end
+end

+ 0 - 2
Source/Engine/Input/Input.cpp

@@ -833,11 +833,9 @@ void Input::HandleSDLEvent(void* sdlEvent)
                 break;
                 break;
             #endif
             #endif
 
 
-            #if !defined(IOS) && !defined(ANDROID)
             case SDL_WINDOWEVENT_RESIZED:
             case SDL_WINDOWEVENT_RESIZED:
                 graphics_->WindowResized();
                 graphics_->WindowResized();
                 break;
                 break;
-            #endif
             }
             }
         }
         }
         break;
         break;

+ 5 - 6
Source/Extras/LuaScript/LuaScript.cpp

@@ -332,7 +332,7 @@ int LuaScript::Print(lua_State *L)
         lua_pop(L, 1);  /* pop result */
         lua_pop(L, 1);  /* pop result */
     }
     }
 
 
-    LOGRAW(String("Lua: ") + string); // fputs("\n", stdout);
+    LOGRAW("Lua: " + string); // fputs("\n", stdout);
 
 
     return 0;
     return 0;
 }
 }
@@ -348,7 +348,7 @@ bool LuaScript::FindFunction(const String& functionName)
     {
     {
         if (!lua_istable(luaState_, -1))
         if (!lua_istable(luaState_, -1))
         {
         {
-            LOGERROR("Can not find Lua table: " + String("Table name = '") + currentName + "'.");
+            LOGERROR("Could not find Lua table: Table name = '" + currentName + "'");
             return false;
             return false;
         }
         }
 
 
@@ -358,7 +358,7 @@ bool LuaScript::FindFunction(const String& functionName)
             lua_getfield(luaState_, -1, splitedNames[i].CString());
             lua_getfield(luaState_, -1, splitedNames[i].CString());
             if (!lua_istable(luaState_, -1))
             if (!lua_istable(luaState_, -1))
             {
             {
-                LOGERROR("Can not find Lua table: " + String("Table name = '") + currentName + "'.");
+                LOGERROR("Could not find Lua table: Table name = '" + currentName + "'");
                 return false;
                 return false;
             }
             }
         }
         }
@@ -369,7 +369,7 @@ bool LuaScript::FindFunction(const String& functionName)
 
 
     if (!lua_isfunction(luaState_, -1))
     if (!lua_isfunction(luaState_, -1))
     {
     {
-        LOGERROR("Can not find Lua function: " + String("Function name = '") + currentName + "'.");
+        LOGERROR("Could not find Lua function: Function name = '" + currentName + "'");
         return false;
         return false;
     }
     }
 
 
@@ -407,7 +407,7 @@ void LuaScript::CallEventHandler(int functionRef, StringHash eventType, VariantM
     lua_rawgeti(luaState_, LUA_REGISTRYINDEX, functionRef);
     lua_rawgeti(luaState_, LUA_REGISTRYINDEX, functionRef);
     if (!lua_isfunction(luaState_, -1))
     if (!lua_isfunction(luaState_, -1))
     {
     {
-        LOGERROR("Can not find funciton.");
+        LOGERROR("Could not find function");
         lua_settop(luaState_, top);
         lua_settop(luaState_, top);
         return;
         return;
     }
     }
@@ -424,7 +424,6 @@ void LuaScript::CallEventHandler(int functionRef, StringHash eventType, VariantM
     }
     }
 }
 }
 
 
-
 void RegisterLuaScriptLibrary(Context* context)
 void RegisterLuaScriptLibrary(Context* context)
 {
 {
     LuaFile::RegisterObject(context);
     LuaFile::RegisterObject(context);

+ 3 - 3
Source/Extras/LuaScript/LuaScriptInstance.cpp

@@ -70,7 +70,7 @@ bool LuaScriptInstance::CreateObject(const String& objectType)
     lua_getglobal(luaState_, "CreateScriptObjectInstance");
     lua_getglobal(luaState_, "CreateScriptObjectInstance");
     if (!lua_isfunction(luaState_, -1))
     if (!lua_isfunction(luaState_, -1))
     {
     {
-        LOGERROR("Can not find lua function CreateScriptObjectInstance.");
+        LOGERROR("Could not find lua function CreateScriptObjectInstance");
         lua_settop(luaState_, top);
         lua_settop(luaState_, top);
         return false;
         return false;
     }
     }
@@ -79,7 +79,7 @@ bool LuaScriptInstance::CreateObject(const String& objectType)
     lua_getglobal(luaState_, objectType.CString());
     lua_getglobal(luaState_, objectType.CString());
     if (!lua_istable(luaState_, -1))
     if (!lua_istable(luaState_, -1))
     {
     {
-        LOGERROR("Can not find lua table " + objectType + ".");
+        LOGERROR("Could not find lua table " + objectType);
         lua_settop(luaState_, top);
         lua_settop(luaState_, top);
         return false;
         return false;
     }
     }
@@ -290,7 +290,7 @@ void LuaScriptInstance::ReleaseObject()
     lua_getglobal(luaState_, "DestroyScriptObjectInstance");
     lua_getglobal(luaState_, "DestroyScriptObjectInstance");
     if (!lua_isfunction(luaState_, -1))
     if (!lua_isfunction(luaState_, -1))
     {
     {
-        LOGERROR("Can not find lua function DestroyScriptObjectInstance.");
+        LOGERROR("Could not find lua function DestroyScriptObjectInstance");
         lua_settop(luaState_, top);
         lua_settop(luaState_, top);
         return;
         return;
     }
     }

+ 0 - 1
Source/Extras/LuaScript/pkgs/LuaScript/LuaScript.pkg

@@ -55,5 +55,4 @@ static void UnsubscribeFromEvents(void* object)
 {
 {
     GetLuaScript()->ScriptUnsubscribeFromEvents(object);
     GetLuaScript()->ScriptUnsubscribeFromEvents(object);
 }
 }
-
 $}
 $}