Browse Source

Fix warning.

Aster@中国上海 11 years ago
parent
commit
b25b44abe7

+ 6 - 6
Source/Engine/Input/Input.cpp

@@ -577,19 +577,19 @@ bool Input::RecordGesture()
         return false;
         return false;
     }
     }
 
 
-    return SDL_RecordGesture(-1);
+    return SDL_RecordGesture(-1) != 0;
 }
 }
 
 
 bool Input::SaveGestures(Serializer& dest)
 bool Input::SaveGestures(Serializer& dest)
 {
 {
     RWOpsWrapper<Serializer> wrapper(dest);
     RWOpsWrapper<Serializer> wrapper(dest);
-    return SDL_SaveAllDollarTemplates(wrapper.GetRWOps());
+    return SDL_SaveAllDollarTemplates(wrapper.GetRWOps()) != 0;
 }
 }
 
 
 bool Input::SaveGesture(Serializer& dest, unsigned gestureID)
 bool Input::SaveGesture(Serializer& dest, unsigned gestureID)
 {
 {
     RWOpsWrapper<Serializer> wrapper(dest);
     RWOpsWrapper<Serializer> wrapper(dest);
-    return SDL_SaveDollarTemplate(gestureID, wrapper.GetRWOps());
+    return SDL_SaveDollarTemplate(gestureID, wrapper.GetRWOps()) != 0;
 }
 }
 
 
 unsigned Input::LoadGestures(Deserializer& source)
 unsigned Input::LoadGestures(Deserializer& source)
@@ -607,7 +607,7 @@ unsigned Input::LoadGestures(Deserializer& source)
 
 
 bool Input::RemoveGesture(unsigned gestureID)
 bool Input::RemoveGesture(unsigned gestureID)
 {
 {
-    return SDL_RemoveDollarTemplate(gestureID);
+    return SDL_RemoveDollarTemplate(gestureID) != 0;
 }
 }
 
 
 void Input::RemoveAllGestures()
 void Input::RemoveAllGestures()
@@ -798,7 +798,7 @@ bool Input::IsScreenJoystickVisible(SDL_JoystickID id) const
 
 
 bool Input::GetScreenKeyboardSupport() const
 bool Input::GetScreenKeyboardSupport() const
 {
 {
-    return graphics_ ? SDL_HasScreenKeyboardSupport() : false;
+    return graphics_ ? SDL_HasScreenKeyboardSupport() != 0 : false;
 }
 }
 
 
 bool Input::IsScreenKeyboardVisible() const
 bool Input::IsScreenKeyboardVisible() const
@@ -806,7 +806,7 @@ bool Input::IsScreenKeyboardVisible() const
     if (graphics_)
     if (graphics_)
     {
     {
         SDL_Window* window = graphics_->GetImpl()->GetWindow();
         SDL_Window* window = graphics_->GetImpl()->GetWindow();
-        return SDL_IsScreenKeyboardShown(window);
+        return SDL_IsScreenKeyboardShown(window) != SDL_FALSE;
     }
     }
     else
     else
         return false;
         return false;

+ 3 - 2
Source/Engine/Urho2D/AnimatedSprite2D.cpp

@@ -25,6 +25,7 @@
 #include "Animation2D.h"
 #include "Animation2D.h"
 #include "AnimationSet2D.h"
 #include "AnimationSet2D.h"
 #include "Context.h"
 #include "Context.h"
+#include "Drawable2D.h"
 #include "ResourceCache.h"
 #include "ResourceCache.h"
 #include "Scene.h"
 #include "Scene.h"
 #include "SceneEvents.h"
 #include "SceneEvents.h"
