Esempio n. 1
0
        public void RenderBorderFront(AGSBoundingBox square)
        {
            if (_settings.WindowSize.Equals(_lastWindowSize) && _lastSquare.SameSize(square) &&
                _glUtils.DrawQuad(_frameBuffer, square, _quad))
            {
                return;
            }

            _frameBuffer?.Dispose();
            _lastSquare     = square;
            _lastWindowSize = _settings.WindowSize;

            float width  = _glUtils.CurrentResolution.Width - _padding;
            float height = _glUtils.CurrentResolution.Height - _padding;

            _frameBuffer = _glUtils.BeginFrameBuffer(square, _settings);
            if (_frameBuffer == null)
            {
                return;
            }
            _glUtils.DrawLine(_padding, _padding, width, height, _lineWidth, _color.R, _color.G, _color.B, _color.A);
            _glUtils.DrawLine(_padding, height, width, _padding, _lineWidth, _color.R, _color.G, _color.B, _color.A);

            _frameBuffer.End();

            _glUtils.DrawQuad(_frameBuffer, square, _quad);
        }
Esempio n. 2
0
        public void RenderBorderBack(ISquare square)
        {
            if (_glUtils.DrawQuad(_frameBuffer, square, _quad))
            {
                return;
            }

            float    width      = _settings.VirtualResolution.Width;
            float    height     = _settings.VirtualResolution.Height;
            IGLColor color      = IsSelected ? _selectedColor : _color;
            IGLColor foldColor  = IsSelected ? _selectedFoldColor : _foldColor;
            float    foldHeight = height * (1f / 5f);
            PointF   foldBottom = new PointF(width / 2f, foldHeight);

            _frameBuffer = _glUtils.BeginFrameBuffer(square, _settings);
            _glUtils.DrawQuad(0, new Vector3(0, height, 0), new Vector3(width, height, 0),
                              new Vector3(), new Vector3(width, 0, 0),
                              color, color, color, color);

            _glUtils.DrawTriangle(0, new GLVertex[] { new GLVertex(new Vector2(), _emptyVector, foldColor),
                                                      new GLVertex(foldBottom.ToVector2(), _emptyVector, foldColor), new GLVertex(new Vector2(width, 0), _emptyVector, foldColor) });
            _frameBuffer.End();

            _glUtils.DrawQuad(_frameBuffer, square, _quad);
        }
Esempio n. 3
0
        public void RenderBorderBack(ISquare square)
        {
            if (_glUtils.DrawQuad(_frameBuffer, square, _quad))
            {
                return;
            }

            float    width      = _settings.VirtualResolution.Width;
            float    height     = _settings.VirtualResolution.Height;
            float    foldWidth  = (width) * (1f / 5f);
            float    foldHeight = (height) * (1f / 5f);
            IGLColor color      = IsSelected ? _selectedColor : _color;
            IGLColor foldColor  = IsSelected ? _selectedFoldColor : _foldColor;

            Vector3 foldBottomLeft = new Vector3(width - foldWidth, foldHeight, 0);
            Vector3 foldTopLeft    = new Vector3(width - foldWidth, 0, 0);
            Vector3 foldTopRight   = new Vector3(width, foldHeight, 0);

            _frameBuffer = _glUtils.BeginFrameBuffer(square, _settings);
            _glUtils.DrawQuad(0, new Vector3(0f, height, 0), new Vector3(width - foldWidth, height, 0),
                              new Vector3(), foldTopLeft,
                              color, color, color, color);

            _glUtils.DrawQuad(0, new Vector3(width - foldWidth, height, 0), new Vector3(width, height, 0),
                              foldBottomLeft, foldTopRight,
                              color, color, color, color);

            _glUtils.DrawTriangle(0, new GLVertex[] { new GLVertex(foldBottomLeft.Xy, _emptyVector, foldColor),
                                                      new GLVertex(foldTopLeft.Xy, _emptyVector, foldColor), new GLVertex(foldTopRight.Xy, _emptyVector, foldColor) });
            _frameBuffer.End();

            _glUtils.DrawQuad(_frameBuffer, square, _quad);
        }
