Esempio n. 1
0
        public TMXOrthoObjectsTest()
        {
            CCTMXTiledMap map = CCTMXTiledMap.tiledMapWithTMXFile("TileMaps/ortho-objects");

            addChild(map, -1, 1);

            CCSize s = map.contentSize;
            ////----UXLOG("ContentSize: %f, %f", s.width,s.height);

            ////----UXLOG("----> Iterating over all the group objets");
            CCTMXObjectGroup group = map.objectGroupNamed("Object Group 1");
            List <Dictionary <string, string> > objects = group.Objects;

            Dictionary <string, string> dict;

            for (int i = 0; i < objects.Count; i++)
            {
                dict = objects[i];//dynamic_cast<CCStringToStringDictionary*>(*it);

                if (dict == null)
                {
                    break;
                }

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

            ////----UXLOG("----> Fetching 1 object by name");
            // CCStringToStringDictionary* platform = group->objectNamed("platform");
            ////----UXLOG("platform: %x", platform);
        }
Esempio n. 2
0
        public TMXIsoObjectsTest()
        {
            CCTMXTiledMap map = CCTMXTiledMap.tiledMapWithTMXFile("TileMaps/iso-test-objectgroup");

            addChild(map, -1, 1);

            CCSize s = map.contentSize;
            ////----UXLOG("ContentSize: %f, %f", s.width,s.height);

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

            //UxMutableArray* objects = group->objects();
            List <Dictionary <string, string> > objects = group.Objects;
            //UxMutableDictionary<std::string>* dict;
            Dictionary <string, string> dict;

            //CCMutableArray<CCObject*>::CCMutableArrayIterator it;
            for (int i = 0; i < objects.Count; i++)
            {
                dict = objects[i];

                if (dict == null)
                {
                    break;
                }
            }
        }
Esempio n. 3
0
        protected override void Draw()
        {
            var map = (CCTMXTiledMap)GetChildByTag(kTagTileMap);
            CCTMXObjectGroup group = map.ObjectGroupNamed("Object Layer 1");

            foreach (var dict in group.Objects)
            {
                int x      = int.Parse(dict["x"]);
                int y      = int.Parse(dict["y"]);
                int width  = dict.ContainsKey("width") ? int.Parse(dict["width"]) : 0;
                int height = dict.ContainsKey("height") ? int.Parse(dict["height"]) : 0;

                //glLineWidth(3);

                var color = new CCColor4B(255, 255, 0, 255);

                CCDrawingPrimitives.Begin();
                CCDrawingPrimitives.DrawLine(new CCPoint(x, y), new CCPoint(x + width, y), color);
                CCDrawingPrimitives.DrawLine(new CCPoint(x + width, y), new CCPoint(x + width, y + height), color);
                CCDrawingPrimitives.DrawLine(new CCPoint(x + width, y + height), new CCPoint(x, y + height), color);
                CCDrawingPrimitives.DrawLine(new CCPoint(x, y + height), new CCPoint(x, y), color);
                CCDrawingPrimitives.End();

                //glLineWidth(1);
            }
        }
Esempio n. 4
0
        public override void draw()
        {
            CCTMXTiledMap    map   = (CCTMXTiledMap)getChildByTag(1);
            CCTMXObjectGroup group = map.objectGroupNamed("Object Group 1");

            List <Dictionary <string, string> > objects = group.Objects;
            Dictionary <string, string>         dict;

            for (int i = 0; i < objects.Count; i++)
            {
                dict = objects[i];//dynamic_cast<CCStringToStringDictionary*>(*it);

                if (dict == null)
                {
                    break;
                }
                string key = "x";
                int    x   = int.Parse(dict[key]); //dynamic_cast<NSNumber*>(dict->objectForKey("x"))->getNumber();
                key = "y";
                int y = int.Parse(dict[key]);      //dynamic_cast<NSNumber*>(dict->objectForKey("y"))->getNumber();
                key = "width";
                int width = int.Parse(dict[key]);  //dynamic_cast<NSNumber*>(dict->objectForKey("width"))->getNumber();
                key = "height";
                int height = int.Parse(dict[key]); //dynamic_cast<NSNumber*>(dict->objectForKey("height"))->getNumber();


                //glLineWidth(3);

                ccColor4F color = new ccColor4F(255, 255, 255, 255);

                CCDrawingPrimitives.ccDrawLine(new CCPoint(x, y), new CCPoint(x + width, y), color);
                CCDrawingPrimitives.ccDrawLine(new CCPoint(x + width, y), new CCPoint(x + width, y + height), color);
                CCDrawingPrimitives.ccDrawLine(new CCPoint(x + width, y + height), new CCPoint(x, y + height), color);
                CCDrawingPrimitives.ccDrawLine(new CCPoint(x, y + height), new CCPoint(x, y), color);

                //glLineWidth(1);
            }
        }
        public virtual void draw()
        {
            CCTMXTiledMap    map   = (CCTMXTiledMap)getChildByTag(1);
            CCTMXObjectGroup group = map.objectGroupNamed("Object Layer 1");

            List <Dictionary <string, string> > array = group.Objects;

            Dictionary <string, string> dict = new Dictionary <string, string>();

            for (int i = 0; i < array.Count; i++)
            {
                dict = array[i];
                if (dict == null)
                {
                    break;
                }

                string key = "x";
                int    x   = ccUtils.ccParseInt(dict[key]);
                key = "y";
                int y = ccUtils.ccParseInt(dict[key]);
                key = "width";
                int width = ccUtils.ccParseInt(dict[key]);
                key = "height";
                int height = ccUtils.ccParseInt(dict[key]);

                //glLineWidth(3);

                //ccDrawLine(ccp(x, y), ccp(x + width, y));
                //ccDrawLine(ccp(x + width, y), ccp(x + width, y + height));
                //ccDrawLine(ccp(x + width,y + height), ccp(x,y + height));
                //ccDrawLine(ccp(x,y + height), ccp(x,y));

                //glLineWidth(1);
            }
        }