예제 #1
0
        public AtlasScene()
            : base()
        {
            SPTextureAtlas  atlas = new SPTextureAtlas ("atlas.xml");
            Console.WriteLine("found {0} textures.", atlas.Count);

            SPImage  image1 = new SPImage (atlas.TextureByName ("walk_00"));
            image1.X = 30;
            image1.Y = 30;
            AddChild (image1);

            SPImage  image2 = new SPImage (atlas.TextureByName ("walk_01"));
            image2.X = 90;
            image2.Y = 110;
            AddChild (image2);

            SPImage  image3 = new SPImage (atlas.TextureByName ("walk_03"));
            image3.X = 150;
            image3.Y = 190;
            AddChild (image3);

            SPImage  image4 = new SPImage (atlas.TextureByName ("walk_05"));
            image4.X = 210;
            image4.Y = 270;
            AddChild (image4);
        }
예제 #2
0
        public static SPImage ParseImage(Dictionary <string, object> json)
        {
            var retval = new SPImage();

            retval.Height = int.Parse(json["height"].ToString());
            retval.Width  = int.Parse(json["width"].ToString());
            retval.Url    = json["url"].ToString();

            return(retval);
        }
예제 #3
0
        public void Everything()
        {
            SPTexture t1 = new SPTexture("Media/logo.png");

            SPImage i1 = new SPImage(t1);
            SPImage i2 = new SPImage("Media/logo.png");

            i2.SetTexCoords(new SPPoint(0.5f, 0.2f), 0);
            i2.SetTexCoords(new SPPoint(0.9f, 1.0f), 3);

            Assert.True(i1.Handle != IntPtr.Zero);
            Assert.True(i2.Handle != IntPtr.Zero);
            Assert.True(i1.Texture == t1);
            Assert.True(i2.GetTexCoords(0) == new SPPoint(0.5f, 0.2f));
        }