tibia-client/src/framework/graphics/graphics.h

75 lines
1.8 KiB
C
Raw Normal View History

#ifndef GRAPHICS_H
#define GRAPHICS_H
2011-08-15 16:06:15 +02:00
#include "declarations.h"
2011-08-19 14:26:26 +02:00
enum BlendFuncType {
BLEND_NORMAL,
BLEND_COLORIZING
};
class Graphics
{
public:
2011-08-14 04:09:11 +02:00
/// Initialize default OpenGL states
void init();
2011-04-10 22:40:44 +02:00
/// Termiante graphics
void terminate();
2011-04-06 22:53:00 +02:00
/// Check if a GL extension is supported
2011-03-19 01:22:29 +01:00
bool isExtensionSupported(const char *extension);
2011-08-14 04:09:11 +02:00
/// Resizes OpenGL viewport
2011-04-08 07:10:00 +02:00
void resize(const Size& size);
/// Restore original viewport
void restoreViewport();
2010-11-23 16:30:43 +01:00
/// Called before every render
void beginRender();
2010-11-23 16:30:43 +01:00
/// Called after every render
void endRender();
void bindColor(const Color& color);
void bindTexture(const TexturePtr& texture);
2011-08-19 14:26:26 +02:00
void bindBlendFunc(BlendFuncType blendType);
2010-11-23 16:30:43 +01:00
2011-08-14 04:09:11 +02:00
// drawing API
void drawTexturedRect(const Rect& screenCoords,
const TexturePtr& texture,
const Rect& textureCoords = Rect());
2011-02-08 23:48:26 +01:00
2011-08-14 04:09:11 +02:00
void drawRepeatedTexturedRect(const Rect& screenCoords,
const TexturePtr& texture,
const Rect& textureCoords);
2011-08-14 04:09:11 +02:00
void drawFilledRect(const Rect& screenCoords,
const Color& color);
2011-04-16 18:08:55 +02:00
2011-08-14 04:09:11 +02:00
void drawBoundingRect(const Rect& screenCoords,
const Color& color = Color::green,
int innerLineWidth = 1);
const Size& getScreenSize() const { return m_screenSize; }
2011-04-07 09:30:32 +02:00
void startDrawing();
void stopDrawing();
2011-08-15 21:15:49 +02:00
bool isDrawing() const { return m_drawing; }
int getOpacity() const { return m_opacity; }
void setOpacity(int opacity) { m_opacity = opacity; }
2011-08-15 21:15:49 +02:00
TexturePtr getEmptyTexture() { return m_emptyTexture; }
2011-04-16 18:08:55 +02:00
private:
bool m_drawing;
int m_opacity;
Size m_screenSize;
2011-08-15 21:15:49 +02:00
TexturePtr m_emptyTexture;
};
extern Graphics g_graphics;
2011-08-14 04:09:11 +02:00
#endif