Beispiel #1
0
 public void setGradColor(bloColor topColor, bloColor bottomColor)
 {
     mColorTopLeft     = topColor;
     mColorTopRight    = topColor;
     mColorBottomLeft  = bottomColor;
     mColorBottomRight = bottomColor;
 }
Beispiel #2
0
        protected override void loadCompact(aBinaryReader reader)
        {
            base.loadCompact(reader);

            var finder = bloResourceFinder.getFinder();

            mTextureCount = 1;
            mTextures[0]  = finder.find <bloTexture>(reader, "timg");
            mPalette      = finder.find <bloPalette>(reader, "tlut");

            mBinding = (bloBinding)reader.Read8();

            int bits = reader.Read8();

            mMirror   = (bloMirror)((bits >> 0) & 3);
            mRotate90 = ((bits & 4) != 0);
            mWrapS    = (bloWrapMode)((bits >> 3) & 3);
            mWrapT    = mWrapS;

            reader.Skip(4);

            for (int i = 0; i < 4; ++i)
            {
                mColors[i] = new bloColor(bloColor.cWhite);
            }

            setBlendKonstColor();
            setBlendKonstAlpha();
        }
Beispiel #3
0
 public void setCharColor(bloColor color)
 {
     mColorTopLeft     = color;
     mColorTopRight    = color;
     mColorBottomLeft  = color;
     mColorBottomRight = color;
 }
Beispiel #4
0
        protected override void loadBlo1(aBinaryReader reader)
        {
            base.loadBlo1(reader);

            var finder = bloResourceFinder.getFinder();

            int numparams = reader.Read8();

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

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

            int binding = reader.Read8();

            mHBinding = (bloTextboxHBinding)((binding >> 2) & 3);
            mVBinding = (bloTextboxVBinding)((binding >> 0) & 3);

            mFontSpacing = reader.ReadS16();
            mFontLeading = reader.ReadS16();
            mFontWidth   = reader.Read16();
            mFontHeight  = reader.Read16();

            int strlen = reader.Read16();

            setString(reader.Read8s(strlen));

            numparams -= 10;

            if (numparams > 0)
            {
                if (reader.Read8() != 0)
                {
                    setConnectParent(true);
                }
                --numparams;
            }

            if (numparams > 0)
            {
                mFromColor = new bloColor(reader.Read32());
                --numparams;
            }
            else
            {
                mFromColor = new bloColor(bloColor.cZero);
            }

            if (numparams > 0)
            {
                mToColor = new bloColor(reader.Read32());
                --numparams;
            }
            else
            {
                mToColor = new bloColor(bloColor.cOne);
            }

            reader.Skip(4);
        }
Beispiel #5
0
 public void setContentsColor(bloColor topLeft, bloColor topRight, bloColor bottomLeft, bloColor bottomRight)
 {
     mTextures[cTopLeft].color     = topLeft;
     mTextures[cTopRight].color    = topRight;
     mTextures[cBottomLeft].color  = bottomLeft;
     mTextures[cBottomRight].color = bottomRight;
 }
Beispiel #6
0
        protected override void drawSelf()
        {
            var context = bloContext.getContext();

            if (context.hasRenderFlags(bloRenderFlags.PictureWireframe))
            {
                GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line);

                var rect  = new bloRectangle(0, 0, mRect.width, mRect.height);
                var white = new bloColor(bloColor.cWhite);

                GL.Disable(EnableCap.Texture2D);

                GL.Begin(PrimitiveType.Quads);
                GL.Color4(white);
                GL.Vertex2(rect.topleft);
                GL.Color4(white);
                GL.Vertex2(rect.topright);
                GL.Color4(white);
                GL.Vertex2(rect.bottomright);
                GL.Color4(white);
                GL.Vertex2(rect.bottomleft);
                GL.End();

                GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
            }
            if (mTextureCount > 0 && mTextures[0] != null)
            {
                drawSelf(0, 0, mRect.width, mRect.height, mBinding, mMirror, mRotate90, mWrapS, mWrapT);
            }
        }
