ソースを参照

Rename TileObject2D to TileMapObject2D, rename some functions.

aster 11 年 前
コミット
649edf054d

+ 4 - 4
Source/Engine/LuaScript/pkgs/Urho2D/TileMap2D.pkg

@@ -7,8 +7,8 @@ class TileMap2D : Component
     const TileMapInfo2D& GetInfo() const;
     unsigned GetNumLayers() const;
     TileMapLayer2D* GetLayer(unsigned index) const;
-    Vector2 IndexToPosition(int x, int y) const;
-    tolua_outside bool TileMap2DPositionToIndex @ PositionToIndex(const Vector2& position, int* x = 0, int* y = 0) const;
+    Vector2 TileIndexToPosition(int x, int y) const;
+    tolua_outside bool TileMap2DPositionToTileIndex @ PositionToTileIndex(const Vector2& position, int* x = 0, int* y = 0) const;
 
     tolua_property__get_set TmxFile2D* tmxFile;
     tolua_readonly tolua_property__get_set TileMapInfo2D& info;
@@ -16,8 +16,8 @@ class TileMap2D : Component
 };
 
 ${
-static bool TileMap2DPositionToIndex(const TileMap2D* tileMap, const Vector2& position, int* x, int* y)
+static bool TileMap2DPositionToTileIndex(const TileMap2D* tileMap, const Vector2& position, int* x, int* y)
 {
-    return tileMap->PositionToIndex(*x, *y, position);
+    return tileMap->PositionToTileIndex(*x, *y, position);
 }
 $}

+ 4 - 4
Source/Engine/LuaScript/pkgs/Urho2D/TileMapDefs2D.pkg

@@ -29,7 +29,7 @@ enum TileMapLayerType2D
     LT_INVALID
 };
 
-enum TileObjectType2D
+enum TileMapObjectType2D
 {
     OT_RECTANGLE,
     OT_ELLIPSE,
@@ -56,9 +56,9 @@ class Tile2D
     tolua_readonly tolua_property__get_set Sprite2D* sprite;
 };
 
