Exemple #1
0
        protected override void loadCompact(aBinaryReader reader)
        {
            base.loadCompact(reader);

            var finder = bloResourceFinder.getFinder();

            mFont = finder.find <bloResFont>(reader, "font");

            mTopColor    = new bloColor(reader.Read32());
            mBottomColor = new bloColor(reader.Read32());

            int hbinding = reader.Read8();

            mHBinding = (bloTextboxHBinding)(hbinding & 127);
            mVBinding = (bloTextboxVBinding)reader.Read8();

            if ((hbinding & 0x80) != 0)
            {
                mFontSpacing = reader.ReadS16();
                mFontLeading = reader.ReadS16();
                mFontWidth   = reader.Read16();
                mFontHeight  = reader.Read16();
            }
            else if (mFont != null)
            {
                mFontSpacing = 0;
                mFontLeading = mFont.getLeading();
                mFontWidth   = mFont.getWidth();
                mFontHeight  = mFont.getHeight();
            }
            else
            {
                mFontSpacing = 0;
                mFontLeading = 0;
                mFontWidth   = 0;
                mFontHeight  = 0;
            }

            int strlen = reader.Read16();

            setString(reader.Read8s(strlen));

            mFromColor = new bloColor(bloColor.cZero);
            mToColor   = new bloColor(bloColor.cOne);

            reader.Skip(4);
        }
Exemple #2
0
        protected override void loadXml(xElement element)
        {
            base.loadXml(element);

            var finder = bloResourceFinder.getFinder();

            mFont = finder.find <bloResFont>(element.Element("font"), "font");

            mText = bloXml.loadTextBuffer(element.Element("text"), mFont);

            var white  = new bloColor(bloColor.cWhite);
            var colors = element.Element("colors");

            mTopColor    = bloXml.loadColor(colors.Element("top"), white);
            mBottomColor = bloXml.loadColor(colors.Element("bottom"), white);

            var binding = element.Element("binding");

            if (!Enum.TryParse <bloTextboxHBinding>(binding.Element("horizontal"), true, out mHBinding))
            {
                mHBinding = bloTextboxHBinding.Left;
            }

            if (!Enum.TryParse <bloTextboxVBinding>(binding.Element("vertical"), true, out mVBinding))
            {
                mVBinding = bloTextboxVBinding.Top;
            }

            var typesetting = element.Element("typesetting");
            int leading     = (mFont != null ? mFont.getLeading() : 20);
            int width       = (mFont != null ? mFont.getWidth() : 20);
            int height      = (mFont != null ? mFont.getHeight() : 20);

            mFontSpacing = (typesetting.Element("spacing") | 0);
            mFontLeading = (typesetting.Element("leading") | leading);
            mFontWidth   = (typesetting.Element("width") | width);
            mFontHeight  = (typesetting.Element("height") | height);

            bloXml.loadGradient(element.Element("gradient"), out mFromColor, out mToColor);
        }
Exemple #3
0
 void initialize(bloFont font, int spacing, int leading, bloColor topColor, bloColor bottomColor)
 {
     mFont          = font;
     mState.spacing = spacing;
     if (mFont != null)
     {
         mState.leading = (leading != Int32.MinValue ? leading : mFont.getLeading());
     }
     else
     {
         mState.leading = 32;
     }
     mState.gradientMode = true;
     mState.topColor     = topColor;
     mState.bottomColor  = bottomColor;
     mFromColor          = new bloColor(bloColor.cZero);
     mToColor            = new bloColor(bloColor.cOne);
     if (mFont != null)
     {
         mState.tabWidth = (short)(mFont.getWidth() * 4);
     }
     else
     {
         mState.tabWidth = 80;
     }
     if (mFont != null)
     {
         setFontSize();
         mFont.setGL(mFromColor, mToColor);
     }
     else
     {
         mState.fontWidth  = Int32.MinValue;
         mState.fontHeight = Int32.MinValue;
     }
     locate(0, 0);
     initchar();
 }