Beispiel #7
0
 public void setProgramColor(string name, bloColor color)
 {
     if (mProgram == null)
     {
         return;
     }
     GL.Uniform4(getUniformLocation(name), color);
 }
Beispiel #8
0
 internal bloTextbox()
 {
     mFont        = null;
     mText        = new ushort[0];
     mFromColor   = new bloColor(bloColor.cZero);
     mToColor     = new bloColor(bloColor.cOne);
     mTopColor    = new bloColor(bloColor.cWhite);
     mBottomColor = new bloColor(bloColor.cWhite);
 }
Beispiel #9
0
 public static void saveGradient(XmlWriter writer, bloColor fromColor, bloColor toColor, string name, bool separate = false)
 {
     if (fromColor.rgba == bloColor.cZero && toColor.rgba == bloColor.cOne)
     {
         return;
     }
     writer.WriteStartElement(name);
     saveColor(writer, fromColor, "from", separate);
     saveColor(writer, toColor, "to", separate);
     writer.WriteEndElement();
 }
Beispiel #10
0
 public void draw(int x, int y, bool flipX, bool flipY, int alpha, bloColor fromColor, bloColor toColor)
 {
     draw(
         x, y, getWidth(), getHeight(),
         (flipX ? 0.0d : 1.0d),
         (flipY ? 0.0d : 1.0d),
         (flipX ? 1.0d : 0.0d),
         (flipY ? 1.0d : 0.0d),
         alpha, fromColor, toColor
         );
 }
Beispiel #11
0
 internal bloPicture()
 {
     mTextures          = new bloTexture[cTextureSlots];
     mBlendColorFactors = new double[cTextureSlots];
     mBlendAlphaFactors = new double[cTextureSlots];
     mTextureCount      = 0;
     mColors            = new bloColor[4];
     mFromColor         = new bloColor(bloColor.cZero);
     mToColor           = new bloColor(bloColor.cOne);
     mBinding           = (bloBinding.Left | bloBinding.Top | bloBinding.Right | bloBinding.Bottom);
 }
Beispiel #12
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);
        }
Beispiel #13
0
 void initialize(bloTexture topLeft, bloTexture topRight, bloTexture bottomLeft, bloTexture bottomRight, bloWindowMirror mirror, bloRectangle rectangle)
 {
     mTextures[(int)bloTextureBase.TopLeft].texture     = topLeft;
     mTextures[(int)bloTextureBase.TopRight].texture    = topRight;
     mTextures[(int)bloTextureBase.BottomLeft].texture  = bottomLeft;
     mTextures[(int)bloTextureBase.BottomRight].texture = bottomRight;
     for (var i = 0; i < 4; ++i)
     {
         mTextures[i].mirror = (bloMirror)(((int)mirror >> (6 - (i * 2))) & 3);
     }
     mRect        = rectangle;
     mContentRect = new bloRectangle(0, 0, mRect.width, mRect.height);
     mFromColor   = new bloColor(bloColor.cZero);
     mToColor     = new bloColor(bloColor.cOne);
     initializeColor();
     initializeMinSize();
 }
