示例#1
0
 public bool Equals(SwapchainDescription other)
 {
     return(Source.Equals(other.Source) &&
            Width.Equals(other.Width) &&
            Height.Equals(other.Height) &&
            DepthFormat == other.DepthFormat &&
            VSync.Equals(other.VSync) &&
            ColorSrgb.Equals(other.ColorSrgb));
 }
示例#2
0
        internal void CopySettings(MenuSettings settings)
        {
            volume = settings.volume;

            shadows              = settings.shadows;
            shadowsQuality       = settings.shadowsQuality;
            antiAliasing         = settings.antiAliasing;
            anisotropicFiltering = settings.anisotropicFiltering;
            realTimeReflections  = settings.realTimeReflections;
            vSync      = settings.vSync;
            resolution = settings.resolution;
            fullScreen = settings.fullScreen;
        }
示例#3
0
        public MenuSettings()
        {
            volume = 1;

            shadows        = Shadow.Soft;
            shadowsQuality = ShadowQuality.Ultra;

            antiAliasing         = AntiAliasing.X8;
            anisotropicFiltering = AnisotropicFiltering.Enable;
            realTimeReflections  = true;
            vSync      = VSync.Half;
            resolution = MaxResolution;
            fullScreen = true;
        }
示例#4
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            VSync = Settings.VSync ? VSyncMode.On : VSyncMode.Off;
            Title = $"BrickEngine VSync: ({VSync.ToString()}) FPS: ({1f / e.Time:0}) Limit FPS: ({Settings.Framerate}) - UNLICENSED VERSION";

            var projection = Matrix4.CreateOrthographicOffCenter(0, Width, Height, 0, 0, 1);

            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadMatrix(ref projection);

            RenderingSystem.ClearScreen();
            RenderingSystem.RunConfiguration();
            Render();
            SwapBuffers();
        }
示例#5
0
        protected override void OnUpdateFrame(FrameEventArgs e)
        {
            base.OnUpdateFrame(e);

            this.Title = "MadGameEngine (Vsync: " + VSync.ToString() + ") " + " FPS: " + (1f / e.Time).ToString("0.");

            foreach (var key in Collisionables.Keys)
            {
                key.CheckCollision();
            }

            Collisionables.Keys.OfType <IMoveable>().ToList().ForEach(w => w.Move());
            View.SetPosition(LocalPlayer.Position.Current);
            Collisionables.Keys.OfType <IUpdateable>().ToList().ForEach(w => w.Update());
            View.Update();
        }
示例#6
0
        public void SetBuffer(VSync vSync)
        {
            QualitySettings.vSyncCount = ( int )vsync;
            refreshRate = Screen.currentResolution.refreshRate;

            if (vsync == VSync.Off)
            {
                targetFrameRate = 0;
            }
            else
            {
                targetFrameRate = refreshRate / ( int )vsync;
            }

            Application.targetFrameRate = ( int )targetFrameRate;

            Debug.Log($"Vsync is {vsync} target frameRate {targetFrameRate} refresh rate {refreshRate}");
        }
示例#7
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            Title = $"OpenTK Guide (Vsync: {VSync.ToString()}) FPS: {(1f / e.Time).ToString("0.")}";

            GL.Enable(EnableCap.DepthTest);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            //_entity.MoveEntity(new Vector3(0, 0, -0.2f));
            _entity.RotateEntity(0, 1f, 0);

            using (var _renderer = new Renderer(_shader))
            {
                _camera.Move();
                _shader.Start();
                _shader.LoadLight(_light);
                _shader.LoadViewMatrix(_camera);
                _renderer.Render(_entity, _shader);
                _shader.Stop();
            }

            SwapBuffers();
        }
示例#8
0
        public static string ToArg(this VSync value)
        {
            switch (value)
            {
            case VSync.Auto:
                return("auto");

            case VSync.Passthrough:
                return("passthrough");

            case VSync.ConstantFrameRate:
                return("cfr");

            case VSync.VariableFrameRate:
                return("vfr");

            case VSync.Drop:
                return("drop");

            default:
                return(value.ToString().ToLowerInvariant());
            }
        }
示例#9
0
        protected override void OnUpdateFrame(FrameEventArgs e)
        {
            Title = "GameWindowSimple (Vsync: " + VSync.ToString() + ") " + "  FPS: " + (1f / e.Time).ToString("0.");

            // this is called every frame, put game logic here
            if (Capture != null)
            {
                if (_render)
                {
                    if (_captureBuffer.TryDequeue(out _currentProcessedFrame))
                    {
                        _backgroundImage = _currentProcessedFrame.Image;
                    }
                }
            }
            else
            {
                if (!_isInit)
                {
                    _currentProcessedFrame = ProcessFrame(_backgroundImage);
                    _isInit = true;
                }
            }
        }