Skip to content
Overv edited this page Jul 29, 2012 · 3 revisions

This class is used to manage a window and input. It does not contain an OpenGL context by default.

Enumerations

WindowStyle

Describes the style of the window to be created.

Base = 0,
Resize = 1,
Close = 2,
Fullscreen = 4

Exceptions

None.

Functions

Window( uint width, uint height, const std::string& title, WindowStyle::window_style_t style )

Creates a new window.

int GetX()

Returns the X position of the window relative to the top-left of the screen.

int GetY()

Returns the Y position of the window relative to the top-left of the screen.

uint GetWidth()

Returns the width of the inner area of the window.

uint GetHeight()

Returns the height of the inner area of the window.

bool IsOpen()

Returns true if the window is currently open, false otherwise.

bool HasFocus()

Returns true if the window currently has input focus, false otherwise.

void SetPos( int x, int y )

Moves the window to a new position relative to the top-left of the screen.

void SetSize( uint width, uint height )

Resizes the inner area of the window to a new size.

void SetTitle( const std::string& title )

Changes the title of the window.

void SetVisible( bool visible )

Changes the visibility of the window.

void Close()

Closes the window.

bool GetEvent( Event& ev )

Fetches a new event from the message queue - if one is available. The function returns false if no message is available.

int GetMouseX()

Returns the X position of the mouse relative to the top-left of the inner window area.

int GetMouseY()

Returns the Y position of the mouse relative to the top-left of the inner window area.

bool IsMouseButtonDown( MouseButton::mouse_button_t button )

Returns true if the specified mouse button is currently down, false otherwise.

bool IsKeyDown( Key::key_t key )

Returns true if the specified keyboard key is currently down, false otherwise.

Context& GetContext( uchar color, uchar depth, uchar stencil, uchar antialias )

Returns a new OpenGL context with the specified buffer depths or returns the existing one if it was already created. Only one OpenGL context per window is allowed.

void Present()

Flips the back and front buffers of the window.

Clone this wiki locally