コード例 #1
0
ファイル: BaseEngine.cs プロジェクト: GKaszewski/BrickEngine
        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();
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: maddalax/MadGameEngine
        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();
        }
コード例 #3
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();
        }
コード例 #4
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());
            }
        }
コード例 #5
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;
                }
            }
        }