Example #1
0
        public static CCTMXTiledMap Create(string tmxFile)
        {
            var pRet = new CCTMXTiledMap(tmxFile);

            return(pRet);
        }
Example #2
0
        public TMXOrthoTest4()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test4");
            AddChild(map, 0, kTagTileMap);

            /*
            CCArray* pChildrenArray = map.getChildren();
            CCSpriteBatchNode* child = NULL;
            object* pObject = NULL;
            CCARRAY_FOREACH(pChildrenArray, pObject)
            {
                child = (CCSpriteBatchNode*) pObject;

                if (!child)
                    break;

                child.Texture.setAntiAliasTexParameters();
            }
            */

            map.AnchorPoint = (new CCPoint(0, 0));

            CCTMXLayer layer = map.LayerNamed("Layer 0");
            CCSize s = layer.LayerSize;

            CCSprite sprite;
            sprite = layer.TileAt(new CCPoint(0, 0));
            sprite.Scale = (2);
            sprite = layer.TileAt(new CCPoint(s.Width - 1, 0));
            sprite.Scale = (2);
            sprite = layer.TileAt(new CCPoint(0, s.Height - 1));
            sprite.Scale = (2);
            sprite = layer.TileAt(new CCPoint(s.Width - 1, s.Height - 1));
            sprite.Scale = (2);

            Schedule(removeSprite, 2);
        }
Example #3
0
        public TMXResizeTest()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test5");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;

            CCTMXLayer layer;
            layer = map.LayerNamed("Layer 0");

            CCSize ls = layer.LayerSize;
            for (uint y = 0; y < ls.Height; y++)
            {
                for (uint x = 0; x < ls.Width; x++)
                {
                    layer.SetTileGID(1, new CCPoint(x, y));
                }
            }
        }
Example #4
0
        public TMXOrthoZorder()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test-zorder");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;

            m_tamara = new CCSprite(s_pPathSister1);
            map.AddChild(m_tamara, map.Children.Count);
            m_tamara.AnchorPoint = (new CCPoint(0.5f, 0));


            CCMoveBy move = new CCMoveBy (10, new CCPoint(400, 450));
            CCFiniteTimeAction back = move.Reverse();
            CCSequence seq = new CCSequence(move, back);
            m_tamara.RunAction(new CCRepeatForever (seq));

            Schedule(repositionSprite);
        }
Example #5
0
        public TMXUncompressedTest()
        {
            CCLayerColor color = new CCLayerColor(new CCColor4B(64, 64, 64, 255));
            AddChild(color, -1);

            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/iso-test2-uncompressed");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;

            // move map to the center of the screen
            CCSize ms = map.MapSize;
            CCSize ts = map.TileSize;
            map.RunAction(new CCMoveTo (1.0f, new CCPoint(-ms.Width * ts.Width / 2, -ms.Height * ts.Height / 2)));

            /*
            // testing release map
            CCArray* pChildrenArray = map.getChildren();
            CCTMXLayer layer;
            object* pObject = NULL;
            CCARRAY_FOREACH(pChildrenArray, pObject)
            {
                layer = (CCTMXLayer) pObject;

                if (!layer)
                    break;

                layer.releaseMap();
            }
            */
        }
Example #6
0
        public TMXOrthoObjectsTest()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/ortho-objects");
            AddChild(map, -1, kTagTileMap);

            CCSize s = map.ContentSize;

            /*
            ////----UXLOG("---. Iterating over all the group objets");
            CCTMXObjectGroup group = map.objectGroupNamed("Object Group 1");
            CCArray objects = group.getObjects();

            CCDictionary* dict = NULL;
            object* pObj = NULL;
            CCARRAY_FOREACH(objects, pObj)
            {
                dict = (CCDictionary*) pObj; //dynamic_cast<CCStringToStringDictionary*>(*it);

                if (!dict)
                    break;

                ////----UXLOG("object: %x", dict);
            }
            */

            ////----UXLOG("---. Fetching 1 object by name");
            // CCStringToStringDictionary* platform = group.objectNamed("platform");
            ////----UXLOG("platform: %x", platform);
        }