Esempio n. 4
0
        private IFrameBuffer renderToBuffer(IRoom room)
        {
            TypedParameter sizeParam   = new TypedParameter(typeof(Size), _game.Settings.WindowSize);
            IFrameBuffer   frameBuffer = _resolver.Container.Resolve <IFrameBuffer>(sizeParam);

            frameBuffer.Begin();
            renderRoom(room);
            frameBuffer.End();
            return(frameBuffer);
        }
        private IFrameBuffer renderToBuffer()
        {
            TypedParameter sizeParam = new TypedParameter(typeof(Size), new Size(
                                                              (int)_window.AppWindowWidth, (int)_window.AppWindowHeight));
            IFrameBuffer frameBuffer = _resolver.Container.Resolve <IFrameBuffer>(sizeParam);

            frameBuffer.Begin();
            _rendererLoop.Tick();
            frameBuffer.End();
            return(frameBuffer);
        }
Esempio n. 6
0
        public void RenderBorderBack(ISquare square)
        {
            if (_glUtils.DrawQuad(_frameBuffer, square, _quad))
            {
                return;
            }

            float width           = _settings.VirtualResolution.Width;
            float height          = _settings.VirtualResolution.Height;
            float arrowWidth      = width * (1f / 2f);
            float arrowHeight     = height * (1f / 2f);
            float remainingWidth  = width - arrowWidth;
            float remainingHeight = height - arrowHeight;

            PointF point1, point2, point3;

            switch (Direction)
            {
            case ArrowDirection.Right:
                point1 = new PointF(remainingWidth / 2f, remainingHeight / 2f);          // square.TopLeft + new PointF(remainingWidth / 2f, -remainingHeight / 2f);
                point2 = new PointF(remainingWidth / 2f, height - remainingHeight / 2f); //square.BottomLeft + new PointF(remainingWidth / 2f, remainingHeight / 2f);
                point3 = new PointF(width - remainingWidth / 2f, height / 2f);           //square.BottomRight + new PointF(-remainingWidth / 2f, height / 2f);
                break;

            case ArrowDirection.Down:
                point1 = new PointF(remainingWidth / 2f, remainingHeight / 2f);
                point2 = new PointF(width / 2f, height - remainingHeight / 2f);
                point3 = new PointF(width - remainingWidth / 2f, remainingHeight / 2f);
                break;

            case ArrowDirection.Left:
                point1 = new PointF(width - remainingWidth / 2f, height - remainingHeight / 2f);
                point2 = new PointF(width - remainingWidth / 2f, remainingHeight / 2f);
                point3 = new PointF(remainingWidth / 2f, height / 2f);
                break;

            case ArrowDirection.Up:
                point1 = new PointF(remainingWidth / 2f, height - remainingHeight / 2f);
                point2 = new PointF(width / 2f, remainingHeight / 2f);
                point3 = new PointF(width - remainingWidth / 2f, height - remainingHeight / 2f);
                break;

            default: throw new NotSupportedException(Direction.ToString());
            }

            _frameBuffer = _glUtils.BeginFrameBuffer(square, _settings);
            _glUtils.DrawTriangle(0, new GLVertex[] { new GLVertex((point1).ToVector2(), _emptyVector, ArrowColor),
                                                      new GLVertex((point2).ToVector2(), _emptyVector, ArrowColor), new GLVertex((point3).ToVector2(), _emptyVector, ArrowColor) });
            _frameBuffer.End();

            _glUtils.DrawQuad(_frameBuffer, square, _quad);
        }
Esempio n. 7
0
        public void RenderBorderFront(AGSBoundingBox square)
        {
            if (_glUtils.DrawQuad(_frameBuffer, square, _quad))
            {
                return;
            }

            float width  = _glUtils.CurrentResolution.Width - _padding;
            float height = _glUtils.CurrentResolution.Height - _padding;

            _frameBuffer = _glUtils.BeginFrameBuffer(square, _settings);
            if (_frameBuffer == null)
            {
                return;
            }
            _glUtils.DrawLine(_padding, _padding, width, height, _lineWidth, _color.R, _color.G, _color.B, _color.A);
            _glUtils.DrawLine(_padding, height, width, _padding, _lineWidth, _color.R, _color.G, _color.B, _color.A);

            _frameBuffer.End();

            _glUtils.DrawQuad(_frameBuffer, square, _quad);
        }