Пример #1
0
    public override void _Ready()
    {
        DownloadShareware.Main(new string[] { Folder });
        Assets = new Assets(Folder);

        VisualServer.SetDefaultClearColor(new Color(Assets.BackgroundColor));

        Level level = new Level()
        {
            Assets = Assets,
            Map    = Assets.Maps[0],
        };

        AddChild(level);


        AddChild(new Label()
        {
            Text  = "Dopefish lives!",
            Theme = new Theme()
            {
                DefaultFont = Assets.Fonts[0],
            },
        });
    }
Пример #2
0
        public void VSwapTest()
        {
            DownloadShareware.Main(new string[] { Folder });
            VSwap vSwap = VSwap.Load(Folder, XML);

            Console.WriteLine("Number of graphics pages: " + vSwap.Pages.Length.ToString());
            Console.WriteLine("Number of DigiSounds: " + vSwap.DigiSounds.Length.ToString());
        }
Пример #3
0
        public void LengthsTest()
        {
            DownloadShareware.Main(new string[] { Folder });
            uint[] head;
            using (FileStream vgaHead = new FileStream(System.IO.Path.Combine(Folder, XML.Element("VgaGraph").Attribute("VgaHead").Value), FileMode.Open))
                head = VgaGraph.ParseHead(vgaHead);
            uint[] lengths = new uint[head.Length - 1];
            using (FileStream vgaGraphStream = new FileStream(System.IO.Path.Combine(Folder, XML.Element("VgaGraph").Attribute("VgaGraph").Value), FileMode.Open))
                using (BinaryReader binaryReader = new BinaryReader(vgaGraphStream))
                    for (uint i = 0; i < lengths.Length; i++)
                    {
                        vgaGraphStream.Seek(head[i], 0);
                        lengths[i] = binaryReader.ReadUInt32();
                    }

            Console.WriteLine("Lengths from start of each chunk: ");
            foreach (uint length in lengths)
            {
                Console.Write(length.ToString() + ", ");
            }
            Console.WriteLine();

            Console.WriteLine("Sizes from chunk 0: ");
            VgaGraph vgaGraph = VgaGraph.Load(Folder, XML);

            foreach (ushort[] size in vgaGraph.Sizes)
            {
                Console.Write((size[0] * size[1]).ToString() + ", ");
            }
            Console.WriteLine();

            Console.WriteLine("Pic sizes / 4: ");
            foreach (byte[] pic in vgaGraph.Pics)
            {
                if (pic != null)
                {
                    Console.Write((pic.Length / 4).ToString() + ", ");
                }
            }
            Console.WriteLine();
        }
Пример #4
0
        public void FontTest()
        {
            DownloadShareware.Main(new string[] { Folder });
            VgaGraph vgaGraph = VgaGraph.Load(Folder, XML);
            uint     font     = 0;
            char     letter   = 'A';

            Console.Write("Writing letter \"" + letter + "\":");
            for (uint i = 0; i < vgaGraph.Fonts[font].Character[letter].Length; i++)
            {
                if (i % (vgaGraph.Fonts[font].Width(letter) * 4) == 0)
                {
                    Console.WriteLine();
                }
                Console.Write(
                    vgaGraph.Fonts[font].Character[letter][i] == 0 ?
                    "0"
                    : "1"
                    );
            }
            Console.WriteLine();

            string str = "Ab";

            Console.Write("Writing string \"" + str + "\":");
            byte[] test  = vgaGraph.Fonts[font].Line(str);
            uint   width = vgaGraph.Fonts[font].CalcWidth(str) * 4;

            for (uint i = 0; i < test.Length; i++)
            {
                if (i % width == 0)
                {
                    Console.WriteLine();
                }
                Console.Write(
                    test[i] == 0 ?
                    "0"
                    : "1"
                    );
            }
        }
Пример #5
0
        public void GameMapsTest()
        {
            DownloadShareware.Main(new string[] { Folder });
            GameMap[] maps = GameMap.Load(Folder, XML);

            GameMap map = maps[0];

            Console.WriteLine(map.Name + ": ");
            for (uint i = 0; i < map.MapData.Length; i++)
            {
                Console.Write(map.MapData[i].ToString("D3"));
                if (i % map.Width == map.Width - 1)
                {
                    Console.WriteLine();
                }
                else
                {
                    Console.Write(" ");
                }
            }
        }
Пример #6
0
        public void VgaGraphTest()
        {
            DownloadShareware.Main(new string[] { Folder });
            VgaGraph vgaGraph = VgaGraph.Load(Folder, XML);

            if (vgaGraph.Sizes != null)
            {
                Console.Write("Image sizes: ");
                foreach (ushort[] size in vgaGraph.Sizes)
                {
                    if (size != null)
                    {
                        Console.Write("(" + size[0].ToString() + ", " + size[1].ToString() + ") ");
                    }
                }
                Console.WriteLine();
            }

            //uint chunk = 0;
            //Console.Write("Chunk " + chunk.ToString() + " contents: ");
            //foreach (byte bite in vgaGraph.File[chunk])
            //    Console.Write(bite.ToString() + ", ");
            //Console.WriteLine();
        }