예제 #1
0
        public void saveFile(string path)
        {
            array[0].endIndex = 2 + size * 8 + array[0].array.Length;
            for (int i = 1; i < size; i++)
            {
                array[i].endIndex = array[i - 1].endIndex + array[i].array.Length;
            }

            MemoryWriter mw = new MemoryWriter();

            mw.writeUShort(size);
            for (int i = 0; i < size; i++)
            {
                CXGlyphInfo info = array[i];
                mw.writeUShort((ushort)info.code);
                mw.writeUShort(info.width);
                mw.writeInt32(info.endIndex);
            }
            for (int i = 0; i < size; i++)
            {
                mw.writeBytes(array[i].array);
            }

            using (FileStream fs = new FileStream(path, FileMode.Create))
            {
                fs.Write(mw.getContent(), 0, mw.getIndex());
            }
        }
예제 #2
0
파일: DPixelFont.cs 프로젝트: droidsde/game
        public void saveFile(string path)
        {
            MemoryWriter mw = new MemoryWriter(MemoryWriter.ENCODING_UTF8);

            mw.writeFixString(FILE_HEAD, 4);
            mw.writeInt32(FILE_VERSION);
            mw.writeFixString(FontName, 32);
            mw.writeInt32(FontHeight);
            mw.writeInt32(MapWidth);
            mw.writeInt32(MapHeight);

            mw.writeInt32(CharArray.Length);
            for (int i = 0; i < CharArray.Length; i++)
            {
                CharItem item = CharArray[i];
                mw.writeUShort((ushort)item.Code);
                mw.writeUShort(item.CharWidth);
            }
            for (int i = 0; i < CharArray.Length; i++)
            {
                mw.writeBytes(CharArray[i].Data);
            }

            using (FileStream fs = new FileStream(path, FileMode.Create))
            {
                fs.Write(mw.getContent(), 0, mw.getIndex());
            }
        }