-class TileObject2D
+class TileMapObject2D
 {
-    TileObjectType2D GetObjectType() const;
+    TileMapObjectType2D GetObjectType() const;
     const String GetName() const;
     const String GetType() const;
     const Vector2& GetPosition() const;
@@ -70,7 +70,7 @@ class TileObject2D
     bool HasProperty(const String& name) const;
     const String& GetProperty(const String& name) const;
 
-    tolua_readonly tolua_property__get_set TileObjectType2D objectType;
+    tolua_readonly tolua_property__get_set TileMapObjectType2D objectType;
     tolua_readonly tolua_property__get_set String name;
     tolua_readonly tolua_property__get_set String type;
     tolua_readonly tolua_property__get_set Vector2 position;

+ 1 - 1
Source/Engine/LuaScript/pkgs/Urho2D/TileMapLayer2D.pkg

@@ -17,7 +17,7 @@ class TileMapLayer2D : Component
     Tile2D* GetTile(int x, int y) const;
     
     unsigned GetNumObjects() const;
-    TileObject2D* GetObject(unsigned index) const;
+    TileMapObject2D* GetObject(unsigned index) const;
     Node* GetObjectNode(unsigned index) const;
 
     Node* GetImageNode() const;

+ 14 - 14
Source/Engine/Script/Urho2DAPI.cpp

@@ -242,18 +242,18 @@ static void RegisterTileMapDefs2D(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Tile2D", "bool HasProperty(const String&in) const", asMETHOD(Tile2D, HasProperty), asCALL_THISCALL);
     engine->RegisterObjectMethod("Tile2D", "const String& GetProperty(const String&in) const", asMETHOD(Tile2D, HasProperty), asCALL_THISCALL);
 
-    RegisterRefCounted<TileObject2D>(engine, "TileObject2D");
-    engine->RegisterObjectMethod("TileObject2D", "TileObjectType2D get_objectType() const", asMETHOD(TileObject2D, GetObjectType), asCALL_THISCALL);
-    engine->RegisterObjectMethod("TileObject2D", "const String& get_name() const", asMETHOD(TileObject2D, GetName), asCALL_THISCALL);
-    engine->RegisterObjectMethod("TileObject2D", "const String& get_type() const", asMETHOD(TileObject2D, GetType), asCALL_THISCALL);
-    engine->RegisterObjectMethod("TileObject2D", "const Vector2& get_position() const", asMETHOD(TileObject2D, GetPosition), asCALL_THISCALL);
-    engine->RegisterObjectMethod("TileObject2D", "const Vector2& get_size() const", asMETHOD(TileObject2D, GetSize), asCALL_THISCALL);
-    engine->RegisterObjectMethod("TileObject2D", "uint get_numPoints() const", asMETHOD(TileObject2D, GetNumPoints), asCALL_THISCALL);
-    engine->RegisterObjectMethod("TileObject2D", "const Vector2& GetPoint(uint) const", asMETHOD(TileObject2D, GetPoint), asCALL_THISCALL);
-    engine->RegisterObjectMethod("TileObject2D", "int get_tileGid() const", asMETHOD(TileObject2D, GetTileGid), asCALL_THISCALL);
-    engine->RegisterObjectMethod("TileObject2D", "Sprite2D@ get_tileSprite() const", asMETHOD(TileObject2D, GetTileSprite), asCALL_THISCALL);
-    engine->RegisterObjectMethod("TileObject2D", "bool HasProperty(const String&in) const", asMETHOD(TileObject2D, HasProperty), asCALL_THISCALL);
-    engine->RegisterObjectMethod("TileObject2D", "const String& GetProperty(const String&in) const", asMETHOD(TileObject2D, HasProperty), asCALL_THISCALL);
+    RegisterRefCounted<TileMapObject2D>(engine, "TileMapObject2D");
+    engine->RegisterObjectMethod("TileMapObject2D", "TileObjectType2D get_objectType() const", asMETHOD(TileMapObject2D, GetObjectType), asCALL_THISCALL);
+    engine->RegisterObjectMethod("TileMapObject2D", "const String& get_name() const", asMETHOD(TileMapObject2D, GetName), asCALL_THISCALL);
+    engine->RegisterObjectMethod("TileMapObject2D", "const String& get_type() const", asMETHOD(TileMapObject2D, GetType), asCALL_THISCALL);
+    engine->RegisterObjectMethod("TileMapObject2D", "const Vector2& get_position() const", asMETHOD(TileMapObject2D, GetPosition), asCALL_THISCALL);
+    engine->RegisterObjectMethod("TileMapObject2D", "const Vector2& get_size() const", asMETHOD(TileMapObject2D, GetSize), asCALL_THISCALL);
+    engine->RegisterObjectMethod("TileMapObject2D", "uint get_numPoints() const", asMETHOD(TileMapObject2D, GetNumPoints), asCALL_THISCALL);
+    engine->RegisterObjectMethod("TileMapObject2D", "const Vector2& GetPoint(uint) const", asMETHOD(TileMapObject2D, GetPoint), asCALL_THISCALL);
+    engine->RegisterObjectMethod("TileMapObject2D", "int get_tileGid() const", asMETHOD(TileMapObject2D, GetTileGid), asCALL_THISCALL);
+    engine->RegisterObjectMethod("TileMapObject2D", "Sprite2D@ get_tileSprite() const", asMETHOD(TileMapObject2D, GetTileSprite), asCALL_THISCALL);
+    engine->RegisterObjectMethod("TileMapObject2D", "bool HasProperty(const String&in) const", asMETHOD(TileMapObject2D, HasProperty), asCALL_THISCALL);
+    engine->RegisterObjectMethod("TileMapObject2D", "const String& GetProperty(const String&in) const", asMETHOD(TileMapObject2D, HasProperty), asCALL_THISCALL);
 }
 
 static void RegisterTmxFile2D(asIScriptEngine* engine)
@@ -295,8 +295,8 @@ static void RegisterTileMap2D(asIScriptEngine* engine)
     engine->RegisterObjectMethod("TileMap2D", "TileMapInfo2D@ get_info() const", asMETHOD(TileMap2D, GetInfo), asCALL_THISCALL);
     engine->RegisterObjectMethod("TileMap2D", "uint get_numLayers() const", asMETHOD(TileMap2D, GetNumLayers), asCALL_THISCALL);
     engine->RegisterObjectMethod("TileMap2D", "TileMapLayer2D@ GetLayer(uint) const", asMETHOD(TileMap2D, GetLayer), asCALL_THISCALL);
-    engine->RegisterObjectMethod("TileMap2D", "Vector2 IndexToPosition(int, int) const", asMETHOD(TileMap2D, IndexToPosition), asCALL_THISCALL);
-    engine->RegisterObjectMethod("TileMap2D", "bool PositionToIndex(int&out x, int &out y, const Vector2&in) const", asMETHOD(TileMap2D, PositionToIndex), asCALL_THISCALL);
+    engine->RegisterObjectMethod("TileMap2D", "Vector2 TileIndexToPosition(int, int) const", asMETHOD(TileMap2D, TileIndexToPosition), asCALL_THISCALL);
+    engine->RegisterObjectMethod("TileMap2D", "bool PositionToTileIndex(int&out x, int &out y, const Vector2&in) const", asMETHOD(TileMap2D, PositionToTileIndex), asCALL_THISCALL);
 }
 
 static void RegisterRigidBody2D(asIScriptEngine* engine)

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