Beispiel #14
0
        protected override void loadXml(xElement element)
        {
            base.loadXml(element);

            var finder = bloResourceFinder.getFinder();

            mTextureCount = 1;
            mTextures[0]  = finder.find <bloTexture>(element.Element("texture"), "timg");
            mPalette      = finder.find <bloPalette>(element.Element("palette"), "tlut");

            if (!Enum.TryParse <bloBinding>(element.Element("binding"), true, out mBinding))
            {
                mBinding = (bloBinding.Left | bloBinding.Top | bloBinding.Right | bloBinding.Bottom);
            }

            if (!Enum.TryParse <bloMirror>(element.Element("mirror"), true, out mMirror))
            {
                mMirror = 0;
            }

            mRotate90 = (element.Element("rotate-90") | false);

            if (!Enum.TryParse <bloWrapMode>(element.Element("wrap-s"), true, out mWrapS))
            {
                mWrapS = bloWrapMode.None;
            }

            if (!Enum.TryParse <bloWrapMode>(element.Element("wrap-t"), true, out mWrapT))
            {
                mWrapT = bloWrapMode.None;
            }

            bloXml.loadGradient(element.Element("gradient"), out mFromColor, out mToColor);

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

            mColors[(int)bloTextureBase.TopLeft]     = bloXml.loadColor(colors.Element("top-left"), white);
            mColors[(int)bloTextureBase.TopRight]    = bloXml.loadColor(colors.Element("top-right"), white);
            mColors[(int)bloTextureBase.BottomLeft]  = bloXml.loadColor(colors.Element("bottom-left"), white);
            mColors[(int)bloTextureBase.BottomRight] = bloXml.loadColor(colors.Element("bottom-right"), white);

            setBlendKonstColor();
            setBlendKonstAlpha();
        }
Beispiel #15
0
 public static void saveColor(XmlWriter writer, bloColor color, string name, bool separate = false)
 {
     writer.WriteStartElement(name);
     if (separate)
     {
         writer.WriteElementString("r", color.r.ToString());
         writer.WriteElementString("g", color.g.ToString());
         writer.WriteElementString("b", color.b.ToString());
         if (color.a != 255)
         {
             writer.WriteElementString("a", color.a.ToString());
         }
     }
     else
     {
         writer.WriteValue(color.rgba.ToString("X8"));
     }
     writer.WriteEndElement();
 }
Beispiel #16
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);
        }
Beispiel #17
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();
 }
Beispiel #18
0
            public void draw(int x, int y, int width, int height, double sRight, double tBottom, double sLeft, double tTop, int alpha, bloColor fromColor, bloColor toColor)
            {
                var context = bloContext.getContext();

                context.useProgram();
                context.setProgramInt("textureCount", 1);
                context.setProgramInt("texture[0]", 0);
                context.setProgramColor("fromColor", fromColor);
                context.setProgramColor("toColor", toColor);
                context.setProgramInt("transparency[0]", texture.getTransparency());

                int left   = x;
                int top    = y;
                int right  = (left + width);
                int bottom = (top + height);

                bloColor whiteColor = bloMath.scaleAlpha(new bloColor(bloColor.cWhite), alpha);

                texture.bind(0);

                GL.Begin(PrimitiveType.Quads);
                GL.TexCoord2(sLeft, tTop);
                GL.Color4(whiteColor);
                GL.Vertex2(left, top);
                GL.TexCoord2(sRight, tTop);
                GL.Color4(whiteColor);
                GL.Vertex2(right, top);
                GL.TexCoord2(sRight, tBottom);
                GL.Color4(whiteColor);
                GL.Vertex2(right, bottom);
                GL.TexCoord2(sLeft, tBottom);
                GL.Color4(whiteColor);
                GL.Vertex2(left, bottom);
                GL.End();

                context.unuseProgram();
            }
