-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathScriptInterface.h
90 lines (75 loc) · 3.35 KB
/
ScriptInterface.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
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
#ifndef SCRIPTINTERFACE_H
#define SCRIPTINTERFACE_H
#include <QObject>
#include <QInputDialog>
#include <QFileDialog>
#include <QMessageBox>
#include <string>
#include <QTextStream>
class ScriptInterface : public QObject
{
Q_OBJECT
public:
explicit ScriptInterface(QObject *parent = nullptr);
// Getter
Q_INVOKABLE int GetCurRoomLayerWidth(int layerId);
Q_INVOKABLE int GetCurRoomLayerHeight(int layerId);
Q_INVOKABLE int GetCurRoomTile16(int layerID, int x, int y);
Q_INVOKABLE int GetCurRoomTile8(int layerID, int x, int y);
Q_INVOKABLE int GetRoomNum();
Q_INVOKABLE int GetCurRoomId();
Q_INVOKABLE int GetCurTilesetTile16EventId(unsigned short tile16Id);
Q_INVOKABLE int GetCurTilesetTile16TerrainType(unsigned short tile16Id);
Q_INVOKABLE QString GetEntityListData(int entitylistid = -1);
Q_INVOKABLE QString GetEntityListSource();
Q_INVOKABLE QString GetCurRoomAllDoorsRangeData();
Q_INVOKABLE void PrintEntityDefaultOAMData(int globalEntityId);
// Test
Q_INVOKABLE void _UnpackScreen(int address);
Q_INVOKABLE void _PackScreen(QString inputData, bool skipzeros = true);
Q_INVOKABLE void _DecompressData(int mappingtype, int address);
Q_INVOKABLE unsigned int _GetLayerDecomdataPointer(int layerId);
Q_INVOKABLE void _PrintRoomHeader();
Q_INVOKABLE void _ExportLayerData(QString filePath = QString(""), int layerid = -1);
Q_INVOKABLE void _ImportLayerData(QString fileName = QString(""), int layerid = -1);
Q_INVOKABLE void _GetTilesetGFXInfo(int tilesetId);
Q_INVOKABLE void _ExtractSpriteOAMPackage(int address);
Q_INVOKABLE void _ExtractSpriteOAMPackage(QString address);
// Setter
Q_INVOKABLE void SetCurrentRoomId(int roomid);
Q_INVOKABLE void SetCurRoomTile16(int layerID, int TileID, int x, int y);
Q_INVOKABLE void SetRoomSize(int roomwidth, int roomheight, int layer0width, int layer0height);
Q_INVOKABLE void SetEntityListData(QString entitylistdata, int entitylistid = -1);
// Localize JS function
Q_INVOKABLE void alert(QString message);
Q_INVOKABLE void clear();
Q_INVOKABLE void log(QString message);
Q_INVOKABLE QString prompt(QString message, QString defaultInput);
// UI
Q_INVOKABLE void UpdateRoomGFXFull();
Q_INVOKABLE void DoEvents();
// File operations
Q_INVOKABLE void WriteTxtFile(QString filePath = QString(""), QString test = "");
Q_INVOKABLE QString ReadTxtFile(QString filepath);
// helper functions
Q_INVOKABLE void ShowSaveDataAnalysis();
};
class HintLayer : public QObject
{
Q_OBJECT
public:
explicit HintLayer(QObject *parent = nullptr) : QObject(parent) {}
// Init fucntions
Q_INVOKABLE void GetAutoGeneratedHintLayer();
Q_INVOKABLE void GetblankHintLayer();
// drawing
Q_INVOKABLE void drawRect(int x, int y, int width, int height, int line_width, int red, int green, int blue, int alpha);
Q_INVOKABLE void drawLine(int x1, int y1, int x2, int y2, int line_width, int red, int green, int blue, int alpha);
Q_INVOKABLE void drawText(int x, int y, QString show_text, int red, int green, int blue, int alpha);
// Setter
Q_INVOKABLE void SubmitHintLayer();
private:
// this class works like, we operate the QPixmap object in the class using APIs, the send the pixmap back to the Room class
QPixmap tmpHintLayerPixmap;
};
#endif // SCRIPTINTERFACE_H