@@ -139,17 +139,16 @@ TileMapLayer2D* TileMap2D::GetLayer(unsigned index) const
     return layers_[index];
 }
 
-Vector2 TileMap2D::IndexToPosition(int x, int y) const
+Vector2 TileMap2D::TileIndexToPosition(int x, int y) const
 {
     return info_.TileIndexToPosition(x, y);
 }
 
-bool TileMap2D::PositionToIndex(int& x, int& y, const Vector2& position) const
+bool TileMap2D::PositionToTileIndex(int& x, int& y, const Vector2& position) const
 {
     return info_.PositionToTileIndex(x, y, position);
 }
 
-
 void TileMap2D::SetTmxFileAttr(ResourceRef value)
 {
     ResourceCache* cache = GetSubsystem<ResourceCache>();

+ 4 - 4
Source/Engine/Urho2D/TileMap2D.h

@@ -60,10 +60,10 @@ public:
     unsigned GetNumLayers() const { return layers_.Size(); }
     /// Return tile map layer at index.
     TileMapLayer2D* GetLayer(unsigned index) const;
-    /// Convert index to position.
-    Vector2 IndexToPosition(int x, int y) const;
-    /// Convert position to index, if out of map return false.
-    bool PositionToIndex(int& x, int& y, const Vector2& position) const;
+    /// Convert tile index to position.
+    Vector2 TileIndexToPosition(int x, int y) const;
+    /// Convert position to tile index, if out of map return false.
+    bool PositionToTileIndex(int& x, int& y, const Vector2& position) const;
 
     /// Set tile map file attribute.
     void SetTmxFileAttr(ResourceRef value);

+ 7 - 7
Source/Engine/Urho2D/TileMapDefs2D.cpp

@@ -4,7 +4,7 @@
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to deal
 // in the Software without restriction, including without limitation the rights
-// to use, copy, mox_sub_yy, merge, publish, distribute, sublicense, and/or sell
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 // copies of the Software, and to permit persons to whom the Software is
 // furnished to do so, subject to the following conditions:
 //
@@ -130,16 +130,16 @@ const String& Tile2D::GetProperty(const String& name) const
     return propertySet_->GetProperty(name);
 }
 
-TileObject2D::TileObject2D()
+TileMapObject2D::TileMapObject2D()
 {
 }
 
-unsigned TileObject2D::GetNumPoints() const
+unsigned TileMapObject2D::GetNumPoints() const
 {
     return points_.Size();
 }
 
-const Vector2& TileObject2D::GetPoint(unsigned index) const
+const Vector2& TileMapObject2D::GetPoint(unsigned index) const
 {
     if (index >= points_.Size())
         return Vector2::ZERO;
@@ -147,19 +147,19 @@ const Vector2& TileObject2D::GetPoint(unsigned index) const
     return points_[index];
 }
 
-Sprite2D* TileObject2D::GetTileSprite() const
+Sprite2D* TileMapObject2D::GetTileSprite() const
 {
     return sprite_;
 }
 
-bool TileObject2D::HasProperty(const String& name) const
+bool TileMapObject2D::HasProperty(const String& name) const
 {
     if (!propertySet_)
         return false;
     return propertySet_->HasProperty(name);
 }
 
-const String& TileObject2D::GetProperty(const String& name) const
+const String& TileMapObject2D::GetProperty(const String& name) const
 {
     if (!propertySet_)
         return String::EMPTY;

+ 6 - 6
Source/Engine/Urho2D/TileMapDefs2D.h

@@ -78,8 +78,8 @@ enum TileMapLayerType2D
     LT_INVALID = 0xffff
 };
 
-/// Tile object type.
-enum TileObjectType2D
+/// Tile map object type.
+enum TileMapObjectType2D
 {
     /// Rectangle.
     OT_RECTANGLE = 0,
@@ -142,13 +142,13 @@ private:
 };
 
 /// Tile map object.
