private void WindowOnMouseEnterActions(SDL.SDL_WindowEvent sdlWindowEvent) { if (!isMouseVisible && !isMouseCurrentlyHidden) { Cursor.Hide(); isMouseCurrentlyHidden = true; } }
private void GameForm_RestoredActions(SDL.SDL_WindowEvent e) { if (previousWindowState == FormWindowState.Minimized) { ResumeRendering?.Invoke(this, EventArgs.Empty); } previousWindowState = FormWindowState.Normal; }
private void WindowOnMouseLeaveActions(SDL.SDL_WindowEvent sdlWindowEvent) { if (isMouseCurrentlyHidden) { Cursor.Show(); isMouseCurrentlyHidden = false; } }
private void GameForm_FocusEvent(SDL.SDL_WindowEvent e) { if (e.data1 == 0) { return; // make no change } GameBase.PauseRendering = e.data1 == 2; }
private void OnSizeChanged(SDL.SDL_WindowEvent eventArgs) { SetSurfaceSize(new Vector2(uiControl.ClientSize.Width, uiControl.ClientSize.Height)); if (IsPositionLocked) { // update center of screen for locking cursor relativeCapturedPosition = new Point(uiControl.ClientSize.Width / 2, uiControl.ClientSize.Height / 2); uiControl.RelativeCursorPosition = relativeCapturedPosition; } }
private void GameForm_ResizeEndActions(SDL.SDL_WindowEvent e) { if (isUserResizing && cachedSize.Equals(Size)) { UserResized?.Invoke(this, EventArgs.Empty); // UpdateScreen(); } isUserResizing = false; ResumeRendering?.Invoke(this, EventArgs.Empty); }
private void GameForm_MaximizedActions(SDL.SDL_WindowEvent e) { if (previousWindowState == FormWindowState.Minimized) { ResumeRendering?.Invoke(this, EventArgs.Empty); } previousWindowState = FormWindowState.Maximized; UserResized?.Invoke(this, EventArgs.Empty); //UpdateScreen(); cachedSize = Size; }
private void GameForm_ResizeBeginActions(SDL.SDL_WindowEvent e) { if (Graphics.GraphicsDevice.Platform == Graphics.GraphicsPlatform.Vulkan && OriginalSize.HasValue) { // resizing not supported, return to original resolution Size = cachedSize = OriginalSize.Value; } else { isUserResizing = true; PauseRendering?.Invoke(this, EventArgs.Empty); cachedSize = Size; } }
private void GameForm_ResizeEndActions(SDL.SDL_WindowEvent e) { if (Graphics.GraphicsDevice.Platform == Graphics.GraphicsPlatform.Vulkan && OriginalSize.HasValue) { // resizing not supported, return to original resolution Size = cachedSize = OriginalSize.Value; } else { if (isUserResizing && cachedSize.Equals(Size)) { UserResized?.Invoke(this, EventArgs.Empty); // UpdateScreen(); } isUserResizing = false; ResumeRendering?.Invoke(this, EventArgs.Empty); } }
private void GameForm_RestoredActions(SDL.SDL_WindowEvent e) { if (previousWindowState == FormWindowState.Minimized) { ResumeRendering?.Invoke(this, EventArgs.Empty); } var newSize = Size; if (!isUserResizing && (!newSize.Equals(cachedSize) || previousWindowState == FormWindowState.Maximized)) { previousWindowState = FormWindowState.Normal; // Only update when cachedSize is != 0 if (cachedSize != Size2.Empty) { isSizeChangedWithoutResizeBegin = true; } } previousWindowState = FormWindowState.Normal; }
private void OnSizeChanged(SDL.SDL_WindowEvent eventArgs) { SetSurfaceSize(new Vector2(uiControl.ClientSize.Width, uiControl.ClientSize.Height)); }
private void GameForm_MinimizedActions(SDL.SDL_WindowEvent e) { previousWindowState = FormWindowState.Minimized; PauseRendering?.Invoke(this, EventArgs.Empty); }
private void GameForm_ResizeBeginActions(SDL.SDL_WindowEvent e) { isUserResizing = true; cachedSize = Size; PauseRendering?.Invoke(this, EventArgs.Empty); }
private void GameForm_ActivateActions(SDL.SDL_WindowEvent e) { AppDeactivated?.Invoke(this, EventArgs.Empty); }
public WindowClosingEventArgs(SDL.SDL_WindowEvent evt) { Cancel = false; }
private void UiWindowOnSizeChanged(SDL.SDL_WindowEvent eventArgs) { ControlWidth = UiControl.ClientSize.Width; ControlHeight = UiControl.ClientSize.Height; }
private void GameForm_DeActivateActions(SDL.SDL_WindowEvent e) { AppActivated?.Invoke(this, EventArgs.Empty); isActive = false; }
static void ProcessWindowEvent(Sdl2NativeWindow window, SDL.SDL_WindowEvent e) { switch (e.windowEvent) { case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_CLOSE: var close_args = new System.ComponentModel.CancelEventArgs(); window.Closing(window, close_args); if (!close_args.Cancel) { window.Closed(window, EventArgs.Empty); //window.DestroyWindow(); } break; case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_ENTER: window.MouseEnter(window, EventArgs.Empty); break; case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_LEAVE: window.MouseLeave(window, EventArgs.Empty); break; case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_EXPOSED: // do nothing break; case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_GAINED: window.is_focused = true; window.FocusedChanged(window, EventArgs.Empty); break; case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_FOCUS_LOST: window.is_focused = false; window.FocusedChanged(window, EventArgs.Empty); break; case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_HIDDEN: window.is_visible = false; window.VisibleChanged(window, EventArgs.Empty); break; case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_SHOWN: window.is_visible = true; window.VisibleChanged(window, EventArgs.Empty); break; case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_MAXIMIZED: window.previous_window_state = window.window_state; window.window_state = OpenTK.WindowState.Maximized; window.WindowStateChanged(window, EventArgs.Empty); break; case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_MINIMIZED: window.previous_window_state = window.window_state; window.window_state = OpenTK.WindowState.Minimized; window.WindowStateChanged(window, EventArgs.Empty); break; case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_RESTORED: window.window_state = window.previous_window_state; window.WindowStateChanged(window, EventArgs.Empty); break; case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_MOVED: window.Move(window, EventArgs.Empty); break; case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_RESIZED: case SDL.SDL_WindowEventID.SDL_WINDOWEVENT_SIZE_CHANGED: window.Resize(window, EventArgs.Empty); break; default: Debug.Print("SDL2 unhandled event: {0}", e.type); break; } }
private void WindowOnResizeEndActions(SDL.SDL_WindowEvent sdlWindowEvent) { OnClientSizeChanged(window, EventArgs.Empty); }
public WindowResizedEventArgs(SDL.SDL_WindowEvent evt) { _evt = evt; }