Example #7
0
        public TMXOrthoTest()
        {
            //
            // Test orthogonal with 3d camera and anti-alias textures
            //
            // it should not flicker. No artifacts should appear
            //
            //CCLayerColor* color = new CCLayerColor( ccc4(64,64,64,255) );
            //addChild(color, -1);

            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test2");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;
            CCLog.Log("ContentSize: {0}, {1}", s.Width, s.Height);

            /*
            CCArray pChildrenArray = map.getChildren();
            CCSpriteBatchNode* child = NULL;
            object* pObject = NULL;
            CCARRAY_FOREACH(pChildrenArray, pObject)
            {
                child = (CCSpriteBatchNode*) pObject;

                if (!child)
                    break;

                child.Texture.setAntiAliasTexParameters();
            }
            */

            float x, y, z;
            map.Camera.GetEyeXyz(out x, out y, out z);
            map.Camera.SetEyeXyz(x - 200, y, z + 300);
        }
Example #8
0
        public TMXIsoTest1()
        {
            CCLayerColor color = new CCLayerColor(new CCColor4B(64, 64, 64, 255));
            AddChild(color, -1);

            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/iso-test11");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;

            map.AnchorPoint = (new CCPoint(0.5f, 0.5f));
        }
Example #9
0
 public TMXOrthoMoveLayer()
 {
     CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test-movelayer");
     AddChild(map, 0, kTagTileMap);
 }
Example #10
0
        public TMXTilePropertyTest()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/ortho-tile-property");
            AddChild(map, 0, kTagTileMap);

            for (uint i = 1; i <= 20; i++)
            {
                CCLog.Log("GID:%i, Properties:%p", i, map.PropertiesForGID(i));
            }
        }
Example #11
0
        public TMXIsoMoveLayer()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/iso-test-movelayer");
            AddChild(map, 0, kTagTileMap);

            map.Position = new CCPoint(-700, -50);
        }
Example #12
0
        public TMXOrthoVertexZ()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test-vertexz");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;

            // because I'm lazy, I'm reusing a tile as an sprite, but since this method uses vertexZ, you
            // can use any CCSprite and it will work OK.
            CCTMXLayer layer = map.LayerNamed("trees");
            m_tamara = layer.TileAt(new CCPoint(0, 11));
            CCLog.Log("tamara vertexZ: {0}", m_tamara.VertexZ);

            CCMoveBy move = new CCMoveBy (10, new CCPoint(400, 450) * (1f / CCMacros.CCContentScaleFactor()));
            CCFiniteTimeAction back = move.Reverse();
            CCSequence seq = new CCSequence(move, back);
            m_tamara.RunAction(new CCRepeatForever (seq));

            Schedule(repositionSprite);
        }
Example #13
0
 /// <summary>
 /// creates a TMX Tiled Map with a TMX file.
 /// </summary>
 public static CCTMXTiledMap Create(string tmxFile)
 {
     var pRet = new CCTMXTiledMap();
     pRet.InitWithTmxFile(tmxFile);
     return pRet;
 }
