renderbackendsdl.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005-2008 by the FIFE team                              *
00003  *   http://www.fifengine.de                                               *
00004  *   This file is part of FIFE.                                            *
00005  *                                                                         *
00006  *   FIFE is free software; you can redistribute it and/or                 *
00007  *   modify it under the terms of the GNU Lesser General Public            *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2.1 of the License, or (at your option) any later version.    *
00010  *                                                                         *
00011  *   This library is distributed in the hope that it will be useful,       *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014  *   Lesser General Public License for more details.                       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with this library; if not, write to the                 *
00018  *   Free Software Foundation, Inc.,                                       *
00019  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
00020  ***************************************************************************/
00021 
00022 #ifndef FIFE_VIDEO_RENDERBACKENDS_SDL_RENDERBACKENDSDL_H
00023 #define FIFE_VIDEO_RENDERBACKENDS_SDL_RENDERBACKENDSDL_H
00024 
00025 // Standard C++ library includes
00026 
00027 // 3rd party library includes
00028 
00029 // FIFE includes
00030 // These includes are split up in two parts, separated by one empty line
00031 // First block: files included from the FIFE root src directory
00032 // Second block: files included from the same folder
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
Generated on Wed Nov 23 13:04:44 2011 for FIFE by  doxygen 1.6.3