-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabasegenerator.h
More file actions
143 lines (116 loc) · 3.07 KB
/
databasegenerator.h
File metadata and controls
143 lines (116 loc) · 3.07 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#ifndef DATABASEGENERATOR_H
#define DATABASEGENERATOR_H
#include <QDialog>
#include <QDebug>
#include <QFileDialog>
#include <QFontDatabase>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include <QImageReader>
#include <QMessageBox>
#include <QSettings>
#include <QSpinBox>
#include "fte.h"
#define COLOR_HIGHLIGHT QColor::fromRgb(255, 0, 0, 150)
#define COLOR_SELECTED QColor::fromRgb(0, 255, 0, 255)
namespace Ui {
class DatabaseGenerator;
}
class DatabaseGenerator : public QDialog
{
Q_OBJECT
public:
enum ButtonType : int
{
BT_A,
BT_B,
BT_X,
BT_Y,
BT_LB,
BT_RB,
BT_LT,
BT_RT,
BT_Start,
BT_Back,
BT_LStick,
BT_RStick,
BT_DPad,
BT_COUNT
};
enum ColumnType : int
{
CT_X = 1,
CT_Y,
CT_Width,
CT_Height
};
struct CharacterData
{
QChar m_char;
int m_x;
int m_y;
int m_width;
int m_height;
int m_databaseIndex;
};
struct FontTextureData
{
QImage m_texture;
QImage m_highlight;
QVector<CharacterData> m_characterData;
};
public:
explicit DatabaseGenerator(QWidget *parent = nullptr);
~DatabaseGenerator();
void closeEvent (QCloseEvent *event);
bool CofirmChangeMode();
void Reset();
void ClearGraphicScene();
// Edit mode only
void LoadFontTextures();
void UpdateFontHighlight(int id);
void SetSelected(CharacterData const* data);
void UpdateCharacterData();
void UpdateFontTextures(bool setToZero = true);
void UpdateDrawButtonTexture();
void UpdateDrawFontTexture(int id);
void UpdateExportEnabled();
private slots:
void on_RB_ModeEdit_clicked();
void on_RB_ModeNew_clicked();
void on_PB_Import_clicked();
void on_PB_Export_clicked();
void on_PB_Texture_clicked();
void on_PB_Font_clicked();
void on_GridLayout_SpinBox_valueChanged(int arg1);
void on_SB_FontSize_valueChanged(int arg1);
void on_SB_Spacing_valueChanged(int arg1);
void on_SB_OffsetX_valueChanged(int arg1);
void on_SB_OffsetY_valueChanged(int arg1);
void on_TE_Characters_textChanged();
void on_PB_ExportDatabase_clicked();
void on_RB_Button_toggled(bool checked);
void on_RB_Font_toggled(bool checked);
void on_SB_FontIndex_valueChanged(int arg1);
void on_Preview_pressed(QPoint pos);
void on_SB_SelectedX_valueChanged(int arg1);
void on_SB_SelectedY_valueChanged(int arg1);
void on_SB_SelectedWidth_valueChanged(int arg1);
void on_SB_SelectedHeight_valueChanged(int arg1);
private:
Ui::DatabaseGenerator *ui;
QSettings *m_settings;
// Members
fte m_fte;
QString m_ftePath;
QString m_texturePath;
QString m_fontPath;
QChar m_selectedChar;
QFont m_font;
QGraphicsScene* m_graphic;
QImage m_buttonImage;
QGraphicsPixmapItem* m_buttonPixmap;
QGraphicsRectItem* m_buttonHighlightPixmap[BT_COUNT];
QVector<FontTextureData> m_fontTextures;
};
#endif // DATABASEGENERATOR_H