-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbitmapfont.h
More file actions
50 lines (41 loc) · 1.32 KB
/
bitmapfont.h
File metadata and controls
50 lines (41 loc) · 1.32 KB
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
/*
* Copyright (C) 2016 Dmitry Morozov <dmorozov@outlook.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef BitmapFont_H
#define BitmapFont_H
#include <QXmlStreamAttributes>
#include <QMap>
#include <QChar>
#include <QPixmap>
#include "object.h"
class BitmapFont : public QObject
{
Q_OBJECT
M_OBJECT
Q_PROPERTY(QString file MEMBER m_file WRITE setFile)
Q_PROPERTY(int charwidth MEMBER m_charWidth/* WRITE setCharWidth*/)
Q_PROPERTY(int charheight MEMBER m_charHeight/* WRITE setCharHeight*/)
Q_PROPERTY(int hspacing MEMBER m_hSpacing/* WRITE setHSpacing*/)
Q_PROPERTY(int vspacing MEMBER m_vSpacing/* WRITE setVSpacing*/)
public:
explicit BitmapFont(const QXmlStreamAttributes &attributes, QObject *parent = 0);
~BitmapFont() {}
QString file() const;
void setFile(const QString &file);
int width() const;
int height() const;
const QPixmap getLetter(const QChar &ch) const;
private:
QString m_file;
int m_charWidth = 0;
int m_charHeight = 0;
int m_hSpacing = 0;
int m_vSpacing = 0;
QMap<QChar, QPixmap> m_letters;
};
#endif // BitmapFont_H