Ejemplo n.º 1
0
        protected virtual void buildSaveData(IkadnWriter writer)
        {
            var baseSettings = new IkonComposite(BaseSettingsTag);

            baseSettings.Add(LanguageKey, new IkonText(this.LanguageId));
            baseSettings.Add(LastGameKey, this.LastGame.BuildSaveData());
            baseSettings.Compose(writer);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Usage: TextureAtlas <folder> [options]");
                return;
            }
            else
            {
                ReadParameters(args);
            }

            var builder = new AtlasBuilder(
                items.Select(x => new KeyValuePair <string, Size>(x.Key, x.Value.Size)).ToArray(),
                margin, new Size(width, heigth)
                );

            var atlasIkon  = new IkonComposite(compositeTag);
            var atlasImage = new Bitmap(width, heigth);

            using (Graphics g = Graphics.FromImage(atlasImage))
                foreach (var x in builder.Build())
                {
                    Console.WriteLine(x.Key + " " + x.Value);
                    string[] nameParams = x.Key.Split('-');

                    var bounds = x.Value;
                    foreach (var param in nameParams)
                    {
                        if (param.StartsWith("hStretch"))
                        {
                            int amount;
                            if (!int.TryParse(param.Substring("hStretch".Length), out amount))
                            {
                                amount = 1;
                            }
                            bounds.Inflate(-amount, 0);
                        }
                    }

                    var textureCoords = new IkonArray();
                    textureCoords.Add(serializeRectangle(bounds.Left, bounds.Top));
                    textureCoords.Add(serializeRectangle(bounds.Right, bounds.Top));
                    textureCoords.Add(serializeRectangle(bounds.Right, bounds.Bottom));
                    textureCoords.Add(serializeRectangle(bounds.Left, bounds.Bottom));

                    atlasIkon.Add(nameParams[0], textureCoords);
                    var destRect = new Rectangle(x.Value.Location, x.Value.Size);
                    g.DrawImage(items[x.Key], destRect);
                }

            using (var outStream = new StreamWriter(outputIkonPath)) {
                var writer = new IkadnWriter(outStream);
                atlasIkon.Compose(writer);
            }

            atlasImage.Save(outputImagePath, ImageFormat.Png);
        }
Ejemplo n.º 3
0
        protected override void buildSaveData(IkadnWriter writer)
        {
            base.buildSaveData(writer);

            var settings = new IkonComposite(WinformsSettingsTag);

            settings.Add(GuiScaleKey, new IkonFloat(this.GuiScale));

            settings.Add(FpsBusyWaitKey, new IkonInteger((int)this.FramerateBusySpinUsage));
            settings.Add(FpsKey, new IkonInteger(this.Framerate));
            settings.Add(FpsUnlimitedKey, new IkonInteger(this.UnlimitedFramerate ? 1 : -1));
            settings.Add(VSyncKey, new IkonInteger(this.VSync ? 1 : -1));

            settings.Add(ReportTechnologyKey, new IkonInteger(this.ReportTechnology ? 1 : -1));
            settings.Compose(writer);
        }
Ejemplo n.º 4
0
        protected override void buildSaveData(IkadnWriter writer)
        {
            base.buildSaveData(writer);

            var settings = new IkonComposite(WinformsSettingsTag)
            {
                { GuiScaleKey, new IkonFloat(this.GuiScale) },

                { FpsBusyWaitKey, new IkonInteger((int)this.FramerateBusySpinUsage) },
                { FpsKey, new IkonInteger(this.Framerate) },
                { FpsUnlimitedKey, new IkonInteger(this.UnlimitedFramerate ? 1 : -1) },
                { VSyncKey, new IkonInteger(this.VSync ? 1 : -1) },

                { ReportContactKey, new IkonInteger(this.ReportContact ? 1 : -1) },
                { ReportTechnologyKey, new IkonInteger(this.ReportTechnology ? 1 : -1) },
                { ShowScanRangeKey, new IkonInteger(this.ShowScanRange ? 1 : -1) }
            };

            settings.Compose(writer);
        }