Class Window
Represents a window that can be rendered to.
public sealed class Window : IDisposable
- Inheritance
-
Window
- Implements
- Inherited Members
Properties
Borderless
If true, the window should not have a border.
public bool Borderless { get; set; }
Property Value
- bool
- Represents a window that can be rendered to.
Remarks
This is not the same as BorderlessFullscreen.
CursorMode
Get or set the window CursorMode.
public CursorMode CursorMode { get; set; }
Property Value
- CursorMode
- Represents a window that can be rendered to.
Exceptions
Focused
If true, the window should be the window manager's currently focused window, and the window is ready to accept input from the user.
public bool Focused { get; }
Property Value
- bool
- Represents a window that can be rendered to.
FramebufferSize
Get the size of the window in pixels. NOTE: This is NOT the same as Size, and you should use this property when performing actions such as resizing the swapchain.
public Size FramebufferSize { get; }
Property Value
- Size
- Represents a window that can be rendered to.
FullscreenMode
Get or set the window FullscreenMode.
public FullscreenMode FullscreenMode { get; set; }
Property Value
- FullscreenMode
- Represents a window that can be rendered to.
Exceptions
Handle
The SDL window handle.
public nint Handle { get; }
Property Value
- nint
- Represents a window that can be rendered to.
Position
Get or set the window position.
public Point Position { get; set; }
Property Value
- Point
- Represents a window that can be rendered to.
Resizable
If true, the window should able to be resized.
public bool Resizable { get; set; }
Property Value
- bool
- Represents a window that can be rendered to.
Size
The size, in screen coordinates, of the window.
public Size Size { get; set; }
Property Value
- Size
- Represents a window that can be rendered to.
Title
Get or set the title of the window.
public string Title { get; set; }
Property Value
- string
- Represents a window that can be rendered to.
Visible
Get/set the window visibility. Making the window invisible should also remove it from the taskbar.
public bool Visible { get; set; }
Property Value
- bool
- Represents a window that can be rendered to.
Methods
Center()
Centers the window on the primary monitor.
public void Center()
CreateGraphicsDevice(GraphicsDeviceOptions?)
Creates a GraphicsDevice from this window.
public GraphicsDevice CreateGraphicsDevice(GraphicsDeviceOptions? options = null)
Parameters
options
GraphicsDeviceOptions?The GraphicsDeviceOptions to use on creation, if any.
Returns
- GraphicsDevice
The created GraphicsDevice.
Dispose()
Dispose of this window.
public void Dispose()
Focus()
Focus the window if it is not focused, bringing it to the front if necessary.
public void Focus()
Maximize()
Maximises the window, restoring it if necessary.
public void Maximize()
Minimize()
Minimises the window.
public void Minimize()
PollEvent(out IWindowEvent)
Poll the next window event, if there are any remaining.
public bool PollEvent(out IWindowEvent @event)
Parameters
event
IWindowEventThe polled window event.
Returns
- bool
True if an event was processed, false otherwise.
PollEvents()
Polls events and returns it as an IEnumerable. This method simply calls PollEvent(out IWindowEvent) under the hood, but is a more "C# friendly" way of doing things.
public IEnumerable<IWindowEvent> PollEvents()
Returns
- IEnumerable<IWindowEvent>
An IEnumerable<T> of events.
Restore()
Restores the window to its initial state, before it was minimised.
public void Restore()
WaitEvent(out IWindowEvent)
public bool WaitEvent(out IWindowEvent @event)
Parameters
event
IWindowEvent- Represents a window that can be rendered to.
Returns
- bool
- Represents a window that can be rendered to.
WaitEvent(out IWindowEvent, int)
public bool WaitEvent(out IWindowEvent @event, int timeout)
Parameters
event
IWindowEvent- Represents a window that can be rendered to.
timeout
int- Represents a window that can be rendered to.
Returns
- bool
- Represents a window that can be rendered to.