Window

Window that serves as a target for OpenGL rendering.

Window is the main class of the Window module.

It defines an OS window that is able to receive an OpenGL rendering.

A Window can create its own new window, or be embedded into an already existing control using the create(handle) function. This can be useful for embedding an OpenGL rendering area into a view which is part of a bigger GUI with existing windows, controls, etc. It can also serve as embedding an OpenGL rendering area into a window created by another (probably richer) GUI library like Qt or wxWidgets.

The Window class provides a simple interface for manipulating the window: move, resize, show/hide, control mouse cursor, etc. It also provides event handling through its pollEvent() and waitEvent() functions.

Note that OpenGL experts can pass their own parameters (antialiasing level, bits for the depth and stencil buffers, etc.) to the OpenGL context attached to the window, with the ContextSettings structure which is passed as an optional argument when creating the window.

Constructors

this
this()
Undocumented in source.
this
this(int )
Undocumented in source.
this
this(VideoMode mode, immutable(T)[] title, Style style, const(ContextSettings) settings)

Construct a new window.

this
this(WindowHandle handle, const(ContextSettings) settings)

Construct the window from an existing control.

Destructor

~this
~this()
Undocumented in source.

Members

Enums

Style
enum Style
Undocumented in source.

Functions

close
void close()

Close the window and destroy all the attached resources.

create
void create(VideoMode mode, string title, Style style, const(ContextSettings) settings)

Create (or recreate) the window.

create
void create(VideoMode mode, wstring title, Style style, const(ContextSettings) settings)

Create (or recreate) the window.

create
void create(VideoMode mode, dstring title, Style style, const(ContextSettings) settings)

Create (or recreate) the window.

create
void create(WindowHandle handle, const(ContextSettings) settings)

Create (or recreate) the window from an existing control.

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

Display on screen what has been rendered to the window so far.

getMousePosition
Vector2i getMousePosition()
Undocumented in source. Be warned that the author may not have intended to support it.
getSettings
ContextSettings getSettings()

Get the settings of the OpenGL context of the window.

getSystemHandle
WindowHandle getSystemHandle()

Get the OS-specific handle of the window.

isOpen
bool isOpen()

Tell whether or not the window is open.

mouse_SetPosition
void mouse_SetPosition(Vector2i pos)
Undocumented in source. Be warned that the author may not have intended to support it.
mouse_getPosition
Vector2i mouse_getPosition()
Undocumented in source. Be warned that the author may not have intended to support it.
pollEvent
bool pollEvent(Event event)

Pop the event on top of the event queue, if any, and return it.

setActive
bool setActive(bool active)

Activate or deactivate the window as the current target for OpenGL rendering.

setFramerateLimit
void setFramerateLimit(uint limit)

Limit the framerate to a maximum fixed frequency.

setIcon
void setIcon(uint width, uint height, const(ubyte[]) pixels)

Change the window's icon.

setJoystickThreshhold
void setJoystickThreshhold(float threshhold)

Change the joystick threshold.

setKeyRepeatEnabled
void setKeyRepeatEnabled(bool enabled)

Enable or disable automatic key-repeat.

setMouseCursorVisible
void setMouseCursorVisible(bool visible)

Show or hide the mouse cursor.

setMousePosition
void setMousePosition(Vector2i pos)
Undocumented in source. Be warned that the author may not have intended to support it.
setTitle
void setTitle(string newTitle)

Change the title of the window.

setTitle
void setTitle(wstring newTitle)

Change the title of the window.

setTitle
void setTitle(dstring newTitle)

Change the title of the window.

setVerticalSyncEnabled
void setVerticalSyncEnabled(bool enabled)

Enable or disable vertical synchronization.

setVisible
void setVisible(bool visible)

Show or hide the window.

waitEvent
bool waitEvent(Event event)

Wait for an event and return it.

Properties

position
Vector2i position [@property setter]

Get's or set's the window's position.

position
Vector2i position [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
size
Vector2u size [@property setter]

Get's or set's the window's size.

size
Vector2u size [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

getWindowPointer
void* getWindowPointer(Window window)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

sfPtr
sfWindow* sfPtr;
Undocumented in source.

Meta