Window

Single-Window class wrapping SDL_Window.

Constructors

this
this(string title = "D2DGame", uint flags = WindowFlags.Default, DynLibs dynamicLibs = DynLibs.all)

Creates a new centered window with specified title and flags on a 800x480 resolution.

this
this(int width, int height, string title = "D2DGame", uint flags = WindowFlags.Default, DynLibs dynamicLibs = DynLibs.all)

Creates a new centered window with specified dimensions, title and flags.

this
this(int x, int y, int width, int height, string title, uint flags = WindowFlags.Default, DynLibs dynamicLibs = DynLibs.all)

Creates a new window with specified parameters.

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Functions

close
void close()

Closes the window and invalidates it.

display
void display(ShaderProgram post = null)

Displays rendered content to the window.

dispose
void dispose()

Closes the window and invalidates it.

focus
void focus()

Raises the window to top and focuses it for input.

hide
void hide()

Hides the window.

maximize
void maximize()

Maximizes the window.

minimize
void minimize()

Minimizes the window.

pollEvent
bool pollEvent(ref WindowEvent event)

Polls a event from the stack and returns true if one was found.

quit
void quit()

Pushes WindowEvent.Quit to the event stack.

restore
void restore()

Restores the window state from minimized or maximized.

setIcon
void setIcon(Bitmap icon)

Sets the icon to a Btimap.

show
void show()

Shows the window if hidden.

Properties

height
int height [@property setter]

Dynamically sets the height of the window.

height
int height [@property getter]

Dynamically gets the height of the window.

maxHeight
int maxHeight [@property setter]

Dynamically sets the maximum height of the window.

maxHeight
int maxHeight [@property getter]

Dynamically gets the maximum height of the window.

maxWidth
int maxWidth [@property setter]

Dynamically sets the maximum width of the window.

maxWidth
int maxWidth [@property getter]

Dynamically gets the maximum width of the window.

minHeight
int minHeight [@property setter]

Dynamically sets the minimum height of the window.

minHeight
int minHeight [@property getter]

Dynamically gets the minimum height of the window.

minWidth
int minWidth [@property setter]

Dynamically sets the minimum width of the window.

minWidth
int minWidth [@property getter]

Dynamically gets the minimum width of the window.

open
bool open [@property getter]

Returns if the is still open.

texture
Texture texture [@property getter]

Texture containing rendered content.

title
string title [@property setter]

Dynamically sets the title of the window.

title
string title [@property getter]

Dynamically gets the title of the window.

valid
bool valid [@property getter]

Returns if the window is still open.

width
int width [@property setter]

Dynamically sets the width of the window.

width
int width [@property getter]

Dynamically gets the width of the window.

x
int x [@property setter]

Dynamically sets the x position of the window.

x
int x [@property getter]

Dynamically gets the x position of the window.

y
int y [@property setter]

Dynamically sets the y position of the window.

y
int y [@property getter]

Dynamically gets the y position of the window.

Static variables

glContext
SDL_GLContext glContext;

Static variable to a SDL GL Context.

Examples

1 Window window = new Window(800, 600, "Unittest");
2 
3 assert(window.valid);
4 
5 assert(window.title == "Unittest");
6 window.title = "Window Title";
7 assert(window.title == "Window Title");
8 // Automatic conversion from c-strings to D-strings
9 
10 assert(window.width == 800);
11 
12 window.close();
13 assert(!window.valid);

Meta