Beispiel #19
0
        ushort doEscapeCode(ushort[] buffer, ref int stringPtr, int alpha)
        {
            ushort escapeCode    = 0;
            int    saveStringPtr = stringPtr;

            for (int i = 0; i < 2; ++i)
            {
                var character = buffer[stringPtr++];
                if (character >= 128 || character < 32)
                {
                    stringPtr = saveStringPtr;
                    return(0);
                }
                escapeCode <<= 8;
                escapeCode  |= character;
            }

            bloColor topColor    = mWorkState.topColor;
            bloColor bottomColor = mWorkState.bottomColor;

            switch (escapeCode)
            {
            case cHM: break;

            case cCU: mCursor.Y -= getNumber(buffer, ref stringPtr, 1, 0); break;

            case cCD: mCursor.Y += getNumber(buffer, ref stringPtr, 1, 0); break;

            case cCL: mCursor.X -= getNumber(buffer, ref stringPtr, 1, 0); break;

            case cCR: mCursor.X += getNumber(buffer, ref stringPtr, 1, 0); break;

            case cLU: mCursor.Y -= mWorkState.leading; break;

            case cLD: mCursor.Y += mWorkState.leading; break;

            case cST: {
                int number = getNumber(buffer, ref stringPtr, mWorkState.tabWidth, mWorkState.tabWidth);
                if (number >= 0)
                {
                    mWorkState.tabWidth = number;
                }
                break;
            }

            case cCC: {
                mWorkState.topColor = new bloColor(getNumber(buffer, ref stringPtr, mState.topColor.rgba, mWorkState.topColor.rgba));
                topColor            = mWorkState.topColor;
                topColor.a          = ((topColor.a * alpha) / 256);
                bottomColor.a       = ((bottomColor.a * alpha) / 256);
                mFont.setGradColor(topColor, (mWorkState.gradientMode ? bottomColor : topColor));
                break;
            }

            case cGC: {
                mWorkState.bottomColor = new bloColor(getNumber(buffer, ref stringPtr, mState.bottomColor.rgba, mWorkState.bottomColor.rgba));
                bottomColor            = mWorkState.topColor;
                topColor.a             = ((topColor.a * alpha) / 256);
                bottomColor.a          = ((bottomColor.a * alpha) / 256);
                mFont.setGradColor(topColor, (mWorkState.gradientMode ? bottomColor : topColor));
                break;
            }

            case cFX: {
                int fontWidth = getNumber(buffer, ref stringPtr, mState.fontWidth, mWorkState.fontWidth);
                if (fontWidth >= 0)
                {
                    mWorkState.fontWidth = fontWidth;
                }
                break;
            }

            case cFY: {
                int fontHeight = getNumber(buffer, ref stringPtr, mState.fontHeight, mWorkState.fontHeight);
                if (fontHeight >= 0)
                {
                    mWorkState.fontHeight = fontHeight;
                }
                break;
            }

            case cSH: {
                mWorkState.spacing = getNumber(buffer, ref stringPtr, mState.spacing, mWorkState.spacing);
                break;
            }

            case cSV: {
                mWorkState.leading = getNumber(buffer, ref stringPtr, mState.leading, mWorkState.leading);
                break;
            }

            case cGM: {
                mWorkState.gradientMode = (getNumber(buffer, ref stringPtr, (mWorkState.gradientMode ? 0 : 1), (mWorkState.gradientMode ? 1 : 0)) != 0);
                topColor.a    = ((topColor.a * alpha) / 256);
                bottomColor.a = ((bottomColor.a * alpha) / 256);
                mFont.setGradColor(topColor, (mWorkState.gradientMode ? bottomColor : topColor));
                break;
            }

            default: {
                stringPtr  = saveStringPtr;
                escapeCode = 0;
                break;
            }
            }
            return(escapeCode);
        }
Beispiel #20
0
 public TextureSlot()
 {
     color = new bloColor(bloColor.cWhite);
 }
Beispiel #21
0
 public bloPrint(bloFont font, int spacing, bloColor topColor, bloColor bottomColor)
 {
     initialize(font, spacing, Int32.MinValue, topColor, bottomColor);
 }
Beispiel #22
0
 public bloPrint(bloFont font, int spacing, int leading, bloColor topColor, bloColor bottomColor)
 {
     initialize(font, spacing, leading, topColor, bottomColor);
 }
Beispiel #23
0
 public void setGradColor(bloColor fromColor, bloColor toColor)
 {
     mFromColor = fromColor;
     mToColor   = toColor;
 }