@@ -68,7 +69,7 @@ void AnimatedSprite2D::RegisterObject(Context* context)
     ACCESSOR_ATTRIBUTE(AnimatedSprite2D, VAR_FLOAT, "Speed", GetSpeed, SetSpeed, float, 1.0f, AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(AnimatedSprite2D, VAR_FLOAT, "Speed", GetSpeed, SetSpeed, float, 1.0f, AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(AnimatedSprite2D, VAR_RESOURCEREF, "Animation Set", GetAnimationSetAttr, SetAnimationSetAttr, ResourceRef, ResourceRef(AnimatedSprite2D::GetTypeStatic()), AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(AnimatedSprite2D, VAR_RESOURCEREF, "Animation Set", GetAnimationSetAttr, SetAnimationSetAttr, ResourceRef, ResourceRef(AnimatedSprite2D::GetTypeStatic()), AM_DEFAULT);
     REF_ACCESSOR_ATTRIBUTE(AnimatedSprite2D, VAR_STRING, "Animation", GetAnimation, SetAnimation, String, String::EMPTY, AM_DEFAULT);
     REF_ACCESSOR_ATTRIBUTE(AnimatedSprite2D, VAR_STRING, "Animation", GetAnimation, SetAnimation, String, String::EMPTY, AM_DEFAULT);
-    COPY_BASE_ATTRIBUTES(Drawable2D, Drawable);
+    COPY_BASE_ATTRIBUTES(AnimatedSprite2D, Drawable);
 }
 }
 
 
 void AnimatedSprite2D::OnSetEnabled()
 void AnimatedSprite2D::OnSetEnabled()
@@ -395,7 +396,7 @@ void AnimatedSprite2D::UpdateAnimation(float timeStep)
 
 
             // Update node's transform
             // Update node's transform
             const Transform2D& transform = timelineTransformInfos_[i].transform_;
             const Transform2D& transform = timelineTransformInfos_[i].transform_;
-            Vector2 position = transform.position_;
+            Vector2 position = transform.position_ * PIXEL_SIZE;
             if (flipX_)
             if (flipX_)
                 position.x_ = -position.x_;
                 position.x_ = -position.x_;
             if (flipY_)
             if (flipY_)

+ 6 - 7
Source/Engine/Urho2D/AnimationSet2D.cpp

@@ -24,7 +24,6 @@
 #include "Animation2D.h"
 #include "Animation2D.h"
 #include "AnimationSet2D.h"
 #include "AnimationSet2D.h"
 #include "Context.h"
 #include "Context.h"
-#include "Drawable2D.h"
 #include "FileSystem.h"
 #include "FileSystem.h"
 #include "Log.h"
 #include "Log.h"
 #include "ResourceCache.h"
 #include "ResourceCache.h"
@@ -151,12 +150,12 @@ bool AnimationSet2D::LoadFolders(const XMLElement& rootElem)
                 int width = fileElem.GetInt("width");
                 int width = fileElem.GetInt("width");
                 int height = fileElem.GetInt("height");
                 int height = fileElem.GetInt("height");
 
 
-                int pivotX = width * hotSpot.x_;
-                int pivotY = height * (1.0f - hotSpot.y_);
+                float pivotX = width * hotSpot.x_;
+                float pivotY = height * (1.0f - hotSpot.y_);
 
 
                 const IntRect& rectangle = sprite->GetRectangle();
                 const IntRect& rectangle = sprite->GetRectangle();
-                hotSpot.x_ = ((float)offset.x_ + pivotX) / rectangle.Width();
-                hotSpot.y_ = 1.0f - ((float)offset.y_ + pivotY) / rectangle.Height();
+                hotSpot.x_ = (offset.x_ + pivotX) / rectangle.Width();
+                hotSpot.y_ = 1.0f - (offset.y_ + pivotY) / rectangle.Height();
             }
             }
 
 
             sprite->SetHotSpot(hotSpot);
             sprite->SetHotSpot(hotSpot);
@@ -213,8 +212,8 @@ bool AnimationSet2D::LoadAnimation(const XMLElement& animationElem)
             XMLElement childElem = keyElem.GetChild();
             XMLElement childElem = keyElem.GetChild();
 
 
             Vector2 position;
             Vector2 position;
-            position.x_ = childElem.GetFloat("x") * PIXEL_SIZE;
-            position.y_ = childElem.GetFloat("y") * PIXEL_SIZE;
+            position.x_ = childElem.GetFloat("x");
+            position.y_ = childElem.GetFloat("y");
 
 
             float angle = childElem.GetFloat("angle");
             float angle = childElem.GetFloat("angle");