You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.9 KiB

#ifndef GRAPHICS_H
#define GRAPHICS_H
#include "graphicsdeclarations.h"
class Graphics
{
13 years ago
enum DrawMode {
DRAW_NONE = 0,
DRAW_QUADS = 1,
DRAW_TEXTURE = 2,
DRAW_COLORED = 4,
DRAW_COLOR_QUADS = DRAW_QUADS | DRAW_COLORED,
DRAW_TEXTURE_QUADS = DRAW_QUADS | DRAW_TEXTURE | DRAW_COLORED
};
public:
/// Initialize default OpenGL states
void init();
/// Termiante graphics
void terminate();
13 years ago
/// Check if a GL extension is supported
bool isExtensionSupported(const char *extension);
/// Resizes OpenGL viewport
13 years ago
void resize(const Size& size);
/// Restore original viewport
void restoreViewport();
14 years ago
/// Called before every render
void beginRender();
14 years ago
/// Called after every render
void endRender();
void disableDrawing();
14 years ago
// drawing API
void drawTexturedRect(const Rect& screenCoords,
const TexturePtr& texture,
const Rect& textureCoords = Rect(),
const Color& color = Color::white);
13 years ago
void drawRepeatedTexturedRect(const Rect& screenCoords,
const TexturePtr& texture,
const Rect& textureCoords,
const Color& color = Color::white);
void drawFilledRect(const Rect& screenCoords,
const Color& color);
void drawBoundingRect(const Rect& screenCoords,
const Color& color = Color::green,
int innerLineWidth = 1);
const Size& getScreenSize() const { return m_screenSize; }
14 years ago
private:
void bindTexture(const TexturePtr& texture, const Color& color = Color::white);
void bindColor(const Color& color);
TexturePtr m_boundTexture;
Color m_boundColor;
Size m_screenSize;
13 years ago
DrawMode m_drawMode;
};
extern Graphics g_graphics;
#endif