le3d - LightEngine 3D
A straightforward C++ 3D software engine for real-time graphics
Public Types | Public Member Functions | Public Attributes | List of all members
LeWindow Class Reference

Create and handle an OS native window. More...

#include <window.h>

Public Types

typedef void(* KeyCallback) (int key, int state)
 
typedef void(* MouseCallback) (int x, int y, int buttons)
 

Public Member Functions

 LeWindow (const char *name, int width=LE_RESOX_DEFAULT, int height=LE_RESOY_DEFAULT, bool fullscreen=false)
 
 ~LeWindow ()
 
void update ()
 Update window state and process events. More...
 
void setFullScreen ()
 Set the window to fullscreen mode. More...
 
void setWindowed ()
 Set the window to windowed mode. More...
 
LeHandle getHandle ()
 Retrieve the native OS window handle. More...
 
LeDrawingContext getContext ()
 Retrieve the native OS window graphic context. More...
 
void registerKeyCallback (KeyCallback callback)
 Register a callback to receive keyboard events associated to the window. More...
 
void registerMouseCallback (MouseCallback callback)
 Register a callback to receive mouse events associated to the window. More...
 
void sendKeyEvent (int code, int state)
 Send a keyboard event to the window. More...
 
void sendMouseEvent (int x, int y, int buttons)
 Send a mouse event to the window. More...
 

Public Attributes

int width
 
int height
 
bool fullScreen
 
bool visible
 

Detailed Description

Create and handle an OS native window.

Member Typedef Documentation

typedef void(* LeWindow::KeyCallback) (int key, int state)
typedef void(* LeWindow::MouseCallback) (int x, int y, int buttons)

Constructor & Destructor Documentation

LeWindow::LeWindow ( const char *  name,
int  width = LE_RESOX_DEFAULT,
int  height = LE_RESOY_DEFAULT,
bool  fullscreen = false 
)
LeWindow::~LeWindow ( )

Member Function Documentation

LeDrawingContext LeWindow::getContext ( )

Retrieve the native OS window graphic context.

Returns
handle to an OS window handle
LeHandle LeWindow::getHandle ( )

Retrieve the native OS window handle.

Returns
handle to an OS window handle
void LeWindow::registerKeyCallback ( KeyCallback  callback)

Register a callback to receive keyboard events associated to the window.

Parameters
[in]callbackpointer to a callback function or NULL
void LeWindow::registerMouseCallback ( MouseCallback  callback)

Register a callback to receive mouse events associated to the window.

Parameters
[in]callbackpointer to a callback function or NULL
void LeWindow::sendKeyEvent ( int  code,
int  state 
)

Send a keyboard event to the window.

Parameters
[in]codekeyboard event code
[in]statekeyboard event state (mask)
void LeWindow::sendMouseEvent ( int  x,
int  y,
int  buttons 
)

Send a mouse event to the window.

Parameters
[in]xhorizontal position of the mouse (in client area and in pixels)
[in]yvertical position of the mouse (in client area and in pixels)
[in]buttonsbuttons state (mask)
void LeWindow::setFullScreen ( )

Set the window to fullscreen mode.

void LeWindow::setWindowed ( )

Set the window to windowed mode.

void LeWindow::update ( )

Update window state and process events.

Member Data Documentation

bool LeWindow::fullScreen

Fullscreen state of window

int LeWindow::height

Height of window client region (in pixels)

bool LeWindow::visible

Is the window open or closed

int LeWindow::width

Width of window client region (in pixels)


The documentation for this class was generated from the following files: