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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// -*- C++ -*-
/*
* Simple MultimEdia LiTerator(SMELT)
* by Chris Xiong 2015
* Bitmap font support header
*
* WARNING: This library is in development and interfaces would be very
* unstable.
*
*/
#ifndef SMBMFONT_H
#define SMBMFONT_H
#include "smanim.hpp"
#include <cwchar>
#ifndef ALIGN_LEFT
#define ALIGN_LEFT 0
#define ALIGN_RIGHT 1
#define ALIGN_CENTER 2
#endif
class smBMFont
{
private:
static SMELT *sm;
smDtpFileR anm;
float sc,hadv;
smEntity2D* chars[256];
int pdb[256],pda[256],b;
DWORD color;
std::map<std::string,SMTEX> xm;
void parseMeta(const char* meta,DWORD size);
public:
bool loadAnmFromMemory(const char* ptr,DWORD size);
void close();
void render(float x,float y,float z,int align,float *rw,const char* text);
void printf(float x,float y,float z,int align,float *rw,const char* format,...);
void setColor(DWORD col){color=col;}
void setBlend(int blend){b=blend;}
void setScale(float scale){sc=scale;}
};
class smBMFontw
{
private:
static SMELT *sm;
smDtpFileR anm;
float sc,hadv;
int b;
DWORD color;
std::map<std::string,SMTEX> xm;
std::map<wchar_t,smEntity2D*> chars;
std::map<wchar_t,int> pdb,pda;
void parseMeta(char* meta,DWORD size);
public:
bool loadAnmFromMemory(char* ptr,DWORD size);
void close();
void render(float x,float y,float z,int align,float *rw,const wchar_t* text);
void printf(float x,float y,float z,int align,float *rw,const wchar_t* format,...);
void setColor(DWORD col){color=col;}
void setBlend(int blend){b=blend;}
void setScale(float scale){sc=scale;}
};
#endif
|