Beispiel #24
0
        double parse(ushort[] buffer, int width, int[] lines, out Vector2d size, int alpha, bool draw)
        {
            size = new Vector2d();

            if (mFont == null)
            {
                return(0.0d);
            }

            int      line      = 0;
            Vector2d cursor    = mCursor;
            double   lineWidth = 0.0d;
            double   fHeight   = 0.0d;
            double   fLeft     = mCursor.X;
            double   fRight    = mCursor.X;
            double   fTop      = mCursor.Y;
            double   fBottom   = mCursor.Y;

            bloColor topColor    = mWorkState.topColor;
            bloColor bottomColor = mWorkState.bottomColor;

            topColor.a    = ((topColor.a * alpha) / 256);
            bottomColor.a = ((bottomColor.a * alpha) / 256);
            mFont.setGradColor(topColor, (mWorkState.gradientMode ? bottomColor : topColor));

            bool   monospace     = false;
            bool   advanceCursor = false;
            double cursorStartX;

            int stringPtr = 0;

            for (;;)
            {
                if (stringPtr >= buffer.Length)
                {
                    if (!draw && lines != null)
                    {
                        lines[line] = bloMath.round(lineWidth);
                    }
                    ++line;
                    break;
                }

                int character = buffer[stringPtr++];

                if (character == '\0')
                {
                    if (!draw && lines != null)
                    {
                        lines[line] = bloMath.round(lineWidth);
                    }
                    ++line;
                    break;
                }

                cursorStartX  = mCursor.X;
                advanceCursor = true;

                if (character < 32)
                {
                    if (character == 27)
                    {
                        ushort escapeCode = doEscapeCode(buffer, ref stringPtr, alpha);
                        if (escapeCode == cHM)
                        {
                            if (!draw && lines != null)
                            {
                                lines[line] = bloMath.round(lineWidth);
                            }
                            ++line;
                            mCursor.X = cursor.X;
                            if (line == cMaxLines)
                            {
                                break;
                            }
                            monospace = false;
                            lineWidth = 0.0d;
                        }
                        if (escapeCode != 0)
                        {
                            advanceCursor = false;
                        }
                    }
                    else
                    {
                        doCtrlCode(character);
                        advanceCursor = false;
                        if (character == '\n')
                        {
                            if (!draw && lines != null)
                            {
                                lines[line] = bloMath.round(lineWidth);
                            }
                            ++line;
                            if (line == cMaxLines)
                            {
                                break;
                            }
                            lineWidth = 0.0d;
                            monospace = false;
                        }
                        else
                        {
                            switch (character)
                            {
                            case '\b':
                            case '\t': {
                                monospace = true;
                                break;
                            }

                            case '\r': {
                                monospace = false;
                                break;
                            }
                            }
                        }
                    }
                }
                else
                {
                    // NOTE: the multi-byte EOS check was removed because it will never occur
                    // since as we pre-parse the bytes in the string to characters for the ushort[]
                    if (mFont.getMonoFlag())
                    {
                        mCursorWidth = mFont.getMonoWidth();
                    }
                    else
                    {
                        bloFont.WidthEntry entry;
                        mFont.getWidthEntry(character, out entry);
                        mCursorWidth = (monospace ? entry.width : (entry.width + entry.kerning));
                    }
                    mCursorWidth *= ((double)mWorkState.fontWidth / (double)mFont.getWidth());
                    double totalWidth = ((mCursor.X + mCursorWidth) - mOrigin.x);
                    if (totalWidth > width && mCursor.X > cursor.X)
                    {
                        --stringPtr;                         // since we optimized out the multibyte checks, -- is fine
                        mCursor.Y += mWorkState.leading;
                        if (!draw && lines != null)
                        {
                            lines[line] = bloMath.round(lineWidth);
                        }
                        ++line;
                        if (line == cMaxLines)
                        {
                            break;
                        }
                        advanceCursor = false;
                        monospace     = false;
                        mCursor.X     = mOrigin.x;
                        lineWidth     = 0.0d;
                    }
                    else
                    {
                        if (draw)
                        {
                            mFont.drawChar(
                                (mCursor.X + (lines != null ? lines[line] : 0)),
                                mCursor.Y,
                                mWorkState.fontWidth,
                                mWorkState.fontHeight,
                                character, monospace
                                );
                        }
                        monospace  = true;
                        mCursor.X += mCursorWidth;
                    }
                }
                if (advanceCursor)
                {
                    if ((mCursor.X - cursor.X) > lineWidth)
                    {
                        lineWidth = (mCursor.X - cursor.X);
                    }
                    mCursor.X    += mWorkState.spacing;
                    mCursorWidth += mWorkState.spacing;
                    double height = (mCursor.Y + (mFont.getDescent() * ((double)mWorkState.fontHeight / (double)mFont.getHeight())));
                    if (fHeight < height)
                    {
                        fHeight = height;
                    }
                    if (mCursor.X > fRight)
                    {
                        fRight = mCursor.X;
                    }
                    if (mCursor.X < fLeft)
                    {
                        fLeft = mCursor.X;
                    }
                    if (cursorStartX < fLeft)
                    {
                        fLeft = cursorStartX;
                    }
                    if (mCursor.Y > fBottom)
                    {
                        fBottom = mCursor.Y;
                    }
                    if (mCursor.Y < fTop)
                    {
                        fTop = mCursor.Y;
                    }
                }
            }

            if (lines != null)
            {
                lines[line] = -1;
            }

            size.X = (fRight - fLeft);
            size.Y = ((fBottom - fTop) + mFont.getLeading());

            if (!draw)
            {
                mCursor = cursor;
            }

            return(fHeight);
        }
