Esempio n. 1
0
        public void In(byte[] o)
        {
            ArrayByte touchByte = new ArrayByte(o);

            type    = touchByte.ReadInt();
            keyCode = touchByte.ReadInt();
            keyChar = (char)touchByte.ReadInt();
            type    = touchByte.ReadInt();
        }
Esempio n. 2
0
        public void In(byte[] o)
        {
            ArrayByte touchByte = new ArrayByte(o);

            x0      = touchByte.ReadInt();
            y0      = touchByte.ReadInt();
            button  = touchByte.ReadInt();
            pointer = touchByte.ReadInt();
            type    = touchByte.ReadInt();
        }
Esempio n. 3
0
        public static LPKHeader ReadHeader(ArrayByte dis)
        {
            LPKHeader header = new LPKHeader();

            header.SetPAKIdentity(dis.ReadInt());
            byte[] pass = dis.ReadByteArray(LPKHeader.LF_PASSWORD_LENGTH);
            header.SetPassword(pass);
            header.SetVersion(dis.ReadFloat());
            header.SetTables(dis.ReadLong());
            return(header);
        }
Esempio n. 4
0
        static void LoadResToMemory()
        {
            Stream    stream    = null;
            ArrayByte resStream = null;

            try
            {
                stream    = XNAConfig.LoadStream(LSystem.FRAMEWORK_IMG_NAME + "font.zip");
                resStream = new ArrayByte(new GZipInputStream(stream), ArrayByte.BIG_ENDIAN);
                realsize  = resStream.ReadByte();
                offy      = resStream.ReadByte();
                fontSpace = (realsize + offy) * 2;
                if (realsize > 0x10)
                {
                    fontSpace *= 2;
                }
                int    num        = resStream.ReadInt();
                int    num2       = resStream.ReadByte();
                byte[] bufferData = new byte[resStream.Available()];
                resStream.Read(bufferData);
                fontData = bufferData;
            }
            catch (Exception)
            {
                fontData = null;
            }
            finally
            {
                if (stream != null)
                {
                    stream.Dispose();
                    stream.Close();
                    stream = null;
                }
                if (resStream != null)
                {
                    resStream = null;
                }
            }
        }
Esempio n. 5
0
        public static SpriteFont Read(string resName)
        {
            try
            {
                List <RectBox> xGlyphs = new List <RectBox>(), xCropping = new List <RectBox>();
                List <Char>    xChars = new List <Char>();
                int            xSpacingV;
                float          xSpacingH;
                List <float[]> xKerning = new List <float[]>();

                ArrayByte arrays = new ArrayByte(Resources.OpenResource(resName),
                                                 ArrayByte.BIG_ENDIAN);

                int size = arrays.ReadInt();

                LImage image = LImage.CreateImage(arrays.ReadByteArray(size));

                int count = arrays.ReadInt();
                while (count-- > 0)
                {
                    xGlyphs.Add(new RectBox(arrays.ReadInt(), arrays.ReadInt(),
                                            arrays.ReadInt(), arrays.ReadInt()));
                    xCropping.Add(new RectBox(arrays.ReadInt(), arrays.ReadInt(),
                                              arrays.ReadInt(), arrays.ReadInt()));
                    xChars.Add((char)arrays.ReadInt());
                }

                xSpacingV = arrays.ReadInt();
                xSpacingH = arrays.ReadFloat();

                count = arrays.ReadInt();
                while (count-- > 0)
                {
                    xKerning.Add(new float[] { arrays.ReadFloat(),
                                               arrays.ReadFloat(), arrays.ReadFloat() });
                }
                arrays.Dispose();
                return(new SpriteFont(new LTexture(GLLoader.GetTextureData(image),
                                                   Loon.Core.Graphics.Opengl.LTexture.Format.LINEAR), xGlyphs, xCropping, xChars, xSpacingV,
                                      xSpacingH, xKerning, 'A'));
            }
            catch (Exception e)
            {
                Loon.Utils.Debugging.Log.Exception(e);
            }
            return(null);
        }