Example #14
0
        public TMXReadWriteTest()
        {
            m_gid = 0;

            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test2");
            AddChild(map, 0, kTagTileMap);

            CCTMXLayer layer = map.LayerNamed("Layer 0");
			layer.IsAntialiased = true;

            map.Scale = (1);

            CCSprite tile0 = layer.TileAt(new CCPoint(1, 63));
            CCSprite tile1 = layer.TileAt(new CCPoint(2, 63));
            CCSprite tile2 = layer.TileAt(new CCPoint(3, 62)); //new CCPoint(1,62));
            CCSprite tile3 = layer.TileAt(new CCPoint(2, 62));
            tile0.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile1.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile2.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile3.AnchorPoint = (new CCPoint(0.5f, 0.5f));

            CCMoveBy move = new CCMoveBy (0.5f, new CCPoint(0, 160));
            CCRotateBy rotate = new CCRotateBy (2, 360);
            CCScaleBy scale = new CCScaleBy(2, 5);
            CCFadeOut opacity = new CCFadeOut  (2);
            CCFadeIn fadein = new CCFadeIn  (2);
            CCScaleTo scaleback = new CCScaleTo(1, 1);
            CCCallFuncN finish = new CCCallFuncN(removeSprite);
            CCSequence seq0 = new CCSequence(move, rotate, scale, opacity, fadein, scaleback, finish);
            var seq1 = (CCActionInterval) (seq0.Copy());
            var seq2 = (CCActionInterval) (seq0.Copy());
            var seq3 = (CCActionInterval) (seq0.Copy());

            tile0.RunAction(seq0);
            tile1.RunAction(seq1);
            tile2.RunAction(seq2);
            tile3.RunAction(seq3);


            m_gid = layer.TileGIDAt(new CCPoint(0, 63));
            ////----UXLOG("Tile GID at:(0,63) is: %d", m_gid);

            Schedule(updateCol, 2.0f);
            Schedule(repaintWithGID, 2.0f);
            Schedule(removeTiles, 1.0f);

            ////----UXLOG("++++atlas quantity: %d", layer.textureAtlas().getTotalQuads());
            ////----UXLOG("++++children: %d", layer.getChildren().count() );

            m_gid2 = 0;
        }
Example #15
0
        public TMXOrthoFlipRunTimeTest()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/ortho-rotation-test");
            AddChild(map, 0, kTagTileMap);

            /*
            object* pObj = NULL;
            CCARRAY_FOREACH(map.getChildren(), pObj)
            {
                CCSpriteBatchNode* child = (CCSpriteBatchNode*) pObj;
                child.Texture.setAntiAliasTexParameters();
            }
            */

            CCScaleBy action = new CCScaleBy(2, 0.5f);
            map.RunAction(action);

            Schedule(flipIt, 1.0f);
        }
Example #16
0
        public TMXHexTest()
        {
            CCLayerColor color = new CCLayerColor(new CCColor4B(64, 64, 64, 255));
            AddChild(color, -1);

            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/hexa-test1");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;
        }
Example #17
0
        public TMXOrthoFromXMLTest()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test1");
            AddChild(map, 0, kTagTileMap);

            /*
            object* pObj = NULL;
            CCARRAY_FOREACH(map.getChildren(), pObj)
            {
                CCSpriteBatchNode* child = (CCSpriteBatchNode*) pObj;
                child.Texture.setAntiAliasTexParameters();
            }
            */

            CCScaleBy action = new CCScaleBy(2, 0.5f);
            map.RunAction(action);
        }
Example #18
0
        public TMXIsoTest2()
        {
            CCLayerColor color = new CCLayerColor(new CCColor4B(64, 64, 64, 255));
            AddChild(color, -1);

            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/iso-test22");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;

            // move map to the center of the screen
            CCSize ms = map.MapSize;
            CCSize ts = map.TileSize;
            map.RunAction(new CCMoveTo (1.0f, new CCPoint(-ms.Width * ts.Width / 2, -ms.Height * ts.Height / 2)));
        }
Example #19
0
        public TMXBug987()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test6");
            AddChild(map, 0, kTagTileMap);

            /*
            CCArray* childs = map.getChildren();
            CCTMXLayer* node;
            object* pObject = NULL;
            CCARRAY_FOREACH(childs, pObject)
            {
                node = (CCTMXLayer*) pObject;
                CC_BREAK_IF(!node);
                node.Texture.setAntiAliasTexParameters();
            }
            */

            map.AnchorPoint = (new CCPoint(0, 0));
            CCTMXLayer layer = map.LayerNamed("Tile Layer 1");
            layer.SetTileGID(3, new CCPoint(2, 2));
        }
