Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

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

    GameWindow Class

    Namespace: Stride.Games
    Assembly: Stride.Games.dll

    An abstract window.

    System.Object → DisposeBase → ComponentBase → GameWindow
    Derived from GameWindow: GameWindow<TK>

    public abstract class GameWindow : ComponentBase, IDisposable, IComponent, IReferencable, ICollectorHolder
    Name Description
    Fields
    IsActivated

    Indicate if the window is currently activated.

    Properties
    AllowUserResizing

    Gets or sets, user possibility to resize this window.

    ClientBounds

    Gets the client bounds.

    CurrentOrientation

    Gets the current orientation.

    Focused

    Gets a value indicating whether this instance is in focus.

    FullscreenIsBorderlessWindow

    Whether the fullscreen mode should be a borderless window matching the desktop size.

    IsBorderLess

    Gets or sets a value indicating whether this window has a border

    IsFullscreen

    Switches between fullscreen and windowed mode.

    IsMinimized

    Gets a value indicating whether this instance is minimized.

    IsMouseVisible

    Gets or sets a value indicating whether the mouse pointer is visible over this window.

    NativeWindow

    Gets the native window.

    Position

    Gets or sets the position of the window on the screen.

    PreferredFullscreenSize

    The size the window should have when switching from windowed to fullscreen mode. To get the current actual size use ClientBounds.

    PreferredWindowedSize

    The size the window should have when switching from fullscreen to windowed mode. To get the current actual size use ClientBounds. This gets overwritten when the user resizes the window.

    Title

    Gets or sets the title of the window.

    Visible

    Gets or sets a value indicating whether this GameWindow is visible.

    Methods
    BeginScreenDeviceChange(Boolean)
    CreateUserManagedMessageLoop()
    EndScreenDeviceChange()
    EndScreenDeviceChange(Int32, Int32)
    Initialize(GameContext)
    OnActivated(Object, EventArgs)
    OnClientSizeChanged(Object, EventArgs)
    OnClosing(Object, EventArgs)
    OnDeactivated(Object, EventArgs)
    OnFullscreenToggle(Object, EventArgs)
    OnOrientationChanged(Object, EventArgs)
    SetSize(Int2)

    Sets the size of the client area and triggers the ClientSizeChanged event. This will trigger a backbuffer resize too.

    SetSupportedOrientations(DisplayOrientation)
    SetTitle(String)
    Events
    Activated

    Occurs when this window is activated.

    ClientSizeChanged

    Occurs when device client size is changed.

    Closing

    Occurs before the window gets destroyed.

    Deactivated

    Occurs when this window is deactivated.

    FullscreenChanged

    Occurs when device fullscreen mode is changed.

    OrientationChanged

    Occurs when device orientation is changed.

    | Improve this Doc View Source

    Fields


    IsActivated

    Indicate if the window is currently activated.

    public bool IsActivated
    Field Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Properties


    AllowUserResizing

    Gets or sets, user possibility to resize this window.

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

    ClientBounds

    Gets the client bounds.

    public abstract Rectangle ClientBounds { get; }
    Property Value
    Type Description
    Rectangle

    The client bounds.


    CurrentOrientation

    Gets the current orientation.

    public abstract DisplayOrientation CurrentOrientation { get; }
    Property Value
    Type Description
    DisplayOrientation

    The current orientation.


    Focused

    Gets a value indicating whether this instance is in focus.

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

    true if this instance is in focus; otherwise, false.


    FullscreenIsBorderlessWindow

    Whether the fullscreen mode should be a borderless window matching the desktop size.

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

    This flag is currently ignored on all game platforms other than SDL.


    IsBorderLess

    Gets or sets a value indicating whether this window has a border

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

    true if this window has a border; otherwise, false.


    IsFullscreen

    Switches between fullscreen and windowed mode.

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

    IsMinimized

    Gets a value indicating whether this instance is minimized.

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

    true if this instance is minimized; otherwise, false.


    IsMouseVisible

    Gets or sets a value indicating whether the mouse pointer is visible over this window.

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

    true if this instance is mouse visible; otherwise, false.


    NativeWindow

    Gets the native window.

    public abstract WindowHandle NativeWindow { get; }
    Property Value
    Type Description
    WindowHandle

    The native window.


    Position

    Gets or sets the position of the window on the screen.

    public virtual Int2 Position { get; set; }
    Property Value
    Type Description
    Int2

    PreferredFullscreenSize

    The size the window should have when switching from windowed to fullscreen mode. To get the current actual size use ClientBounds.

    public Int2 PreferredFullscreenSize { get; set; }
    Property Value
    Type Description
    Int2

    PreferredWindowedSize

    The size the window should have when switching from fullscreen to windowed mode. To get the current actual size use ClientBounds. This gets overwritten when the user resizes the window.

    public Int2 PreferredWindowedSize { get; set; }
    Property Value
    Type Description
    Int2

    Title

    Gets or sets the title of the window.

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

    Visible

    Gets or sets a value indicating whether this GameWindow is visible.

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

    true if visible; otherwise, false.

    | Improve this Doc View Source

    Methods


    BeginScreenDeviceChange(Boolean)

    public abstract void BeginScreenDeviceChange(bool willBeFullScreen)
    Parameters
    Type Name Description
    System.Boolean willBeFullScreen

    CreateUserManagedMessageLoop()

    public virtual IMessageLoop CreateUserManagedMessageLoop()
    Returns
    Type Description
    IMessageLoop

    EndScreenDeviceChange()

    public void EndScreenDeviceChange()

    EndScreenDeviceChange(Int32, Int32)

    public abstract void EndScreenDeviceChange(int clientWidth, int clientHeight)
    Parameters
    Type Name Description
    System.Int32 clientWidth
    System.Int32 clientHeight

    Initialize(GameContext)

    protected abstract void Initialize(GameContext gameContext)
    Parameters
    Type Name Description
    GameContext gameContext

    OnActivated(Object, EventArgs)

    protected void OnActivated(object source, EventArgs e)
    Parameters
    Type Name Description
    System.Object source
    System.EventArgs e

    OnClientSizeChanged(Object, EventArgs)

    protected void OnClientSizeChanged(object source, EventArgs e)
    Parameters
    Type Name Description
    System.Object source
    System.EventArgs e

    OnClosing(Object, EventArgs)

    protected void OnClosing(object source, EventArgs e)
    Parameters
    Type Name Description
    System.Object source
    System.EventArgs e

    OnDeactivated(Object, EventArgs)

    protected void OnDeactivated(object source, EventArgs e)
    Parameters
    Type Name Description
    System.Object source
    System.EventArgs e

    OnFullscreenToggle(Object, EventArgs)

    protected void OnFullscreenToggle(object source, EventArgs e)
    Parameters
    Type Name Description
    System.Object source
    System.EventArgs e

    OnOrientationChanged(Object, EventArgs)

    protected void OnOrientationChanged(object source, EventArgs e)
    Parameters
    Type Name Description
    System.Object source
    System.EventArgs e

    SetSize(Int2)

    Sets the size of the client area and triggers the ClientSizeChanged event. This will trigger a backbuffer resize too.

    public void SetSize(Int2 size)
    Parameters
    Type Name Description
    Int2 size

    SetSupportedOrientations(DisplayOrientation)

    protected abstract void SetSupportedOrientations(DisplayOrientation orientations)
    Parameters
    Type Name Description
    DisplayOrientation orientations

    SetTitle(String)

    protected abstract void SetTitle(string title)
    Parameters
    Type Name Description
    System.String title
    | Improve this Doc View Source

    Events


    Activated

    Occurs when this window is activated.

    public event EventHandler<EventArgs> Activated
    Event Type
    Type Description
    System.EventHandler<System.EventArgs>

    ClientSizeChanged

    Occurs when device client size is changed.

    public event EventHandler<EventArgs> ClientSizeChanged
    Event Type
    Type Description
    System.EventHandler<System.EventArgs>

    Closing

    Occurs before the window gets destroyed.

    public event EventHandler<EventArgs> Closing
    Event Type
    Type Description
    System.EventHandler<System.EventArgs>

    Deactivated

    Occurs when this window is deactivated.

    public event EventHandler<EventArgs> Deactivated
    Event Type
    Type Description
    System.EventHandler<System.EventArgs>

    FullscreenChanged

    Occurs when device fullscreen mode is changed.

    public event EventHandler<EventArgs> FullscreenChanged
    Event Type
    Type Description
    System.EventHandler<System.EventArgs>

    OrientationChanged

    Occurs when device orientation is changed.

    public event EventHandler<EventArgs> OrientationChanged
    Event Type
    Type Description
    System.EventHandler<System.EventArgs>

    Inherited Members

    ComponentBase.Tags
    ComponentBase.Name
    ComponentBase.Destroy()
    ComponentBase.ICollectorHolder.Collector
    ComponentBase.OnNameChanged()
    ComponentBase.ToString()
    DisposeBase.Dispose()
    DisposeBase.IsDisposed
    DisposeBase.IReferencable.ReferenceCount
    DisposeBase.IReferencable.AddReference()
    DisposeBase.IReferencable.Release()
    DisposeBase.OnAddReference()
    DisposeBase.OnReleaseReference()

    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