Exemple #1
0
        public IFrameBuffer BeginFrameBuffer(ISquare square, IRuntimeSettings settings)
        {
            float width       = square.MaxX - square.MinX;
            float height      = square.MaxY - square.MinY;
            var   aspectRatio = new SizeF(settings.WindowSize.Width / (float)settings.VirtualResolution.Width,
                                          settings.WindowSize.Height / (float)settings.VirtualResolution.Height);

            var frameBuffer = new GLFrameBuffer(new Size((int)Math.Ceiling(width * aspectRatio.Width),
                                                         (int)Math.Ceiling(height * aspectRatio.Height)), _graphics);

            frameBuffer.Begin();
            return(frameBuffer);
        }
Exemple #2
0
        public IFrameBuffer BeginFrameBuffer(AGSBoundingBox square, IRuntimeSettings settings)
        {
            float width       = square.MaxX - square.MinX;
            float height      = square.MaxY - square.MinY;
            var   aspectRatio = new SizeF(settings.WindowSize.Width / CurrentResolution.Width,
                                          settings.WindowSize.Height / CurrentResolution.Height);

            var frameBuffer = new GLFrameBuffer(new Size((int)Math.Ceiling(width * aspectRatio.Width),
                                                         (int)Math.Ceiling(height * aspectRatio.Height)), _graphics, _messagePump);

            if (!frameBuffer.Begin())
            {
                frameBuffer.End();
                return(null);
            }
            return(frameBuffer);
        }