CL_Display3
Main display class.
Overview
CL_Display is the "main" class when dealing with 2D graphics. It contains simple drawing operations, backbuffer clipping and access to the display cards available on the system.
A large amount of the functions in the class have the same purpose as their name equalient in CL_DisplayCard. The difference is that those placed here operate on a selected display card, while those in CL_DisplayCard class require an instance to the card.
All backbuffer related drawing operations in other classes (CL_Surface for instance) work on the currently selected display card, unless you explict pass a pointer pointing to a display card.
The main purpose of this system is to avoid passing around a pointer to the display card in those games, where it only access one single card anyway.
When using OpenGL the GL context will always point to the selected card. So if you need to use OpenGL commands to draw onto another card, you have to select it here.
Class members
- virtual
~CL_Display()
- static void
flip_display( -
bool sync=false)
- static void
clear_display( -
float red=0, float green=0, float blue=0, float alpha=1)
- static void
set_palette( -
CL_Palette *palette)
- static CL_Palette *
get_palette()
- static void
select_card( -
CL_DisplayCard *card)
- static CL_DisplayCard *
get_current_card()
- static void
set_videomode( -
CL_VidMode *mode)
- static void
set_videomode( -
int width, int height, int bpp, bool fullscreen = true, bool allow_resize = false)
- static CL_Target *
get_target()
- static int
get_width()
- static int
get_height()
- static int
get_bpp()
- static std::vector<CL_DisplayCard*>
cards
- static void
push_clip_rect()
- static void
push_clip_rect( -
const CL_ClipRect &rect)
- static CL_ClipRect
get_clip_rect()
- static void
set_clip_rect( -
const CL_ClipRect &rect)
- static void
pop_clip_rect()
- static void
fill_rect( -
int x1, int y1, int x2, int y2, float r, float g, float b, float a)
- static void
draw_line( -
int x1, int y1, int x2, int y2, float r, float g, float b, float a)
- static void
sync_buffers()
Members with descriptions
- virtual
~CL_Display() -
Description:
- static void
flip_display( -
bool sync=false)
Parameters: sync - VSync on/off
Description:
Flips the front and backbuffer. Everything is normally drawn to the backbuffer, and flip_display() needs to be called before it can be seen onto the screen.
- static void
clear_display( -
float red=0, float green=0, float blue=0, float alpha=1)
Parameters: red - red component of the color. green - green component of the color. blue - blue component of the color. alpha - alpha (transparency) component of the color.
Description:
Clears backbuffer with the specified color.
- static void
set_palette( -
CL_Palette *palette)
Parameters: palette - Palette to use as new system palette.
Description:
Set system palette on this card.If the display card is in a non-palettelized mode, this will be the palette used when surfaceproviders doesn't specify a palette themself.
- static CL_Palette *
get_palette() -
Description:
Return the current system palette on this card.
Return value:
The system palette.
- static void
select_card( -
CL_DisplayCard *card)
Parameters: card - new selected display card.
Description:
Selects the display card used by the other memberfunctions of this class.
- static CL_DisplayCard *
get_current_card() -
Description:
Returns the currently selected display card.
Return value:
Current display card.
- static void
set_videomode( -
CL_VidMode *mode)
Parameters: mode - videomode to be changed to.
Description:
Change the display card's video mode.
- static void
set_videomode( -
int width, int height, int bpp, bool fullscreen = true, bool allow_resize = false)
Parameters: width - width in pixels of the new video mode. height - height in pixels of the new video mode. bpp - Bits per pixel. The depth of the new video mode. (8, 16, 24, 32)
Description:
Change the display card's video mode.
- static CL_Target *
get_target() -
Description:
Returns either NULL or the framebuffer
Return value:
NULL or the framebuffer
- static int
get_width() -
Description:
Returns the width of the current video mode.
Return value:
Width of current video mode.
- static int
get_height() -
Description:
Returns the height of the current video mode.
Return value:
Height of current video mode.
- static int
get_bpp() -
Description:
Returns the depth of the current video mode.
Return value:
Depth of current video mode.
- static std::vector<CL_DisplayCard*>
cards -
Description:
The list of display cards available to the application.
- static void
push_clip_rect() -
Description:
Pushes the current clipping rectangle onto the cliprect stack.
- static void
push_clip_rect( -
const CL_ClipRect &rect)
Parameters: rect - The new clipping rectangle to be with the old one and then used.
Description:
Pushes the current clipping rectangle onto the cliprect stack. It then clips the passed rectangle rect with the current one, and uses the result as the new clipping rect.
- static CL_ClipRect
get_clip_rect() -
Description:
Returns the current clipping rectangle.
Return value:
The current clipping rectangle.
- static void
set_clip_rect( -
const CL_ClipRect &rect)
Description:
Sets the current clipping rectangle. This is an absolute set, so it doesn'tget clipped with the previous one.
- static void
pop_clip_rect() -
Description:
Pop the clipping rectangle last pushed onto the stack.
- static void
fill_rect( -
int x1, int y1, int x2, int y2, float r, float g, float b, float a)
Parameters: x1 - Leftmost x-coordinate. y1 - Upper y-coordinate. x2 - Rightmost x-coordinate. y2 - Lower y-coordinate. r - Red component of the filled color. g - Green component of the filled color. b - Blue component of the filled color. a - Alpha component of the filled color.
Description:
Draw a filled rectangle from (x1, y1) to (x2, y2) using the color(r, g, b, a).
- static void
draw_line( -
int x1, int y1, int x2, int y2, float r, float g, float b, float a)
Parameters: x1 - Leftmost x-coordinate. //FIXME y1 - Upper y-coordinate. x2 - Rightmost x-coordinate. y2 - Lower y-coordinate. r - Red component of the filled color. g - Green component of the filled color. b - Blue component of the filled color. a - Alpha component of the filled color.
Description:
Draw a line from (x1, y1) to (x2, y2) using the color(r, g, b, a).
- static void
sync_buffers() -
Description:
Copies the contents of the frontbuffer to all other buffers (usually justthe backbuffer). This ensures that all buffers contain the same image.