28 #include <guichan/opengl.hpp>
29 #include <guichan/font.hpp>
52 SDL_Surface* target = SDL_GetVideoSurface();
54 setTargetPlane(target->w, target->h);
55 mColor = gcn::Color(255, 255, 255, 255);
59 void OpenGLGuiGraphics::drawImage(
const gcn::Image* image, int32_t srcX, int32_t srcY, int32_t dstX, int32_t dstY, int32_t width, int32_t height) {
64 const gcn::ClipRectangle& clip = mClipStack.top();
65 fifeimg->
render(
Rect(dstX + clip.xOffset, dstY + clip.yOffset,
73 throw GuiException(
"OpenGLGuiGraphics::drawText() - No font set!");
79 mFont->drawString(
this, text, x, y);
82 mFont->drawString(
this, text, x - mFont->getWidth(text) / 2, y);
85 mFont->drawString(
this, text, x - mFont->getWidth(text), y);
88 FL_WARN(
_log,
LMsg(
"OpenGLGuiGraphics::drawText() - ") <<
"Unknown alignment: " << alignment);
89 mFont->drawString(
this, text, x, y);
94 const gcn::ClipRectangle& top = mClipStack.top();
96 mColor.r, mColor.g, mColor.b, mColor.a);
100 const gcn::ClipRectangle& top = mClipStack.top();
106 Point pbegin(static_cast<int32_t>(ceil(x1 + 0.375f)), static_cast<int32_t>(ceil(y1 + 0.375f)));
107 Point pend(static_cast<int32_t>(ceil(x2 + 0.625f)), static_cast<int32_t>(ceil(y2 + 0.625f)));
110 mColor.r, mColor.g, mColor.b, mColor.a);
112 mColor.r, mColor.g, mColor.b, mColor.a);
114 mColor.r, mColor.g, mColor.b, mColor.a);
118 const gcn::ClipRectangle& top = mClipStack.top();
120 Point(rectangle.x + top.xOffset, rectangle.y + top.yOffset),
121 rectangle.width, rectangle.height,
122 mColor.r, mColor.g, mColor.b, mColor.a);
126 const gcn::ClipRectangle& top = mClipStack.top();
128 Point(rectangle.x + top.xOffset, rectangle.y + top.yOffset),
129 rectangle.width, rectangle.height,
130 mColor.r, mColor.g, mColor.b, mColor.a);
134 gcn::Rectangle area(0, 0, mWidth, mHeight);
135 gcn::Graphics::pushClipArea(area);
143 gcn::Graphics::popClipArea();
150 gcn::Graphics::pushClipArea(area);
155 const gcn::ClipRectangle& top = mClipStack.top();
158 Rect(top.x, top.y, top.width, top.height),
false);
166 gcn::Graphics::popClipArea();
#define FL_WARN(logger, msg)
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)
Draws a filled axis parallel rectangle.
Helper class to create log strings out from separate parts Usage: LMsg("some text") << variable << "...
virtual void fillRectangle(const gcn::Rectangle &rectangle)
virtual void renderVertexArrays()
Render the Vertex Arrays, only for primitives (points, lines,...)
virtual void _beginDraw()
virtual bool putPixel(int32_t x, int32_t y, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Writes pixel to given position.
static Logger _log(LM_AUDIO)
virtual void drawLine(const Point &p1, const Point &p2, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
Draws line between given points with given RGBA.
static RenderBackend * instance()
virtual void drawLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
PointType2D< int32_t > Point
virtual void drawRectangle(const gcn::Rectangle &rectangle)
void pushClipArea(const Rect &cliparea, bool clear=true)
Pushes clip area to clip stack Clip areas define which area is drawn on screen.
virtual bool pushClipArea(gcn::Rectangle area)
virtual void setColor(const gcn::Color &color)
void popClipArea()
Pops clip area from clip stack.
virtual void popClipArea()
virtual void render(const Rect &rect, uint8_t alpha=255, uint8_t const *rgb=0)=0
Renders itself to the current render target (main screen or attached destination image) at the rectan...
virtual void drawImage(const gcn::Image *image, int32_t srcX, int32_t srcY, int32_t dstX, int32_t dstY, int32_t width, int32_t height)
RenderBackendOpenGL * m_renderbackend
virtual void drawText(const std::string &text, int32_t x, int32_t y, uint32_t alignment)
ImagePtr getFIFEImage() const
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)
Draws an axis parallel rectangle.
virtual void drawPoint(int32_t x, int32_t y)
The main class of the OpenGL-based renderer.
OpenGLGuiGraphics()
Constructor.