Example #20
0
        public TMXTilesetTest()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test5");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;

            CCTMXLayer layer;
            layer = map.LayerNamed("Layer 0");
			layer.IsAntialiased = true;

            layer = map.LayerNamed("Layer 1");
			layer.IsAntialiased = true;

            layer = map.LayerNamed("Layer 2");
			layer.IsAntialiased = true;
        }
Example #21
0
        public TMXBug787()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/iso-test-bug787");
            AddChild(map, 0, kTagTileMap);

            map.Scale = (0.25f);
        }
Example #22
0
        public TMXIsoObjectsTest()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/iso-test-objectgroup");
            AddChild(map, -1, kTagTileMap);

            CCSize s = map.ContentSize;

            /*
            CCTMXObjectGroup group = map.objectGroupNamed("Object Group 1");

            //UxMutableArray* objects = group.objects();
            CCArray* objects = group.getObjects();
            //UxMutableDictionary<string>* dict;
            CCDictionary* dict;
            object* pObj = NULL;
            CCARRAY_FOREACH(objects, pObj)
            {
                dict = (CCDictionary*) pObj;

                if (!dict)
                    break;

                ////----UXLOG("object: %x", dict);
            }
            */
        }
Example #23
0
 public TMXGIDObjectsTest()
 {
     CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/test-object-layer");
     AddChild(map, -1, kTagTileMap);
 }
Example #24
0
        public TMXIsoZorder()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/iso-test-zorder");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;
            CCLog.Log("ContentSize: {0}, {1}", s.Width, s.Height);
            map.Position = new CCPoint(-s.Width / 2, 0);

            m_tamara = new CCSprite(s_pPathSister1);
            map.AddChild(m_tamara, map.Children.Count);
            float mapWidth = map.MapSize.Width * map.TileSize.Width;
            m_tamara.Position = new CCPoint(mapWidth / 2, 0).PixelsToPoints();
            m_tamara.AnchorPoint = (new CCPoint(0.5f, 0));


            CCMoveBy move = new CCMoveBy (10, new CCPoint(300, 250));
            CCFiniteTimeAction back = move.Reverse();
            CCSequence seq = new CCSequence(move, back);
            m_tamara.RunAction(new CCRepeatForever (seq));

            Schedule(repositionSprite);
        }
Example #25
0
        public TMXOrthoTest3()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/orthogonal-test3");
            AddChild(map, 0, kTagTileMap);

            /*
            CCArray* pChildrenArray = map.getChildren();
            CCSpriteBatchNode* child = NULL;
            object* pObject = NULL;
            CCARRAY_FOREACH(pChildrenArray, pObject)
            {
                child = (CCSpriteBatchNode*) pObject;

                if (!child)
                    break;

                child.Texture.setAntiAliasTexParameters();
            }
            */

            map.Scale = 0.2f;
            map.AnchorPoint = (new CCPoint(0.5f, 0.5f));
        }
Example #26
0
        public TMXIsoVertexZ()
        {
            CCTMXTiledMap map = new CCTMXTiledMap("TileMaps/iso-test-vertexz");
            AddChild(map, 0, kTagTileMap);

            CCSize s = map.ContentSize;
            map.Position = new CCPoint(-s.Width / 2, 0);

            // because I'm lazy, I'm reusing a tile as an sprite, but since this method uses vertexZ, you
            // can use any CCSprite and it will work OK.
            CCTMXLayer layer = map.LayerNamed("Trees");
            m_tamara = layer.TileAt(new CCPoint(29, 29));

            CCMoveBy move = new CCMoveBy (10, new CCPoint(300, 250) * (1f / CCMacros.CCContentScaleFactor()));
            CCFiniteTimeAction back = move.Reverse();
            CCSequence seq = new CCSequence(move, back);
            m_tamara.RunAction(new CCRepeatForever (seq));

            Schedule(repositionSprite);
        }
Example #27
0
 public static CCTMXTiledMap Create(string tmxFile)
 {
     var pRet = new CCTMXTiledMap(tmxFile);
     return pRet;
 }