-class URHO3D_API TileObject2D : public RefCounted
+class URHO3D_API TileMapObject2D : public RefCounted
 {
 public:
-    TileObject2D();
+    TileMapObject2D();
 
     /// Return type.
-    TileObjectType2D GetObjectType() const { return objectType_; }
+    TileMapObjectType2D GetObjectType() const { return objectType_; }
     /// Return name.
     const String& GetName() const { return name_; }
     /// Return type.
@@ -174,7 +174,7 @@ private:
     friend class TmxObjectGroup2D;
 
     /// Object type.
-    TileObjectType2D objectType_;
+    TileMapObjectType2D objectType_;
     /// Name.
     String name_;
     /// Type.

+ 3 - 3
Source/Engine/Urho2D/TileMapLayer2D.cpp

@@ -61,7 +61,7 @@ void TileMapLayer2D::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
     {
         for (unsigned i = 0; i < objectGroup_->GetNumObjects(); ++i)
         {
-            TileObject2D* object = objectGroup_->GetObject(i);
+            TileMapObject2D* object = objectGroup_->GetObject(i);
             const Color& color = Color::YELLOW;
 
             switch (object->GetObjectType())
@@ -250,7 +250,7 @@ unsigned TileMapLayer2D::GetNumObjects() const
     return objectGroup_->GetNumObjects();
 }
 
-TileObject2D* TileMapLayer2D::GetObject(unsigned index) const
+TileMapObject2D* TileMapLayer2D::GetObject(unsigned index) const
 {
     if (!objectGroup_)
         return 0;
@@ -320,7 +320,7 @@ void TileMapLayer2D::SetObjectGroup(const TmxObjectGroup2D* objectGroup)
 
     for (unsigned i = 0; i < objectGroup->GetNumObjects(); ++i)
     {
-        const TileObject2D* object = objectGroup->GetObject(i);
+        const TileMapObject2D* object = objectGroup->GetObject(i);
 
         // Create dummy node for all object
         SharedPtr<Node> objectNode(GetNode()->CreateChild("Object"));

+ 3 - 3
Source/Engine/Urho2D/TileMapLayer2D.h

@@ -83,10 +83,10 @@ public:
     /// Return tile (for tile layer only).
     Tile2D* GetTile(int x, int y) const;
 
-    /// Return number of objects (for object group only).
+    /// Return number of tile map objects (for object group only).
     unsigned GetNumObjects() const;
-    /// Return object (for object group only).
-    TileObject2D* GetObject(unsigned index) const;
+    /// Return tile map object (for object group only).
+    TileMapObject2D* GetObject(unsigned index) const;
     /// Return object node (for object group only).
     Node* GetObjectNode(unsigned index) const;
 

+ 3 - 3
Source/Engine/Urho2D/TmxFile2D.cpp

@@ -155,7 +155,7 @@ bool TmxObjectGroup2D::Load(const XMLElement& element, const TileMapInfo2D& info
 
     for (XMLElement objectElem = element.GetChild("object"); objectElem; objectElem = objectElem.GetNext("object"))
     {
-        SharedPtr<TileObject2D> object(new TileObject2D());
+        SharedPtr<TileMapObject2D> object(new TileMapObject2D());
 
         if (objectElem.HasAttribute("name"))
             object->name_ = objectElem.GetAttribute("name");
@@ -219,7 +219,7 @@ bool TmxObjectGroup2D::Load(const XMLElement& element, const TileMapInfo2D& info
     return true;
 }
 
-TileObject2D* TmxObjectGroup2D::GetObject(unsigned index) const
+TileMapObject2D* TmxObjectGroup2D::GetObject(unsigned index) const
 {
     if (index >= objects_.Size())
         return 0;
@@ -360,7 +360,7 @@ bool TmxFile2D::EndLoad()
         info_.orientation_ = O_ISOMETRIC;
     else
     {
-        LOGERROR("Invalid orientation type " + orientation);
+        LOGERROR("Unsupported orientation type " + orientation);
         return false;
     }
 

+ 3 - 3
Source/Engine/Urho2D/TmxFile2D.h

@@ -107,12 +107,12 @@ public:
     bool Load(const XMLElement& element, const TileMapInfo2D& info);
     /// Return number of objects.
     unsigned GetNumObjects() const { return objects_.Size(); }
-    /// Return object at index.
-    TileObject2D* GetObject(unsigned index) const;
+    /// Return tile map object at index.
+    TileMapObject2D* GetObject(unsigned index) const;
 
 private:
     /// Objects.
-    Vector<SharedPtr<TileObject2D> > objects_;
+    Vector<SharedPtr<TileMapObject2D> > objects_;
 };
 
 /// Tmx image layer.