Window

Window is the rendering window where all drawable objects are drawn.

Note that the default clear-color is <code>Color.White</code> and the default VerticalSync is <code>Window.VerticalSync.Disable</code>, which means the Applications runs with full FPS.

struct Window {
enum uint FullScreenMask;
}

Constructors

this
this(uint width, uint height, string title, uint style = Style.Default, const GLContextSettings gl = GLContextSettings.init)

CTor Position of the Window is default 100x, 100y and the VerticalSync is disabled

this
this(const DisplayMode mode, string title, uint style = Style.Default, const GLContextSettings gl = GLContextSettings.init)

CTor Position is at 100x, 100y and the VerticalSync is enabled, if mode.refreshRate > 0

this
this(const Rect view, string title, uint style = Style.Default, const GLContextSettings gl = GLContextSettings.init)

CTor Position is specifiable and the VerticalSync is disabled

Destructor

~this
~this()

DTor

Postblit

this(this)
@disable this(this)

Postblit is disabled

Copying this object is disabled.

Members

Enums

Style
enum Style

The specific window styles

VerticalSync
enum VerticalSync

The Window syncronisation mode. Default VerticalSyncronisation is <code>VerticalSync.Enable</code>.

Functions

capture
Surface capture(Texture.Format fmt = Texture.Format.BGRA)

Capture the pixel data of the current window and returns a Surface with this pixel data. You can also alter the format of the pixel data. Default is <code>Texture.Format.BGRA</code>. This method is predestinated for screenshots.

clear
void clear()

Clears the screen with the color you specified in setClearColor

display
void display()

Make all changes visible on screen

draw
void draw(Drawable d)

Draw a drawable object on screen

getDisplayIndex
int getDisplayIndex()

Returns the index of the display which contains the center of the window

getDisplayMode
DisplayMode getDisplayMode()

Returns the DisplayMode when the Window is visible at fullscreen.

getDrawableSize
Size getDrawableSize()

Returns the size of the underlying drawable area (e.g. for use with glViewport). This method may only differ from getSize if you are using High-DPI.

getMaximumSize
Size getMaximumSize()

Returns the maximum Size of the Window

getMinimumSize
Size getMinimumSize()

Returns the minimum Size of the Window

getPosition
Vector2i getPosition()

Returns the current position of the window.

getSize
Size getSize()

Returns the size (width and height) of the Window

getStyle
uint getStyle()

Returns the Window Style.

getTitle
string getTitle()

Returns the current title of the window.

getVerticalSync
VerticalSync getVerticalSync()

Returns the current syncronisation mode.

hasEvent
bool hasEvent(Event.Type type)
hasKeyboardFocus
bool hasKeyboardFocus()

Returns if the keyboard focus is on this window.

hasMouseFocus
bool hasMouseFocus()

Returns if the mouse focus is on this window.

hasQuitEvent
bool hasQuitEvent()
isFullscreen
bool isFullscreen()

Returns, if this Window is in fullscreen mode.

loadProjection
void loadProjection()

Load the projection Matrix, so that any change / transformation of the Matrix will now be visible

maximize
void maximize()

*Make the window as large as possible.

minimize
void minimize()

Minimize the Window to an iconic representation.

poll
bool poll(Event* event)

Update the parameter event and set the data of the current event in it.

push
bool push(Event.Type type)

Push an event of the given type inside the Event queue.

raise
void raise()

Raises the Window above other Windows and set the input focus.

restore
void restore()

Restore the size and position, if the Window is minimized or maximized.

setBorder
void setBorder(bool enable)

Set the border state of the Window.

setClearColor
void setClearColor(const Color4b col)

Set the color which this windows use to clear the buffer. This is also the background color of the window.

setDisplayMode
void setDisplayMode(const DisplayMode mode)

Set the DisplayMode when the Window is visible at fullscreen.

setFullscreen
bool setFullscreen(uint style, bool adaptProjection = true)

Use this function to (re)set Window's fullscreen states.

setIcon
void setIcon(ref Surface srfc)

Set an icon for this window.

setMaximumSize
void setMaximumSize(uint width, uint height)

Set the maximum Size of the Window

setMaximumSize
void setMaximumSize(const Size size)

Set the maximum Size of the Window

setMinimumSize
void setMinimumSize(uint width, uint height)

Set the minimum Size for the Window

setMinimumSize
void setMinimumSize(const Size size)

Set the minimum Size for the Window

setPosition
void setPosition(int x, int y)

Set a new position to this window

setPosition
void setPosition(const Vector2i vec)

Set a new position to this window

setSize
void setSize(uint width, uint height)

Set a new size to this window

setSize
void setSize(const Size size)

Set a new size to this window

setTitle
string setTitle(string title)

Set a new title to this window

setVerticalSync
bool setVerticalSync(VerticalSync sync)

Set the VerticalSyncronisation mode of this window. Default VerticalSyncronisation is <code>VerticalSync.Enable</code>.

toggleFullscreen
void toggleFullscreen(bool adaptProjection = true)

Toggle between Fullscreen and windowed mode, depending on the current state.

wait
bool wait(Event* event, int timeout = -1)

Waits for the given Event. If the second parameter is greater then -1, it waits maximal timeout milliseconds.

Variables

projection
Matrix4x4 projection;

The current projection Matrix

Meta

Authors

Randy Schuett (rswhite4@googlemail.com)