Beispiel #1
0
        private void loadTex(string fname)
        {
            int          width  = 0;
            int          height = 0;
            FileStream   file   = File.Open(fname, FileMode.Open);
            BinaryReader read   = new BinaryReader(file);

            read.ReadBytes(4);
            NewConsole.WriteLine(read.ReadUInt32().ToString());
            for (int i = 0; i < 12; ++i)
            {
                UInt16 s = read.ReadUInt16();
                if (i == 1)
                {
                    width = s;
                }
                else if (i == 2)
                {
                    height = s;
                }
                NewConsole.WriteLine(s.ToString());
            }
            for (int i = 0; i < 256; ++i)
            {
                read.ReadByte(); read.ReadByte(); read.ReadByte();
                //palette[i] = Color.FromArgb(read.ReadByte(), read.ReadByte(), read.ReadByte());
                //read.ReadByte();
            }
            Bitmap bmp = new Bitmap(width, height);
            int    x = 0, y = 0;

            while (read.BaseStream.Position < read.BaseStream.Length)
            {
                byte r = read.ReadByte();
                bmp.SetPixel(x, y, palette[r]);

                x += 1;
                if (x % (width) == 0)
                {
                    x  = 0;
                    y += 1;
                }
            }
            pictureBox1.Image = bmp;
            file.Close();
            read.Close();
        }
Beispiel #2
0
 private void btnSave_Click(object sender, EventArgs e)         //'get font'
 {
     Color[] pal = new Color[2];
     pal[0] = Color.Transparent;
     pal[1] = Color.Black;
     if (txtGetFont.Text.Length > 0)
     {
         try
         {
             int code = Convert.ToInt32(txtGetFont.Text.Replace("(", "").Replace(")", "").Replace("0x", ""), 16);
             int id   = charTile[code];
             pictureBox1.Image = NFTR.Get_Char(font, id, pal, 3);
         }
         catch
         {
             NewConsole.WriteLine("Bad character code");
         }
     }
 }
Beispiel #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     NewConsole.Init();
 }