private void LoadSde(Stream stream)
        {
            ZipArchive zip = new ZipArchive(stream, ZipArchiveMode.Read);

            _descJson = JObject.Parse(EntryToString(zip.GetEntry(SDEConstants.DESCRIPTOR_FILENAME)));

            foreach (ZipArchiveEntry entry in zip.Entries)
            {
                if (SDEConstants.IsEmitterXmlName(entry.Name))
                {
                    string         emitterId = SDEConstants.GetEmitterId(entry.Name);
                    RawEmitterData rawData   = new RawEmitterData();
                    rawData.EmitterId     = emitterId;
                    rawData.EmitterString = EntryToString(entry);
                    // + parse snapshot
                    var snapshot = zip.GetEntry(SDEConstants.GetParticleSnapshotName(emitterId));
                    if (snapshot != null)
                    {
                        rawData.Snapshot = snapshot.Open();
                    }
                    _rawEmitterDatas.Add(rawData);
                }
            }
            // texture atlas
            var    atlasZipEntry  = zip.GetEntry(SDEConstants.ATLAS_XML_NAME);
            string atlasXmlString = EntryToString(atlasZipEntry);

            var     atlasImageEntry = zip.GetEntry(SDEConstants.ATLAS_IMAGE_NAME);
            Texture tex             = SimpleTextureLoader.LoadImageFromStream(atlasImageEntry.Open());

            _atlas = new TextureAtlas(atlasXmlString, tex);

            _projectLoaded = true;
        }
示例#2
0
 /**
  * Creates a BunnyMark with a certain number of Wabbits.
  *
  * @param count
  * The number of wabbits.
  * @param rect
  * You can define a rectangle for the borders of the BunnyMark. If you don't specify the rectangle the complete stage will be used.
  */
 public BunnyMarkSimple(int count = 100, Rectangle rect = null)
 {
     Touchable = false;
     mCount    = count;
     if (rect != null)
     {
         mRectangle = rect;
     }
     mTexture      = SimpleTextureLoader.LoadAndroidResource(SparrowSharp.Samples.Android.Resource.Drawable.wabbit_alpha);
     AddedToStage += AddedToStageHandler;
 }
示例#3
0
        public Benchmark()
        {
            GLTexture star = SimpleTextureLoader.LoadLocalImage("../../bigstar.png");
            GLTexture bird = SimpleTextureLoader.LoadLocalImage("../../benchmark_object.png");

            textures = new Texture[] { bird, star };

            // the container will hold all test objects
            _container = new Sprite();
            AddChild(_container);

            EnterFrame   += EnterFrameHandler;
            AddedToStage += AddedToStageHandler;
        }
示例#4
0
        public Benchmark()
        {
            GLTexture star    = SimpleTextureLoader.LoadAndroidResource(SparrowSharp.Samples.Android.Resource.Drawable.star);
            GLTexture bird    = SimpleTextureLoader.LoadAndroidResource(SparrowSharp.Samples.Android.Resource.Drawable.benchmark_object);
            GLTexture bigstar = SimpleTextureLoader.LoadAndroidResource(SparrowSharp.Samples.Android.Resource.Drawable.bigstar);

            textures = new Texture[] { bird, bigstar, star };


            // the container will hold all test objects
            _container = new Sprite();
            AddChild(_container);

            EnterFrame   += EnterFrameHandler;
            AddedToStage += AddedToStageHandler;
        }
示例#5
0
        public Benchmark()
        {
            // NOTE: Removing this breaks the app on some Nvidia cards!
            SparrowSharp.EnableErrorChecking();

            EmbeddedResourceLoader loader = new EmbeddedResourceLoader("SparrowSamples");

            textures = new[] { SimpleTextureLoader.LoadImageFromStream(loader.GetEmbeddedResourceStream("bigstar.png")),
                               SimpleTextureLoader.LoadImageFromStream(loader.GetEmbeddedResourceStream("benchmark_object.png")),
                               SimpleTextureLoader.LoadImageFromStream(loader.GetEmbeddedResourceStream("scaleGridTest.png")) };

            // the container will hold all test objects
            _container = new Sprite();
            AddChild(_container);

            EnterFrame   += EnterFrameHandler;
            AddedToStage += AddedToStageHandler;
            //SparrowSharp.SkipUnchangedFrames = true;
            SparrowSharp.Stage.Color = 0x432323;
        }
示例#6
0
        private void ParseFontData(Stream fontTextureData, Stream fontXmlData)
        {
            if (fontTextureData == null || fontXmlData == null)
            {
                throw new InvalidOperationException("Font parsing requires texture and font XML to be set");
            }

            Name       = "unknown";
            LineHeight = Size = Baseline = 14;
            OffsetX    = OffsetY = Padding = 0.0f;

            _texture     = SimpleTextureLoader.LoadImageFromStream(fontTextureData);
            _chars       = new Dictionary <int, BitmapChar>();
            _helperImage = new Image(_texture);

            XmlDocument xml = new XmlDocument();

            xml.Load(fontXmlData);

            ParseFontXml(xml);
        }