void IViewEvents.OnResizing(int delta) { OnResizing?.Invoke(this, new ResizingEventArgs() { Delta = delta }); }
protected override void OnWindowBorderChanged(EventArgs e) { OnResizing?.Invoke(this, e); base.OnWindowBorderChanged(e); }
protected override void OnUpdateFrame(FrameEventArgs e) { if (_TitleChanged) { _TitleChanged = false; base.Title = _Title; } if (_VSyncChanged) { _VSyncChanged = false; base.VSync = (OpenTK.VSyncMode) this._VSync; } if (_SurfaceFixedResolutionChanged) { _SurfaceFixedResolutionChanged = false; if (_Resizable) { base.ClientSize = new Size(_SurfaceFixedResolution.X, _SurfaceFixedResolution.Y); } } if (_WindowStateChanged) { _WindowStateChanged = false; base.WindowState = (OpenTK.WindowState) this.WindowState; } if (_ResizableChanged) { _ResizableChanged = false; base.WindowBorder = _Resizable ? WindowBorder.Resizable : WindowBorder.Fixed; if (!_Resizable) { base.ClientSize = new Size(_SurfaceFixedResolution.X, _SurfaceFixedResolution.Y); } } if (_CursorVisibleChanged) { _CursorVisibleChanged = false; //base.CursorVisible = _CursorVisible; } if (_PreviousBorder != base.WindowBorder) { _PreviousBorder = base.WindowBorder; OnResizing?.Invoke(this, new EventArgs()); } // if not focused cursor always visible. base.CursorVisible = base.Focused ? _CursorVisible : true; Action doUpdateOnce; lock (_InvokeUpdateLocker) { doUpdateOnce = _InvokeOnUpdate; _InvokeOnUpdate = null; } doUpdateOnce?.Invoke(); MouseState state = Mouse.GetState(); Input.SetMouseScroll(state.WheelPrecise, state.Wheel); Time.FrameTimer.Stop(); Time.DeltaUnscaled = Time.FrameTimer.Elapsed.TotalSeconds;//e.Time * Time.TimeScale; Time.FrameTimer.Reset(); Time.FrameTimer.Start(); MouseState ms = Mouse.GetState(); Vector2D delta = new Vector2D(this._PreviousMouseState.X - ms.X, this._PreviousMouseState.Y - ms.Y); this._PreviousMouseState = ms; //Layer.PhysicsEvent.WaitOne(); // wait for physics to be free //Layer.UpdateRenderEvent.Reset(); // set update/render as busy OnUpdate?.Invoke(new UpdateEventArgs(e.Time)); base.OnUpdateFrame(e); ++Time.Frame; }
protected override void OnResize(EventArgs e) { GL.Viewport(0, 0, Width, Height); OnResizing?.Invoke(this, e); base.OnResize(e); }
protected override void OnUpdateFrame(FrameEventArgs e) { if (_TitleChanged) { _TitleChanged = false; base.Title = _Title; } if (_VSyncChanged) { _VSyncChanged = false; base.VSync = (OpenTK.VSyncMode) this._VSync; } if (_SurfaceFixedResolutionChanged) { _SurfaceFixedResolutionChanged = false; if (_Resizable) { base.ClientSize = new Size(_SurfaceFixedResolution.X, _SurfaceFixedResolution.Y); } } if (_WindowStateChanged) { _WindowStateChanged = false; base.WindowState = (OpenTK.WindowState) this.WindowState; } if (_ResizableChanged) { _ResizableChanged = false; base.WindowBorder = _Resizable ? WindowBorder.Resizable : WindowBorder.Fixed; if (!_Resizable) { base.ClientSize = new Size(_SurfaceFixedResolution.X, _SurfaceFixedResolution.Y); } } if (_CursorVisibleChanged) { _CursorVisibleChanged = false; //base.CursorVisible = _CursorVisible; } if (_PreviousBorder != base.WindowBorder) { _PreviousBorder = base.WindowBorder; OnResizing?.Invoke(this, new EventArgs()); } // if not focused cursor always visible. base.CursorVisible = base.Focused ? _CursorVisible : true; Action doUpdateOnce; lock (_InvokeUpdateLocker) { doUpdateOnce = _InvokeOnUpdate; _InvokeOnUpdate = null; } doUpdateOnce?.Invoke(); Input.SetMouseScroll(Mouse.GetState().WheelPrecise); Time.DeltaTime = e.Time * Time.TimeScale; MouseState ms = Mouse.GetState(); Vector2D delta = new Vector2D(this._PreviousMouseState.X - ms.X, this._PreviousMouseState.Y - ms.Y); this._PreviousMouseState = ms; OnUpdate?.Invoke(new UpdateEventArgs(e.Time)); base.OnUpdateFrame(e); }