# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Static Public Member Functions | Static Protected Attributes

# vlSDL::SDLWindow Class Reference

The SDLWindow class implements an OpenGLContext using the SDL API. More...

`#include <SDLWindow.hpp>`

Inheritance diagram for vlSDL::SDLWindow:

List of all members.

## Public Member Functions

| SDLWindow ()
| SDLWindow (const vl::String &title, const vl::OpenGLContextFormat &info, int x=0, int y=0, int width=640, int height=480)
bool | initSDLWindow (const vl::String &title, const vl::OpenGLContextFormat &info, int x=0, int y=0, int width=640, int height=480)
| ~SDLWindow ()
void | setPosition (int x, int y)
| If the OpenGL context is a widget this function sets its position.
virtual void | swapBuffers ()
| Swaps the back and front buffers to present the last rendering.
void | translateEvent (SDL_Event *ev)
void | quitApplication ()
| Quits the event loop.
void | setWindowTitle (const vl::String &)
| If the OpenGL context is a top window this function sets its title.
void | setMouseVisible (bool visible)
| If the OpenGL context is a widget this function sets whether the mouse is visible over it or not.
void | setMousePosition (int x, int y)
| If the OpenGL context is a widget this function sets the mouse position.
void | update ()
| If the OpenGLContext is a widget this function requests a redraw and generates an updateEvent().
void | makeCurrent ()
| Sets the OpenGL context as current for the calling thread.

## Static Public Member Functions

static SDL_Surface * | sdlSurface ()

## Static Protected Attributes

static SDL_Surface * | mScreen = NULL

## Detailed Description

The SDLWindow class implements an OpenGLContext using the SDL API.

Note:
  SDL notifies Unicode codes only on key-press events not on release events.

Definition at line 58 of file SDLWindow.hpp.

## Constructor & Destructor Documentation

SDLWindow::SDLWindow | ( | ) |

Definition at line 169 of file SDLWindow.cpp.

SDLWindow::SDLWindow | ( | const vl::String & | title,
|  | const vl::OpenGLContextFormat & | info,
|  | int | x = `0`,
|  | int | y = `0`,
|  | int | width = `640`,
|  | int | height = `480`
| ) |  |

Definition at line 177 of file SDLWindow.cpp.

SDLWindow::~SDLWindow | ( | ) |

Definition at line 173 of file SDLWindow.cpp.

## Member Function Documentation

bool SDLWindow::initSDLWindow | ( | const vl::String & | title,
|  | const vl::OpenGLContextFormat & | info,
|  | int | x = `0`,
|  | int | y = `0`,
|  | int | width = `640`,
|  | int | height = `480`
| ) |  |

Definition at line 182 of file SDLWindow.cpp.

References vl::Vector4< T_Scalar >::a(), vl::OpenGLContextFormat::accumRGBABits(), vl::Vector4< T_Scalar >::b(), vl::OpenGLContextFormat::depthBufferBits(), vl::OpenGLContextFormat::doubleBuffer(), vl::Log::error(), vl::Say::format(), vl::OpenGLContextFormat::fullscreen(), vl::Vector4< T_Scalar >::g(), vl::OpenGLContextFormat::multisample(), vl::OpenGLContextFormat::multisampleSamples(), vl::Log::print(), vl::Vector4< T_Scalar >::r(), vl::OpenGLContextFormat::rgbaBits(), vl::OpenGLContextFormat::stencilBufferBits(), vl::OpenGLContextFormat::stereo(), VL_CHECK, VL_TRAP, and vl::OpenGLContextFormat::vSync().

void SDLWindow::setPosition | ( | int | ,
|  | int |
| ) |  | `[virtual]`

If the OpenGL context is a widget this function sets its position.

Reimplemented from vl::OpenGLContext.

Definition at line 491 of file SDLWindow.cpp.

void SDLWindow::swapBuffers | ( | ) | `[virtual]`

Swaps the back and front buffers to present the last rendering.

Implements vl::OpenGLContext.

Definition at line 486 of file SDLWindow.cpp.

void SDLWindow::translateEvent | ( | SDL_Event * | ev ) |

Definition at line 300 of file SDLWindow.cpp.

References vl::Key_Alt, vl::Key_Ctrl, vl::Key_LeftAlt, vl::Key_LeftCtrl, vl::Key_LeftShift, vl::Key_None, vl::Key_RightAlt, vl::Key_RightCtrl, vl::Key_RightShift, vl::Key_Shift, vl::Key_Unknown, vl::LeftButton, vl::MiddleButton, and vl::RightButton.

void SDLWindow::quitApplication | ( | ) | `[virtual]`

Quits the event loop.

Reimplemented from vl::OpenGLContext.

Definition at line 470 of file SDLWindow.cpp.

void SDLWindow::setWindowTitle | ( | const vl::String & | ) | `[virtual]`

If the OpenGL context is a top window this function sets its title.

Reimplemented from vl::OpenGLContext.

Definition at line 481 of file SDLWindow.cpp.

References vl::String::toStdString().

void vlSDL::SDLWindow::setMouseVisible | ( | bool | ) | `[inline, virtual]`

If the OpenGL context is a widget this function sets whether the mouse is visible over it or not.

Reimplemented from vl::OpenGLContext.

Definition at line 78 of file SDLWindow.hpp.

void vlSDL::SDLWindow::setMousePosition | ( | int | ,
|  | int |
| ) |  | `[inline, virtual]`

If the OpenGL context is a widget this function sets the mouse position.

Reimplemented from vl::OpenGLContext.

Definition at line 84 of file SDLWindow.hpp.

void SDLWindow::update | ( | ) | `[virtual]`

If the OpenGLContext is a widget this function requests a redraw and generates an updateEvent().

Implements vl::OpenGLContext.

Definition at line 476 of file SDLWindow.cpp.

void vlSDL::SDLWindow::makeCurrent | ( | ) | `[inline, virtual]`

Sets the OpenGL context as current for the calling thread.

Implements vl::OpenGLContext.

Definition at line 91 of file SDLWindow.hpp.

static SDL_Surface* vlSDL::SDLWindow::sdlSurface | ( | ) | `[inline, static]`

Definition at line 93 of file SDLWindow.hpp.

## Member Data Documentation

SDL_Surface * SDLWindow::mScreen = NULL`[static, protected]`

Definition at line 96 of file SDLWindow.hpp.

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlSDL/SDLWindow.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlSDL/SDLWindow.cpp

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:48.
Permission is granted to use this page to write and publish articles regarding Visualization Library.