FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
FIFE::RenderBackend Class Reference

#include <renderbackend.h>

Inheritance diagram for FIFE::RenderBackend:
Inheritance graph
Collaboration diagram for FIFE::RenderBackend:
Collaboration graph

List of all members.

Public Member Functions

 RenderBackend (const SDL_Color &colorkey)
virtual ~RenderBackend ()
virtual const std::string & getName () const =0
virtual void startFrame ()=0
virtual void endFrame ()=0
virtual void init (const std::string &driver)=0
virtual void clearBackBuffer ()=0
virtual void setLightingModel (unsigned int lighting)=0
virtual unsigned int getLightingModel () const =0
virtual void enableLighting ()=0
virtual void disableLighting ()=0
virtual void setLighting (float red, float green, float blue, float alpha)=0
virtual void resetLighting ()=0
virtual void enableStencilTest ()=0
virtual void disableStencilTest ()=0
virtual void setStencilTest (Uint8 stencil_ref, unsigned int stencil_op, unsigned int stencil_func)=0
virtual void resetStencilBuffer (Uint8 buffer)=0
virtual Uint8 getStencilRef () const =0
virtual void enableAlphaTest ()=0
virtual void disableAlphaTest ()=0
virtual void setAlphaTest (float ref_alpha)=0
virtual void changeBlending (int scr, int dst)=0
virtual void deinit ()
virtual ImagecreateMainScreen (const ScreenMode &mode, const std::string &title, const std::string &icon)=0
virtual ImagesetScreenMode (const ScreenMode &mode)=0
virtual ImagecreateImage (const uint8_t *data, unsigned int width, unsigned int height)=0
virtual ImagecreateImage (SDL_Surface *surface)=0
ImagegetScreenImage () const
void captureScreen (const std::string &filename)
const ScreenMode & getCurrentScreenMode () const
void setColorKeyEnabled (bool colorkeyenable)
bool isColorKeyEnabled () const
void setColorKey (const SDL_Color &colorkey)
const SDL_Color & getColorKey () const
- Public Member Functions inherited from FIFE::AbstractImage
virtual SDL_Surface * getSurface ()=0
virtual unsigned int getWidth () const =0
virtual unsigned int getHeight () const =0
virtual const RectgetArea ()=0
virtual bool putPixel (int x, int y, int r, int g, int b, int a=255)=0
virtual void drawLine (const Point &p1, const Point &p2, int r, int g, int b, int a=255)=0
virtual void drawTriangle (const Point &p1, const Point &p2, const Point &p3, int r, int g, int b, int a=255)=0
virtual void drawRectangle (const Point &p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
virtual void fillRectangle (const Point &p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
virtual void drawQuad (const Point &p1, const Point &p2, const Point &p3, const Point &p4, int r, int g, int b, int a=255)=0
virtual void drawVertex (const Point &p, const uint8_t size, int r, int g, int b, int a=255)=0
virtual void drawLightPrimitive (const Point &p, uint8_t intensity, float radius, int subdivisions, float xstretch, float ystretch, uint8_t red, uint8_t green, uint8_t blue)=0
virtual void getPixelRGBA (int x, int y, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *a)=0
virtual void pushClipArea (const Rect &cliparea, bool clear=true)=0
virtual void popClipArea ()=0
virtual const RectgetClipArea () const =0
virtual void saveImage (const std::string &filename)=0
virtual void setAlphaOptimizerEnabled (bool enabled)=0
virtual bool isAlphaOptimizerEnabled ()=0

Detailed Description

Abstract interface for all the renderbackends.

Definition at line 52 of file renderbackend.h.


Constructor & Destructor Documentation

FIFE::RenderBackend::RenderBackend ( const SDL_Color &  colorkey)

Constructor.

Parameters:
nameThe name of the new renderbackend.

Definition at line 36 of file renderbackend.cpp.

FIFE::RenderBackend::~RenderBackend ( )
virtual

Destructor.

Definition at line 44 of file renderbackend.cpp.


Member Function Documentation

void FIFE::RenderBackend::captureScreen ( const std::string &  filename)

Creates a Screenshot and saves it to a file.

Definition at line 53 of file renderbackend.cpp.

virtual void FIFE::RenderBackend::changeBlending ( int  scr,
int  dst 
)
pure virtual

Change the Blendingmodel.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

virtual void FIFE::RenderBackend::clearBackBuffer ( )
pure virtual

Forces a clear of the backbuffer

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

Referenced by FIFE::Engine::pump().

Here is the caller graph for this function:

virtual Image* FIFE::RenderBackend::createImage ( const uint8_t *  data,
unsigned int  width,
unsigned int  height 
)
pure virtual

Creates an Image suitable for this renderbackend.

Parameters:
dataPointer to the imagedata (needs to be in RGBA, 8 bits per channel).
widthWidth of the image.
heightHeight of the image.
Returns:
The new Image.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

virtual Image* FIFE::RenderBackend::createImage ( SDL_Surface *  surface)
pure virtual

Helper function to create images from SDL_Surfaces. Takes ownership over the surface.

Parameters:
surfaceThe surface to convert.
Returns:
The new Image.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

virtual Image* FIFE::RenderBackend::createMainScreen ( const ScreenMode &  mode,
const std::string &  title,
const std::string &  icon 
)
pure virtual

Creates the mainscreen (the display window).

Parameters:
modeThe ScreenMode to use.
See also:
FIFE::ScreenMode.
Parameters:
titeThe window title to use.
iconThe window icon to use.
Returns:
The new Screen Image

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

Referenced by FIFE::Engine::init().

Here is the caller graph for this function:

void FIFE::RenderBackend::deinit ( )
virtual

Performs cleanup actions.

Definition at line 47 of file renderbackend.cpp.

Referenced by FIFE::Engine::destroy().

Here is the caller graph for this function:

virtual void FIFE::RenderBackend::disableAlphaTest ( )
pure virtual

Disable the stencil test.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

virtual void FIFE::RenderBackend::disableLighting ( )
pure virtual

Disable the lighting.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

Referenced by FIFE::Engine::pump(), and FIFE::CellSelectionRenderer::render().

Here is the caller graph for this function:

virtual void FIFE::RenderBackend::disableStencilTest ( )
pure virtual

Disable the stencil test.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

virtual void FIFE::RenderBackend::enableAlphaTest ( )
pure virtual

Enable the alpha test.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

virtual void FIFE::RenderBackend::enableLighting ( )
pure virtual

Enable the lighting.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

Referenced by FIFE::Engine::pump(), and FIFE::CellSelectionRenderer::render().

Here is the caller graph for this function:

virtual void FIFE::RenderBackend::enableStencilTest ( )
pure virtual

Enable the stencil test.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

virtual void FIFE::RenderBackend::endFrame ( )
pure virtual

Called when a frame is finished and ready to be displayed.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

Referenced by FIFE::Engine::pump().

Here is the caller graph for this function:

const SDL_Color & FIFE::RenderBackend::getColorKey ( ) const

Gets the global colorkey setting

Definition at line 130 of file renderbackend.cpp.

const ScreenMode & FIFE::RenderBackend::getCurrentScreenMode ( ) const

Get current screen mode

Returns:
The current screen mode

Definition at line 77 of file renderbackend.cpp.

virtual unsigned int FIFE::RenderBackend::getLightingModel ( ) const
pure virtual

Gets the current light model.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

Referenced by FIFE::Camera::render().

Here is the caller graph for this function:

virtual const std::string& FIFE::RenderBackend::getName ( ) const
pure virtual

The name of the renderbackend.

Returns:
The name of this renderbackend.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

Referenced by FIFE::Camera::Camera().

Here is the caller graph for this function:

Image* FIFE::RenderBackend::getScreenImage ( ) const
inline

Returns a pointer to the main screen Image

Returns:
A pointer to the main screen Image, or 0 if no mainscreen exists.

Definition at line 180 of file renderbackend.h.

virtual Uint8 FIFE::RenderBackend::getStencilRef ( ) const
pure virtual

Return the reference value for the stencil test.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

virtual void FIFE::RenderBackend::init ( const std::string &  driver)
pure virtual

Initializes the backend.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

Referenced by FIFE::Engine::init().

Here is the caller graph for this function:

bool FIFE::RenderBackend::isColorKeyEnabled ( ) const

Gets whether the colorkey feature is in use

Definition at line 122 of file renderbackend.cpp.

virtual void FIFE::RenderBackend::resetLighting ( )
pure virtual

Reset lighting with default values.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

Referenced by FIFE::Camera::render().

Here is the caller graph for this function:

virtual void FIFE::RenderBackend::resetStencilBuffer ( Uint8  buffer)
pure virtual

Reset stencil buffer with given value.

Referenced by FIFE::Camera::render().

Here is the caller graph for this function:

virtual void FIFE::RenderBackend::setAlphaTest ( float  ref_alpha)
pure virtual

Set reference for the alpha test.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

void FIFE::RenderBackend::setColorKey ( const SDL_Color &  colorkey)

Sets the global colorkey to use for images

Definition at line 126 of file renderbackend.cpp.

void FIFE::RenderBackend::setColorKeyEnabled ( bool  colorkeyenable)

Sets whether to use the colorkey feature

Definition at line 118 of file renderbackend.cpp.

Referenced by FIFE::Engine::init().

Here is the caller graph for this function:

virtual void FIFE::RenderBackend::setLighting ( float  red,
float  green,
float  blue,
float  alpha 
)
pure virtual

Set colors for lighting

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

Referenced by FIFE::Camera::render().

Here is the caller graph for this function:

virtual void FIFE::RenderBackend::setLightingModel ( unsigned int  lighting)
pure virtual

Initializes the light.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

Referenced by FIFE::Engine::init().

Here is the caller graph for this function:

virtual Image* FIFE::RenderBackend::setScreenMode ( const ScreenMode &  mode)
pure virtual

Sets the mainscreen display mode.

Parameters:
modeThe ScreenMode to change the display to.
See also:
FIFE::ScreenMode.
Returns:
The new Screen Image

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

Referenced by FIFE::Engine::changeScreenMode().

Here is the caller graph for this function:

virtual void FIFE::RenderBackend::setStencilTest ( Uint8  stencil_ref,
unsigned int  stencil_op,
unsigned int  stencil_func 
)
pure virtual

Set reference for the stencil test.

virtual void FIFE::RenderBackend::startFrame ( )
pure virtual

Called when a new frame starts.

Implemented in FIFE::RenderBackendSDL, and FIFE::RenderBackendOpenGL.

Referenced by FIFE::Engine::pump().

Here is the caller graph for this function:


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