Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    Window Class

    Namespace: Stride.Graphics.SDL
    Assembly: Stride.Graphics.dll
    System.Object → Window
    Derived from Window: GameFormSDL

    public class Window : IDisposable
    Name Description
    Constructors
    Window(String)

    Initializes a new instance of the Window class with title as the title of the Window.

    Properties
    ClientRectangle

    Size of client area expressed as a rectangle.

    ClientSize

    Size of the client area of a window.

    Exists

    Is the Window still alive?

    Focused

    Is current window focused?

    FormBorderStyle

    Style of border. Currently can only be Sizable or FixedSingle.

    FullscreenIsBorderlessWindow

    Gets or sets a value indicating whether fullscreen mode should be a borderless window matching the desktop size. Decides whether to set the SDL_WINDOW_FULLSCREEN_DESKTOP (fake fullscreen) or SDL_WINDOW_FULLSCREEN (real fullscreen) flag.

    Handle

    Platform specific handle for Window:

    • On Windows: the HWND of the window
    • On Unix: the Window ID (XID). Note that on Unix, the value is 32-bit (See X11/X.h for the typedef of XID).
    IsDisposed

    Have we already disposed of the current object?

    IsFullScreen

    Are we showing the window in full screen mode?

    Location

    Coordinates of the top-left corner of the window in screen coordinate.

    MaximizeBox

    Does current window offer a maximize button?

    MinimizeOnFocusLoss

    Minimize the window when focus is lost in fullscreen, default is false.

    MousePosition

    Get the mouse position on screen.

    RelativeCursorPosition

    Get the coordinate of the mouse in Window coordinates

    SdlHandle

    The SDL window handle.

    Size

    Size of window.

    Text

    Text of the title of the Window.

    TopMost

    Make the window topmost

    Visible

    Is current window visible?

    WindowState

    State of the window which can be either of Normal, Maximized or Minimized.

    Methods
    BringToFront()

    Move window to front.

    Dispose()
    Dispose(Boolean)

    Dispose of current Window.

    Finalize()
    ProcessEvent(SDL.SDL_Event)

    Process events for the current window

    SendToBack()

    Move window to back.

    SetRelativeMouseMode(Boolean)
    Show()

    Show window. The first time a window is shown we execute any actions from .

    Events
    ActivateActions
    CloseActions
    DeActivateActions
    Disposed

    Actions to be called when we dispose of current.

    DropFileActions
    FingerMoveActions
    FingerPressActions
    FingerReleaseActions
    FocusGainedActions
    FocusLostActions
    JoystickDeviceAdded
    JoystickDeviceRemoved
    KeyDownActions
    KeyUpActions
    MaximizedActions
    MinimizedActions
    MouseEnterActions
    MouseLeaveActions
    MouseMoveActions
    MouseWheelActions
    PointerButtonPressActions
    PointerButtonReleaseActions
    ResizeBeginActions
    ResizeEndActions
    RestoredActions
    TextEditingActions
    TextInputActions
    | Improve this Doc View Source

    Constructors


    Window(String)

    Initializes a new instance of the Window class with title as the title of the Window.

    public Window(string title)
    Parameters
    Type Name Description
    System.String title

    Title of the window, see Text property.

    | Improve this Doc View Source

    Properties


    ClientRectangle

    Size of client area expressed as a rectangle.

    public Rectangle ClientRectangle { get; set; }
    Property Value
    Type Description
    Rectangle

    ClientSize

    Size of the client area of a window.

    public Size2 ClientSize { get; set; }
    Property Value
    Type Description
    Size2

    Exists

    Is the Window still alive?

    public bool Exists { get; }
    Property Value
    Type Description
    System.Boolean

    Focused

    Is current window focused?

    public bool Focused { get; }
    Property Value
    Type Description
    System.Boolean

    FormBorderStyle

    Style of border. Currently can only be Sizable or FixedSingle.

    public FormBorderStyle FormBorderStyle { get; set; }
    Property Value
    Type Description
    FormBorderStyle

    FullscreenIsBorderlessWindow

    Gets or sets a value indicating whether fullscreen mode should be a borderless window matching the desktop size. Decides whether to set the SDL_WINDOW_FULLSCREEN_DESKTOP (fake fullscreen) or SDL_WINDOW_FULLSCREEN (real fullscreen) flag.

    public bool FullscreenIsBorderlessWindow { get; set; }
    Property Value
    Type Description
    System.Boolean

    Handle

    Platform specific handle for Window:

    • On Windows: the HWND of the window
    • On Unix: the Window ID (XID). Note that on Unix, the value is 32-bit (See X11/X.h for the typedef of XID).
    public IntPtr Handle { get; }
    Property Value
    Type Description
    System.IntPtr

    IsDisposed

    Have we already disposed of the current object?

    public bool IsDisposed { get; }
    Property Value
    Type Description
    System.Boolean

    IsFullScreen

    Are we showing the window in full screen mode?

    public bool IsFullScreen { get; set; }
    Property Value
    Type Description
    System.Boolean

    Location

    Coordinates of the top-left corner of the window in screen coordinate.

    public Point Location { get; set; }
    Property Value
    Type Description
    Point

    MaximizeBox

    Does current window offer a maximize button?

    public bool MaximizeBox { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    Setter is not implemented on SDL, since we do have callers, for the time being, the code does nothing instead of throwing an exception.


    MinimizeOnFocusLoss

    Minimize the window when focus is lost in fullscreen, default is false.

    public bool MinimizeOnFocusLoss { get; set; }
    Property Value
    Type Description
    System.Boolean

    MousePosition

    Get the mouse position on screen.

    public static Point MousePosition { get; }
    Property Value
    Type Description
    Point

    RelativeCursorPosition

    Get the coordinate of the mouse in Window coordinates

    public Point RelativeCursorPosition { get; set; }
    Property Value
    Type Description
    Point

    SdlHandle

    The SDL window handle.

    public IntPtr SdlHandle { get; }
    Property Value
    Type Description
    System.IntPtr

    Size

    Size of window.

    public Size2 Size { get; set; }
    Property Value
    Type Description
    Size2

    Text

    Text of the title of the Window.

    public string Text { get; set; }
    Property Value
    Type Description
    System.String

    TopMost

    Make the window topmost

    public bool TopMost { get; set; }
    Property Value
    Type Description
    System.Boolean

    Visible

    Is current window visible?

    public bool Visible { get; set; }
    Property Value
    Type Description
    System.Boolean

    WindowState

    State of the window which can be either of Normal, Maximized or Minimized.

    public FormWindowState WindowState { get; set; }
    Property Value
    Type Description
    FormWindowState
    | Improve this Doc View Source

    Methods


    BringToFront()

    Move window to front.

    public virtual void BringToFront()

    Dispose()

    public void Dispose()

    Dispose(Boolean)

    Dispose of current Window.

    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    If false we are being called from the Finalizer.


    Finalize()

    protected void Finalize()

    ProcessEvent(SDL.SDL_Event)

    Process events for the current window

    public virtual void ProcessEvent(SDL.SDL_Event e)
    Parameters
    Type Name Description
    SDL2.SDL.SDL_Event e

    SendToBack()

    Move window to back.

    public virtual void SendToBack()

    SetRelativeMouseMode(Boolean)

    public void SetRelativeMouseMode(bool enabled)
    Parameters
    Type Name Description
    System.Boolean enabled

    Show()

    Show window. The first time a window is shown we execute any actions from .

    public void Show()
    | Improve this Doc View Source

    Events


    ActivateActions

    public event Window.WindowEventDelegate ActivateActions
    Event Type
    Type Description
    Window.WindowEventDelegate

    CloseActions

    public event Window.NotificationDelegate CloseActions
    Event Type
    Type Description
    Window.NotificationDelegate

    DeActivateActions

    public event Window.WindowEventDelegate DeActivateActions
    Event Type
    Type Description
    Window.WindowEventDelegate

    Disposed

    Actions to be called when we dispose of current.

    public event EventHandler Disposed
    Event Type
    Type Description
    System.EventHandler

    DropFileActions

    public event Window.DropEventDelegate DropFileActions
    Event Type
    Type Description
    Window.DropEventDelegate

    FingerMoveActions

    public event Window.TouchFingerDelegate FingerMoveActions
    Event Type
    Type Description
    Window.TouchFingerDelegate

    FingerPressActions

    public event Window.TouchFingerDelegate FingerPressActions
    Event Type
    Type Description
    Window.TouchFingerDelegate

    FingerReleaseActions

    public event Window.TouchFingerDelegate FingerReleaseActions
    Event Type
    Type Description
    Window.TouchFingerDelegate

    FocusGainedActions

    public event Window.WindowEventDelegate FocusGainedActions
    Event Type
    Type Description
    Window.WindowEventDelegate

    FocusLostActions

    public event Window.WindowEventDelegate FocusLostActions
    Event Type
    Type Description
    Window.WindowEventDelegate

    JoystickDeviceAdded

    public event Window.JoystickDeviceChangedDelegate JoystickDeviceAdded
    Event Type
    Type Description
    Window.JoystickDeviceChangedDelegate

    JoystickDeviceRemoved

    public event Window.JoystickDeviceChangedDelegate JoystickDeviceRemoved
    Event Type
    Type Description
    Window.JoystickDeviceChangedDelegate

    KeyDownActions

    public event Window.KeyDelegate KeyDownActions
    Event Type
    Type Description
    Window.KeyDelegate

    KeyUpActions

    public event Window.KeyDelegate KeyUpActions
    Event Type
    Type Description
    Window.KeyDelegate

    MaximizedActions

    public event Window.WindowEventDelegate MaximizedActions
    Event Type
    Type Description
    Window.WindowEventDelegate

    MinimizedActions

    public event Window.WindowEventDelegate MinimizedActions
    Event Type
    Type Description
    Window.WindowEventDelegate

    MouseEnterActions

    public event Window.WindowEventDelegate MouseEnterActions
    Event Type
    Type Description
    Window.WindowEventDelegate

    MouseLeaveActions

    public event Window.WindowEventDelegate MouseLeaveActions
    Event Type
    Type Description
    Window.WindowEventDelegate

    MouseMoveActions

    public event Window.MouseMoveDelegate MouseMoveActions
    Event Type
    Type Description
    Window.MouseMoveDelegate

    MouseWheelActions

    public event Window.MouseWheelDelegate MouseWheelActions
    Event Type
    Type Description
    Window.MouseWheelDelegate

    PointerButtonPressActions

    public event Window.MouseButtonDelegate PointerButtonPressActions
    Event Type
    Type Description
    Window.MouseButtonDelegate

    PointerButtonReleaseActions

    public event Window.MouseButtonDelegate PointerButtonReleaseActions
    Event Type
    Type Description
    Window.MouseButtonDelegate

    ResizeBeginActions

    public event Window.WindowEventDelegate ResizeBeginActions
    Event Type
    Type Description
    Window.WindowEventDelegate

    ResizeEndActions

    public event Window.WindowEventDelegate ResizeEndActions
    Event Type
    Type Description
    Window.WindowEventDelegate

    RestoredActions

    public event Window.WindowEventDelegate RestoredActions
    Event Type
    Type Description
    Window.WindowEventDelegate

    TextEditingActions

    public event Window.TextEditingDelegate TextEditingActions
    Event Type
    Type Description
    Window.TextEditingDelegate

    TextInputActions

    public event Window.TextInputDelegate TextInputActions
    Event Type
    Type Description
    Window.TextInputDelegate

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation