Window

Single-Window class wrapping SDL_Window.

Constructors

this
this(string title, uint flags)

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

this
this(int width, int height, string title, uint flags)

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)

Creates a new window with specified parameters.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

bind
void bind()
Undocumented in source. Be warned that the author may not have intended to support it.
close
void close()

Closes the window and invalidates it.

create
void create(int width, int height)
Undocumented in source. Be warned that the author may not have intended to support it.
display
void display(ShaderProgram post)

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(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.

resize
void resize(int width, int height)
Undocumented in source. Be warned that the author may not have intended to support it.
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.

Inherited Members

From IVerifiable

valid
bool valid [@property getter]

Function for checking if this is valid.

From IDisposable

dispose
void dispose()

Function for deallocating memory. Should be called in destructor.

From IRenderTarget

bind
void bind()

Set active container.

resize
void resize(int width, int height)

Resize the container texture to the new width and height.

create
void create(int width, int height)

Create a container texture in the given resolution.

clear
void clear(float r, float g, float b)

Clears the container texture by calling bind() -> glClearColor(r, g, b, 1) -> glClear(GL_COLOR_BUFFER_BIT).

draw
void draw(IDrawable drawable, ShaderProgram shader)

Draws drawable using optional shader onto this. This will call drawable.draw(this, shader); If shader is null, ShaderProgram.default is gonna be used.

draw
void draw(Mesh mesh, ShaderProgram shader)

Draws raw geometry to the container texture using an optional shader. If shader is null, ShaderProgram.default is gonna be used.

texture
Texture texture [@property getter]

Returns the result of the container texture.

Examples

Window window = new Window(800, 600, "Unittest");

assert(window.valid);

assert(window.title == "Unittest");
window.title = "Window Title";
assert(window.title == "Window Title");
// Automatic conversion from c-strings to D-strings

assert(window.width == 800);

window.close();
assert(!window.valid);

Meta