Example #1
0
        public override void Draw(GUIRenderLayer layer)
        {
            base.Draw(layer);

            if (DrawCursor && Focused && CursorImage != null)
            {
                Vector2 origin = Rect.GetPixelOrigin();

                layer.PushTranslation(origin.X + CursorPostion.X, origin.Y + CursorPostion.Y, 10);
                layer.AddDrawable(CursorImage);
                layer.PopMatrix();
            }
        }
        public void PushOriginMatrix(OriginLocation origin, GUIRenderLayer layer)
        {
            switch (origin)
            {
            case OriginLocation.LowerLeft:     // where we start
                layer.PushMatrix(Matrix4.Identity);
                break;

            case OriginLocation.MiddleLeft:
                layer.PushTranslation(0, PixelSize.Y, 0);
                break;

            case OriginLocation.UpperLeft:
                layer.PushTranslation(0, PixelSize.Y * 2, 0);
                break;

            case OriginLocation.UpperCenter:
                layer.PushTranslation(PixelSize.X, PixelSize.Y, 0);
                break;

            case OriginLocation.UpperRight:
                layer.PushTranslation(PixelSize.X * 2, PixelSize.Y * 2, 0);
                break;

            case OriginLocation.MiddleRight:
                layer.PushTranslation(PixelSize.X * 2, PixelSize.Y, 0);
                break;

            case OriginLocation.LowerRight:
                layer.PushTranslation(PixelSize.X * 2, 0, 0);
                break;

            case OriginLocation.LowerCenter:
                layer.PushTranslation(PixelSize.X, 0, 0);
                break;

            case OriginLocation.Center:
                layer.PushTranslation(PixelSize.X, PixelSize.Y, 0);
                break;
            }
        }