00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FIFE_VIDEO_RENDERBACKENDS_SDL_RENDERBACKENDSDL_H
00023 #define FIFE_VIDEO_RENDERBACKENDS_SDL_RENDERBACKENDSDL_H
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "video/renderbackend.h"
00034
00035 namespace FIFE {
00036
00037 class ScreenMode;
00038
00043 class RenderBackendSDL : public RenderBackend {
00044 public:
00045 RenderBackendSDL(const SDL_Color& colorkey);
00046 virtual ~RenderBackendSDL();
00047 const std::string& getName() const;
00048
00049 void startFrame();
00050 void endFrame();
00051 void init(const std::string& driver);
00052 void clearBackBuffer();
00053 void setLightingModel(unsigned int lighting);
00054 unsigned int getLightingModel() const;
00055 void enableLighting();
00056 void disableLighting();
00057 void setLighting(float red, float green, float blue, float alpha);
00058 void resetLighting();
00059 void enableStencilTest();
00060 void disableStencilTest();
00061 void setStencilTest(uint8_t stencil_ref, unsigned int stencil_op, unsigned int stencil_func);
00062 void resetStencilBuffer(uint8_t buffer);
00063 uint8_t getStencilRef() const;
00064 void enableAlphaTest();
00065 void disableAlphaTest();
00066 void setAlphaTest(float ref_alpha);
00067 void changeBlending(int scr, int dst);
00068
00069 Image* createMainScreen(const ScreenMode& mode, const std::string& title, const std::string& icon);
00070 Image* setScreenMode(const ScreenMode& mode);
00071 Image* createImage(const uint8_t* data, unsigned int width, unsigned int height);
00072 Image* createImage(SDL_Surface* surface);
00073 bool putPixel(int x, int y, int r, int g, int b, int a = 255);
00074 void drawLine(const Point& p1, const Point& p2, int r, int g, int b, int a = 255);
00075 void drawTriangle(const Point& p1, const Point& p2, const Point& p3, int r, int g, int b, int a = 255);
00076 void drawRectangle(const Point& p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
00077 void fillRectangle(const Point& p, uint16_t w, uint16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255);
00078 void drawQuad(const Point& p1, const Point& p2, const Point& p3, const Point& p4, int r, int g, int b, int a = 255);
00079 void drawVertex(const Point& p, const uint8_t size, int r, int g, int b, int a = 255);
00080 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);
00081 };
00082
00083 }
00084
00085 #endif