forked from YunHsiao/tetris
/
Renderer.h
33 lines (27 loc) · 843 Bytes
/
Renderer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef CRenderer_H_
#define CRenderer_H_
#include "Window.h"
#include "ft2build.h"
#include FT_GLYPH_H
#pragma comment(lib,"lib\\freetype27.lib")
#define FONT_SIZE 18
class CRenderer
{
public:
CRenderer();
virtual ~CRenderer();
virtual bool onInit() = 0;
virtual void PreRender() = 0;
virtual void PostRender() = 0;
virtual void SpriteDrawText(const char* strText, SRect* rect = 0, int Format = DT_LEFT,
unsigned long color = 0xffffffff) = 0;
virtual void SpriteDraw(size_t pTexture, const SVector* pPosition = 0,
unsigned long color = 0xffffffff) = 0;
virtual size_t CreateTexture(const char* pSrcFile) = 0;
protected:
SVector* TextPosition(SVector* p, float* len, size_t size, RECT* rct, int Format, unsigned line);
void CountLines(const char* str, std::vector<float>& len);
float m_xoff[128];
RECT m_rWnd;
};
#endif