Dgame.Window.Window

« Go back

Bottom


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

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

Author:
Randy Schuett (rswhite4@googlemail.com)

enum VerticalSync: byte;
The Window syncronisation mode. Default VerticalSyncronisation is VerticalSync.Enable.

Enable
VerticalSync is enabled

Disable
VerticalSync is disabled

LateSwapTearing
For late swap tearing

enum Style: int;
The specific window styles

Default
Default is Shown

Fullscreen
Window is fullscreened

Desktop
Window has Desktop Fullscreen

Shown
Show the Window immediately

Hidden
Hide the Window immediately

Borderless
The Window has no border

Resizeable
Window is resizeable

Maximized
Maximize the Window immediately

Minimized
Minimize the Window immediately

InputGrabbed
Grab the input inside the window

InputFocus
The Window has input (keyboard) focus

MouseFocus
The Window has mouse focus

MouseCapture
window has mouse captured (unrelated to InputGrabbed)

AllowHighDPI
Window should be created in high-DPI mode if supported

Matrix4x4 projection;
The current projection Matrix

Note:
This is intended for advanced users only.

See:
Matrix4x4

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(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(const Rect view, string title, uint style = Style.Default, const GLContextSettings gl = GLContextSettings.init);
CTor Position is specifiable and the VerticalSync is disabled

const nothrow @nogc void loadProjection();
Load the projection Matrix, so that any change / transformation of the Matrix will now be visible

const nothrow @nogc 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.

const nothrow @nogc void clear();
Clears the screen with the color you specified in setClearColor

const nothrow @nogc bool setVerticalSync(VerticalSync sync);
Set the VerticalSyncronisation mode of this window. Default VerticalSyncronisation is VerticalSync.Enable.

See:
VerticalSync enum

Returns if the sync mode is supported.

nothrow @nogc VerticalSync getVerticalSync();
Returns the current syncronisation mode.

See:
VerticalSync enum

nothrow @nogc 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 Texture.Format.BGRA. This method is predestinated for screenshots.

Example:
Window wnd = ...
...
wnd.capture().saveToFile("samples/img/screenshot.png");


nothrow @nogc void restore();
Restore the size and position, if the Window is minimized or maximized.

nothrow @nogc void raise();
Raises the Window above other Windows and set the input focus.

nothrow @nogc void maximize();
Make the window as large as possible.

nothrow @nogc void minimize();
Minimize the Window to an iconic representation.

nothrow @nogc void setBorder(bool enable);
Set the border state of the Window.

const nothrow @nogc bool hasKeyboardFocus();
Returns if the keyboard focus is on this window.

const nothrow @nogc bool hasMouseFocus();
Returns if the mouse focus is on this window.

nothrow @nogc void setPosition(int x, int y);
Set a new position to this window

nothrow @nogc void setPosition(const Vector2i vec);
Set a new position to this window

nothrow @nogc Vector2i getPosition();
Returns the current position of the window.

nothrow @nogc void setSize(uint width, uint height);
Set a new size to this window

nothrow @nogc void setSize(const Size size);
Set a new size to this window

nothrow @nogc Size getSize();
Returns the size (width and height) of the Window

nothrow @nogc 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.

nothrow @nogc void setMinimumSize(uint width, uint height);
Set the minimum Size for the Window

nothrow @nogc void setMinimumSize(const Size size);
Set the minimum Size for the Window

nothrow @nogc Size getMinimumSize();
Returns the minimum Size of the Window

nothrow @nogc void setMaximumSize(uint width, uint height);
Set the maximum Size of the Window

nothrow @nogc void setMaximumSize(const Size size);
Set the maximum Size of the Window

nothrow @nogc Size getMaximumSize();
Returns the maximum Size of the Window

nothrow @nogc uint getStyle();
Returns the Window Style.

See:
Style enum

const nothrow @nogc bool poll(Event* event);
Update the parameter event and set the data of the current event in it.

Returns:
true, if there was a valid event and false if not.

const nothrow @nogc 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.

const nothrow @nogc bool push(Event.Type type);
Push an event of the given type inside the Event queue.

Returns:
if the push was successfull or not.

const nothrow @nogc bool hasEvent(Event.Type type);
Returns:
if inside of the Event Queue is an Event of the given type.

const nothrow @nogc bool hasQuitEvent();
Returns:
if the current Event queue has the Quit Event.

const nothrow @nogc void draw(Drawable d);
Draw a drawable object on screen

nothrow @nogc void display();
Make all changes visible on screen

nothrow @nogc string getTitle();
Returns the current title of the window.

nothrow @nogc string setTitle(string title);
Set a new title to this window

Returns:
the old title

@nogc void setIcon(ref Surface srfc);
Set an icon for this window.

nothrow @nogc int getDisplayIndex();
Returns the index of the display which contains the center of the window

Note:
If something went wrong (e.g. your Window is invalid), a negative value is returned

nothrow @nogc void setDisplayMode(const DisplayMode mode);
Set the DisplayMode when the Window is visible at fullscreen.

nothrow @nogc DisplayMode getDisplayMode();
Returns the DisplayMode when the Window is visible at fullscreen.

nothrow @nogc bool setFullscreen(uint style, bool adaptProjection = true);
Use this function to (re)set Window's fullscreen states.

style may be Style.Fullscreen for "real" fullscreen with a display mode change or Style.Desktop for "fake" fullscreen that takes the size of the desktop Use 0 for windowed mode.

if adaptProjection is true (which is the default) the projection will automatically adapted. set it to false if you want to specify your own projection afterwards.

nothrow @nogc void toggleFullscreen(bool adaptProjection = true);
Toggle between Fullscreen and windowed mode, depending on the current state.

if adaptProjection is true (which is the default) the projection will automatically adapted. set it to false if you want to specify your own projection afterwards.

nothrow @nogc bool isFullscreen();
Returns, if this Window is in fullscreen mode.


Page generated by Ddoc.

» Dgame.Window.Window on Github

Top

« Go back