Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members  

P3DScreen Class Reference

Video hardware (OpenGL context). More...

#include <P3DScreen.hpp>

Inheritance diagram for P3DScreen:

Inheritance graph
[legend]
List of all members.

Public Types

enum  ScreenFlags { FULL = SDL_FULLSCREEN, DOUBLE = SDL_DOUBLEBUF, SIZE = SDL_RESIZABLE }
enum  P3DScreenState {
  INIT_FAILED = 0, INIT_NOTYET = 1, INIT_OK = 10, INIT_WIN = 11,
  INIT_FULL = 12
}

Public Methods

bool Init (u32 width, u32 height, u32 flags, u32 depth=8)
bool Resize (u32 width, u32 height)
int State () const
u32 Width () const
u32 Height () const
u32 Pitch () const
u32 Depth () const
u32 Bpp () const
void Refresh ()
bool BMPScreenshot (const char *filename)
void SetNames (const char *wintitle, const char *icon=0)
void ShowMouse (bool on=true)
void MoveMouse (int x, int y)
void GrabMouse (bool on=true)
bool EnableGLMultitex ()
bool GLMultitexEnabled () const
bool EnableGLArrays ()
bool GLArraysEnabled () const
u32 NbInstances ()
u32 SDLState ()

Static Public Methods

P3DScreen * Singleton ()

Detailed Description

Video hardware (OpenGL context).

Singleton class, only one instance may exist. Get it with Singleton(). Init() can be called many times though, to change the current settings.


Member Enumeration Documentation

enum P3DScreen::ScreenFlags
 

Screen init flags.

Enumeration values:
FULL  for fullscreen mode
DOUBLE  for OpenGL double buffer
SIZE  create a resizable window

enum P3DScreen::P3DScreenState
 

Enumeration values:
INIT_FAILED  Init() has been called but failed.
INIT_NOTYET  Init() has not yet been called.
INIT_OK  This value is never returned, just to simplify the test (State() > INIT_OK means all is ok).
INIT_WIN  Init() has succeeded and the current screen is in windowed mode.
INIT_FULL  Init() has succeeded and the current screen is in fullscreen mode.


Member Function Documentation

P3DScreen* P3DScreen::Singleton   [static]
 

Get the instance of the 3d screen object.

bool P3DScreen::Init u32    width,
u32    height,
u32    flags,
u32    depth = 8
 

Initialise the 3D output (create an OpenGL context).

Parameters:
width  width of the screen in pixels, must be a standard value in fullscreen mode, can be any value in window mode
height  height of the screen in pixels
flags  flags, default = 0 (see P3DScreen::ScreenFlags enum)
depth  bits per pixel
Returns:
true on success though you may not get exactly what you have asked for.

bool P3DScreen::Resize u32    width,
u32    height
 

Resize screen (depth and flags not modified). Only possible with SIZE flag on.

int P3DScreen::State   [inline]
 

Return screen state after initialisation.

Compare value with P3DScreenState enums, something >INIT_OK means success.

u32 P3DScreen::Width   [inline]
 

Get the current screen width in pixels.

u32 P3DScreen::Height   [inline]
 

Get the current screen height in pixels.

u32 P3DScreen::Pitch   [inline]
 

Get the number of bytes needed to store one line in memory.

u32 P3DScreen::Depth   [inline]
 

Get the current depth (number of bits per pixels, 8,16,24,32).

u32 P3DScreen::Bpp   [inline]
 

Get the current number of bytes per pixel (1,2,3,4).

void P3DScreen::Refresh   [inline]
 

Update the screen (flip).

bool P3DScreen::BMPScreenshot const char *    filename
 

Save the current screen contents into a BMP file.

Returns false on error. The name can contain a leading path, but should not contain an extension, since a number will be added at the end if the file already exist (auto incremented). The final name will look like: filenameXXX.bmp

void P3DScreen::SetNames const char *    wintitle,
const char *    icon = 0
 

Change the window title and the icon's label for the running application (only visible on non-fullscreen mode, used by the system window manager).

void P3DScreen::ShowMouse bool    on = true [inline]
 

Show (true) or hide (false) the mouse cursor (may not work with some configurations).

void P3DScreen::MoveMouse int    x,
int    y
[inline]
 

Set the mouse coordinates to (x,y) (in 2D). This generates a mouse motion event.

void P3DScreen::GrabMouse bool    on = true [inline]
 

Grab/ungrab the mouse pointer (force it to stay in this window).

bool P3DScreen::EnableGLMultitex  
 

Init OpenGL multitexture extension.

Use the following pointers (*ARB_ptr) ONLY if it returns true.

bool P3DScreen::GLMultitexEnabled   [inline]
 

Check if multitexture extension is enabled.

bool P3DScreen::EnableGLArrays  
 

Init OpenGL vertex arrays extension.

Use the following pointers (*EXT_ptr) ONLY if it returns true.

bool P3DScreen::GLArraysEnabled   [inline]
 

Check if vertex arrays extension is enabled.

u32 PLMSDLMgr::NbInstances   [inline, inherited]
 

Get the current number of instances (classes using SDL).

u32 PLMSDLMgr::SDLState   [inline, inherited]
 

Get the current value of SDL flags (initialized sub-systems).


The documentation for this class was generated from the following file:
  • P3DScreen.hpp

Generated by Doxygen 1.2.18 on Tue Oct 26 12:07:44 2004.