| |
Main Page Namespace List Class Hierarchy Alphabetical List Compound List Namespace Members Compound Members
PLMScreen Class ReferenceVideo hardware.
More...
#include <PLMScreen.hpp>
Inheritance diagram for PLMScreen:
[legend]List of all members.
|
Public Types |
| enum | ScreenFlags {
HARD = SDL_HWSURFACE,
SOFT = SDL_SWSURFACE,
FULL = SDL_FULLSCREEN,
DOUBLE = SDL_DOUBLEBUF,
HPAL = SDL_HWPALETTE,
SIZE = SDL_RESIZABLE
} |
| enum | DrawMode |
Public Methods |
| bool | Init (u32 width, u32 height, u32 flags, u32 depth) |
| bool | Resize (u32 width, u32 height) |
| bool | State () const |
| u32 | Width () const |
| u32 | Height () const |
| u32 | Pitch () const |
| u32 | Depth () const |
| u32 | Bpp () const |
| const SDL_PixelFormat * | Format () const |
| bool | DriverName (char *buf, int len) const |
| u32 | Flags () const |
| void | Lock () |
| void | Unlock () |
| u8 * | Pixels () const |
| PLMPal * | GetPalette () const |
| void | SetPalette (PLMPal *src, u32 first, u32 number) |
| void | ReplacePalette (PLMPal *src) |
| void | SetClipping (s32 left, s32 top, s32 right, s32 bottom) |
| bool | IsClipping () const |
| void | GetClipping (s32 &left, s32 &top, s32 &right, s32 &bottom) |
| void | StopClipping () |
| PLMColor | RGB2Col (u8 r, u8 g, u8 b) const |
| void | Col2RGB (PLMColor c, u8 &r, u8 &g, u8 &b) const |
| PLMColor | GetPixel (s32 x, s32 y) const |
| void | PutPixel (s32 x, s32 y, PLMColor c) |
| void | XorPixel (s32 x, s32 y, PLMColor c) |
| void | HLine (s32 x, s32 y, u32 w, PLMColor c, DrawMode mode=DRAW_SET) |
| void | VLine (s32 x, s32 y, u32 h, PLMColor c, DrawMode mode=DRAW_SET) |
| void | Frame (s32 x, s32 y, u32 w, u32 h, PLMColor c, DrawMode mode=DRAW_SET) |
| void | Rectangle (s32 x, s32 y, u32 ww, u32 hh, PLMColor c) |
| void | MoveInside (s32 xfrom, s32 yfrom, u32 w, u32 h, s32 xto, s32 yto) |
| void | CopyImage (s32 xdest, s32 ydest, PLMImage *src) |
| void | CopyImage (s32 xdest, s32 ydest, PLMImage *src, s32 xsrc, s32 ysrc, u32 wsrc, u32 hsrc) |
| void | CopyImage (s32 xdest, s32 ydest, PLMImage *src, PLMRect &rect) |
| void | TCopyImage (s32 xdest, s32 ydest, PLMColor c, PLMImage *src) |
| void | TCopyImage (s32 xdest, s32 ydest, PLMColor c, PLMImage *src, s32 xsrc, s32 ysrc, u32 wsrc, u32 hsrc) |
| void | TCopyImage (s32 xdest, s32 ydest, PLMColor c, PLMImage *src, PLMRect &rect) |
| PLMImage * | ScreenFormat (const PLMImage *img) |
| void | Refresh () |
| void | Refresh (s32 x, s32 y, u32 w, u32 h) |
| void | Refresh (PLMRect *rects, u32 nb) |
| void | Flip () |
| void | FadeIn (PLMPal *pal, char steps=8) |
| void | FadeOut (char steps=8) |
| void | BlackOut () |
| bool | BMPScreenshot (const char *filename) |
| void | SetNames (const char *wintitle, const char *icon=0) |
| void | SetIcon (const PLMImage *icon, bool usekey, PLMColor key=0) |
| void | ShowMouse (bool on=true) |
| u32 | NbInstances () |
| u32 | SDLState () |
Static Public Methods |
| PLMScreen * | Singleton () |
Detailed Description
Video hardware.
Singleton class, only one instance may exist. Get it with Singleton(). Can be initialised more than once, to change the screen settings.
Member Enumeration Documentation
| enum PLMScreen::ScreenFlags
|
|
|
|
Screen init flags.
- Enumeration values:
-
| HARD |
screen in video memory |
| SOFT |
screen in system memory |
| FULL |
for fullscreen mode |
| DOUBLE |
for double buffer |
| HPAL |
hardware palette |
| SIZE |
create a resizable window |
|
|
|
Drawing mode, set = replace, xor = draw twice to restore.
|
Member Function Documentation
| PLMScreen* PLMScreen::Singleton |
( |
|
) |
[static] |
|
|
|
Get a pointer on the screen (singleton class, only one instance can exist).
|
| bool PLMScreen::Init |
( |
u32 |
width, |
|
|
u32 |
height, |
|
|
u32 |
flags, |
|
|
u32 |
depth |
|
) |
|
|
|
|
Change the current resolution, depth or mode (window / fullscreen).
- Parameters:
-
| width |
width of the screen, standard values for fullscreen, any value in window mode. |
| height |
height of the screen. |
| flags |
flags (see PLMScreen::ScreenFlags enum). |
| depth |
bits per pixel (8, 16, 24, 32). |
- Returns:
-
true on success though you may not get exactly what you have asked for.
|
| bool PLMScreen::Resize |
( |
u32 |
width, |
|
|
u32 |
height |
|
) |
|
|
|
|
Change the size of the screen (keep same depth and flags).
|
| bool PLMScreen::State |
( |
|
) |
[inline] |
|
|
|
Get screen state after initialisation.
- Returns:
-
true means correctly initialised, false means error.
|
| u32 PLMScreen::Width |
( |
|
) |
[inline] |
|
|
|
Get the current width of the screen.
|
| u32 PLMScreen::Height |
( |
|
) |
[inline] |
|
|
|
Get the current height of the screen.
|
| u32 PLMScreen::Pitch |
( |
|
) |
[inline] |
|
|
|
Get the width of a line in bytes.
|
| u32 PLMScreen::Depth |
( |
|
) |
[inline] |
|
|
|
Get the number of bits per pixel (8, 16, 24, 32).
|
| u32 PLMScreen::Bpp |
( |
|
) |
[inline] |
|
|
|
Get the number of bytes per pixel (1, 2, 3, 4).
|
| const SDL_PixelFormat * PLMScreen::Format |
( |
|
) |
[inline] |
|
|
|
Get screen surface format (SDL). Read-only, never modify, never delete.
|
| bool PLMScreen::DriverName |
( |
char * |
buf, |
|
|
int |
len |
|
) |
const [inline] |
|
|
|
Get the name of the current screen driver.
- Parameters:
-
| buf |
an allocated buffer of at least len bytes |
| len |
the size of the buffer |
- Returns:
-
false on error (screen not initialised).
|
| u32 PLMScreen::Flags |
( |
|
) |
[inline] |
|
|
|
Get current screen flags (SDL).
|
| void PLMScreen::Lock |
( |
|
) |
[inline] |
|
|
|
Lock the access to the screen for modification.
Must be paired with a call to Unlock(). |
| void PLMScreen::Unlock |
( |
|
) |
[inline] |
|
|
|
Release access to the screen surface, after modifications.
|
| u8 * PLMScreen::Pixels |
( |
|
) |
[inline] |
|
| PLMPal* PLMScreen::GetPalette |
( |
|
) |
|
|
|
|
Get a copy of the current palette.
- Returns:
-
a new allocated palette that must be deleted after use. NULL if the depth > 8-bits.
|
| void PLMScreen::SetPalette |
( |
PLMPal * |
src, |
|
|
u32 |
first, |
|
|
u32 |
number |
|
) |
|
|
|
|
Change the current palette.
Change the definition of number colors, starting at index first (inclusive). 8-bits mode only. |
| void PLMScreen::ReplacePalette |
( |
PLMPal * |
src |
) |
|
|
|
|
Replace the whole palette by src. 8-bits mode only.
|
| void PLMScreen::SetClipping |
( |
s32 |
left, |
|
|
s32 |
top, |
|
|
s32 |
right, |
|
|
s32 |
bottom |
|
) |
|
|
|
|
Define the editable portion of the screen.
All modifications done by other methods will be limited to that rectangle. |
| bool PLMScreen::IsClipping |
( |
|
) |
[inline] |
|
|
|
Check if clipping is on, if modifications are limited to a rectangle.
|
| void PLMScreen::GetClipping |
( |
s32 & |
left, |
|
|
s32 & |
top, |
|
|
s32 & |
right, |
|
|
s32 & |
bottom |
|
) |
[inline] |
|
|
|
Get the current clipping rectangle. The whole screen if clipping is off.
|
| void PLMScreen::StopClipping |
( |
|
) |
[inline] |
|
|
|
Set clipping off, in fact simply set the rectangle to cover the whole screen.
|
| PLMColor PLMScreen::RGB2Col |
( |
u8 |
r, |
|
|
u8 |
g, |
|
|
u8 |
b |
|
) |
const [inline] |
|
|
|
Get color value (in current depth).
|
| void PLMScreen::Col2RGB |
( |
PLMColor |
c, |
|
|
u8 & |
r, |
|
|
u8 & |
g, |
|
|
u8 & |
b |
|
) |
const [inline] |
|
|
|
Get R,G,B components of a color (in current depth).
|
| PLMColor PLMScreen::GetPixel |
( |
s32 |
x, |
|
|
s32 |
y |
|
) |
const |
|
|
|
Get the pixel value at coordinates (x, y).
|
| void PLMScreen::PutPixel |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
PLMColor |
c |
|
) |
|
|
|
|
Set the pixel value at coordinates (x, y).
|
| void PLMScreen::XorPixel |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
PLMColor |
c |
|
) |
|
|
|
|
Combine the pixel value at coordinates (x, y) with color c.
|
| void PLMScreen::HLine |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
u32 |
w, |
|
|
PLMColor |
c, |
|
|
DrawMode |
mode = DRAW_SET |
|
) |
|
|
|
|
Draw an horizontal line at (x, y) of width w, with color c.
|
| void PLMScreen::VLine |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
u32 |
h, |
|
|
PLMColor |
c, |
|
|
DrawMode |
mode = DRAW_SET |
|
) |
|
|
|
|
Draw a vertical line at (x, y) of height h, with color c.
|
| void PLMScreen::Frame |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
u32 |
w, |
|
|
u32 |
h, |
|
|
PLMColor |
c, |
|
|
DrawMode |
mode = DRAW_SET |
|
) |
|
|
|
|
Draw an empty rectangle at (x, y) of size (w x h), with color c.
|
| void PLMScreen::Rectangle |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
u32 |
ww, |
|
|
u32 |
hh, |
|
|
PLMColor |
c |
|
) |
[inline] |
|
|
|
Draw a rectangle at (x, y) of size (w x h), filled with color c.
|
| void PLMScreen::MoveInside |
( |
s32 |
xfrom, |
|
|
s32 |
yfrom, |
|
|
u32 |
w, |
|
|
u32 |
h, |
|
|
s32 |
xto, |
|
|
s32 |
yto |
|
) |
|
|
|
|
Move a part of the image in another position.
|
| void PLMScreen::CopyImage |
( |
s32 |
xdest, |
|
|
s32 |
ydest, |
|
|
PLMImage * |
src |
|
) |
[inline] |
|
|
|
Copy the content of the image src in the position (xdest, ydest).
|
| void PLMScreen::CopyImage |
( |
s32 |
xdest, |
|
|
s32 |
ydest, |
|
|
PLMImage * |
src, |
|
|
s32 |
xsrc, |
|
|
s32 |
ysrc, |
|
|
u32 |
wsrc, |
|
|
u32 |
hsrc |
|
) |
|
|
|
|
Copy a part of an image on the screen.
Copy rectangle at (xsrc, ysrc) of size (wsrc x hsrc) from src into position (xdest, ydest) of current image. |
| void PLMScreen::CopyImage |
( |
s32 |
xdest, |
|
|
s32 |
ydest, |
|
|
PLMImage * |
src, |
|
|
PLMRect & |
rect |
|
) |
[inline] |
|
|
|
Copy a part of an image on the screen.
Copy rectangle rect from src into position (xdest, ydest). |
| void PLMScreen::TCopyImage |
( |
s32 |
xdest, |
|
|
s32 |
ydest, |
|
|
PLMColor |
c, |
|
|
PLMImage * |
src |
|
) |
[inline] |
|
|
|
Same as above, but do not copy any pixel of color c in source image.
|
| void PLMScreen::TCopyImage |
( |
s32 |
xdest, |
|
|
s32 |
ydest, |
|
|
PLMColor |
c, |
|
|
PLMImage * |
src, |
|
|
s32 |
xsrc, |
|
|
s32 |
ysrc, |
|
|
u32 |
wsrc, |
|
|
u32 |
hsrc |
|
) |
|
|
|
|
Same as above, but do not copy any pixel of color c in source image.
|
| void PLMScreen::TCopyImage |
( |
s32 |
xdest, |
|
|
s32 |
ydest, |
|
|
PLMColor |
c, |
|
|
PLMImage * |
src, |
|
|
PLMRect & |
rect |
|
) |
[inline] |
|
|
|
Same as above, but do not copy any pixel of color c in source image.
|
|
|
Create an image (with the screen depth) from the given image.
The returned image can then be copied onto the screen with CopyImage(). If the given image is already in the right depth, then this image is returned directly (img). - Returns:
-
a valid image that must be deleted after use or NULL on error.
|
| void PLMScreen::Refresh |
( |
|
) |
[inline] |
|
|
|
Update what is displayed on screen.
|
| void PLMScreen::Refresh |
( |
s32 |
x, |
|
|
s32 |
y, |
|
|
u32 |
w, |
|
|
u32 |
h |
|
) |
|
|
|
|
Update only a portion of the screen.
The portion is defined by the rectangle at position (x, y) and size (w x h). |
| void PLMScreen::Refresh |
( |
PLMRect * |
rects, |
|
|
u32 |
nb |
|
) |
[inline] |
|
|
|
Update a set of portions on the screen.
- Parameters:
-
| rects |
an array of rectangles to refresh, that may overlap. |
| nb |
the number of rectangles to refresh in rects. |
|
|
|
Update the screen and change the active page in double buffer mode.
|
| void PLMScreen::FadeIn |
( |
PLMPal * |
pal, |
|
|
char |
steps = 8 |
|
) |
|
|
|
|
Fade from full black to the palette pal, in steps steps (use the closest power of 2).
8 bits mode only. |
| void PLMScreen::FadeOut |
( |
char |
steps = 8 |
) |
|
|
|
|
Fade from current palette to black, in steps steps (use the closest power of 2).
8 bits mode only. |
| void PLMScreen::BlackOut |
( |
|
) |
|
|
|
|
Set the whole screen to black.
In 8-bits mode, all palette entries are also set to black. |
| bool PLMScreen::BMPScreenshot |
( |
const char * |
filename |
) |
|
|
|
|
Save the current screen contents into a BMP file.
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 exists (auto incremented). The final name will look like: filenameXXX.bmp Note: in 8-bits mode, the file is saved as a 8-bits image with a palette. otherwise as a 24-bits image. - Returns:
-
true on success, false on error (not initialised, file error).
|
| void PLMScreen::SetNames |
( |
const char * |
wintitle, |
|
|
const char * |
icon = 0 |
|
) |
|
|
|
|
Set the title of the current window and icon (for the external window manager).
If icon is NULL, the same name is used for both. |
| void PLMScreen::SetIcon |
( |
const PLMImage * |
icon, |
|
|
bool |
usekey, |
|
|
PLMColor |
key = 0 |
|
) |
|
|
|
|
Set the application's icon (may appear in the window title, when app is iconified, ...).
Note that this method must be called before any call to Init (). - Parameters:
-
| icon |
an image of the icon (size should be 32x32 under win32). |
| usekey |
a flag to tell if one particular color of the image should be treated as transparent. |
| key |
the color to use as transparent color (each pixel of this color won't be visible on the final icon). |
|
| void PLMScreen::ShowMouse |
( |
bool |
on = true |
) |
[inline] |
|
|
|
Show/hide the (system) mouse cursor.
Note: must be called in pairs (2 'hides' need 2 'shows' to make it back). - Parameters:
-
| on |
true means show, false means hide. |
|
| 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:
Generated by
Doxygen 1.2.18 on Tue Oct 26 12:07:39 2004.
|