Beispiel #25
0
 public override void setGL(bloColor fromColor, bloColor toColor)
 {
     mFromColor = fromColor;
     mToColor   = toColor;
 }
Beispiel #26
0
 public override void setGL()
 {
     mFromColor = new bloColor(bloColor.cZero);
     mToColor   = new bloColor(bloColor.cOne);
 }
Beispiel #27
0
 public bloScreen()
 {
     mTintColor = new bloColor(bloColor.cZero);
     mVisible   = true;
     mAlpha     = 255;
 }
Beispiel #28
0
        protected override void loadBlo1(aBinaryReader reader)
        {
            base.loadBlo1(reader);

            var finder = bloResourceFinder.getFinder();

            int numparams = reader.Read8();

            mTextureCount = 1;
            mTextures[0]  = finder.find <bloTexture>(reader, "timg");
            mPalette      = finder.find <bloPalette>(reader, "tlut");
            mBinding      = (bloBinding)reader.Read8();

            numparams -= 3;

            if (numparams > 0)
            {
                int bits = reader.Read8();
                mMirror   = (bloMirror)(bits & 3);
                mRotate90 = ((bits & 4) != 0);
                --numparams;
            }
            else
            {
                mMirror   = 0;
                mRotate90 = false;
            }

            if (numparams > 0)
            {
                int bits = reader.Read8();
                mWrapS = (bloWrapMode)((bits >> 2) & 3);
                mWrapT = (bloWrapMode)((bits >> 0) & 3);
                --numparams;
            }
            else
            {
                mWrapS = bloWrapMode.None;
                mWrapT = bloWrapMode.None;
            }

            if (numparams > 0)
            {
                mFromColor = new bloColor(reader.Read32());
                --numparams;
            }
            else
            {
                mFromColor = new bloColor(bloColor.cZero);
            }

            if (numparams > 0)
            {
                mToColor = new bloColor(reader.Read32());
                --numparams;
            }
            else
            {
                mToColor = new bloColor(bloColor.cOne);
            }

            for (int i = 0; i < 4; ++i)
            {
                if (numparams > 0)
                {
                    mColors[i] = new bloColor(reader.Read32());
                    --numparams;
                }
                else
                {
                    mColors[i] = new bloColor(bloColor.cWhite);
                }
            }

            reader.Skip(4);

            setBlendKonstColor();
            setBlendKonstAlpha();
        }
Beispiel #29
0
 public static bloColor scaleAlpha(bloColor color, int alpha)
 {
     return(new bloColor(color.r, color.g, color.b, ((color.a * alpha) / 256)));
 }
Beispiel #30
0
 public virtual void setGL(bloColor fromColor, bloColor toColor)
 {
     setGL();
 }