author | unc0rr |
Tue, 11 Sep 2018 21:16:27 +0200 | |
branch | qmlfrontend |
changeset 13777 | 5c0ea888c926 |
parent 11832 | 8c71c5a1172f |
permissions | -rw-r--r-- |
10402 | 1 |
#ifndef HWENGINE_H |
2 |
#define HWENGINE_H |
|
3 |
||
4 |
#include <QObject> |
|
10416 | 5 |
#include <QByteArray> |
6 |
#include <QVector> |
|
10420 | 7 |
#include <QPixmap> |
10416 | 8 |
|
9 |
#include "flib.h" |
|
10402 | 10 |
|
10420 | 11 |
class QQmlEngine; |
12 |
||
10402 | 13 |
class HWEngine : public QObject |
14 |
{ |
|
15 |
Q_OBJECT |
|
16 |
public: |
|
10420 | 17 |
explicit HWEngine(QQmlEngine * engine, QObject *parent = 0); |
10402 | 18 |
~HWEngine(); |
19 |
||
20 |
static void exposeToQML(); |
|
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
21 |
Q_INVOKABLE void getPreview(); |
10432 | 22 |
Q_INVOKABLE void runQuickGame(); |
10448 | 23 |
Q_INVOKABLE void runLocalGame(); |
10424
4be6cd55f1cf
- Get rid of engine's PathPrefix and UserPathPrefix
unc0rr
parents:
10420
diff
changeset
|
24 |
Q_INVOKABLE QString currentSeed(); |
10442 | 25 |
Q_INVOKABLE void getTeamsList(); |
10450 | 26 |
Q_INVOKABLE void resetGameConfig(); |
10612 | 27 |
|
10456 | 28 |
Q_INVOKABLE void setTheme(const QString & theme); |
10612 | 29 |
Q_INVOKABLE void setScript(const QString & script); |
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10612
diff
changeset
|
30 |
Q_INVOKABLE void setScheme(const QString & scheme); |
10888 | 31 |
Q_INVOKABLE void setAmmo(const QString & ammo); |
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
32 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
33 |
Q_INVOKABLE void tryAddTeam(const QString & teamName); |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
34 |
Q_INVOKABLE void tryRemoveTeam(const QString & teamName); |
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
35 |
Q_INVOKABLE void changeTeamColor(const QString & teamName, int dir); |
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
36 |
|
10896
5a74923120d5
Start network support: only setting up a connection for now
unc0rr
parents:
10888
diff
changeset
|
37 |
Q_INVOKABLE void connect(const QString & host, quint16 port); |
5a74923120d5
Start network support: only setting up a connection for now
unc0rr
parents:
10888
diff
changeset
|
38 |
|
11421 | 39 |
Q_INVOKABLE void sendChatMessage(const QString & msg); |
40 |
||
11428 | 41 |
Q_INVOKABLE void joinRoom(const QString & roomName); |
11429 | 42 |
Q_INVOKABLE void partRoom(const QString & message); |
11428 | 43 |
|
11435 | 44 |
Q_INVOKABLE QString myNickname(); |
45 |
||
10402 | 46 |
signals: |
11428 | 47 |
void errorMessage(const QString & message); |
48 |
void warningMessage(const QString & message); |
|
49 |
||
11439 | 50 |
void previewIsRendering(); |
10420 | 51 |
void previewImageChanged(); |
11832
8c71c5a1172f
- Add state to engine callback for it to know what engine is sending
unc0rr
parents:
11448
diff
changeset
|
52 |
void previewHogCountChanged(int count); |
10442 | 53 |
void localTeamAdded(const QString & teamName, int aiLevel); |
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
54 |
void localTeamRemoved(const QString & teamName); |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
55 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
56 |
void playingTeamAdded(const QString & teamName, int aiLevel, bool isLocal); |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
57 |
void playingTeamRemoved(const QString & teamName); |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
58 |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
59 |
void teamColorChanged(const QString & teamName, const QString & colorValue); |
11448 | 60 |
void hedgehogsNumberChanged(const QString & teamName, int hedgehogsNumber); |
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
61 |
|
11420 | 62 |
void netConnected(); |
63 |
void netDisconnected(const QString & message); |
|
64 |
||
65 |
void lobbyClientAdded(const QString & clientName); |
|
11428 | 66 |
void lobbyClientRemoved(const QString & clientName, const QString & reason); |
11420 | 67 |
void lobbyChatLine(const QString & nickname, const QString & line); |
68 |
||
11429 | 69 |
void roomClientAdded(const QString & clientName); |
70 |
void roomClientRemoved(const QString & clientName, const QString & reason); |
|
71 |
void roomChatLine(const QString & nickname, const QString & line); |
|
72 |
||
73 |
void movedToLobby(); |
|
74 |
void movedToRoom(); |
|
75 |
||
11436 | 76 |
void seedChanged(const QString & seed); |
77 |
void themeChanged(const QString & theme); |
|
78 |
void scriptChanged(const QString & script); |
|
11438 | 79 |
void featureSizeChanged(int featureSize); |
80 |
void mapGenChanged(int mapgen); |
|
81 |
void mapChanged(const QString & map); |
|
82 |
void mazeSizeChanged(int mazeSize); |
|
83 |
void templateChanged(int templ); |
|
11442 | 84 |
void ammoChanged(const QString & ammo); |
11445 | 85 |
void schemeChanged(const QString & scheme); |
11436 | 86 |
|
11423 | 87 |
void roomAdded(quint32 flags |
88 |
, const QString & name |
|
89 |
, int players |
|
90 |
, int teams |
|
91 |
, const QString & host |
|
92 |
, const QString & map |
|
93 |
, const QString & script |
|
94 |
, const QString & scheme |
|
95 |
, const QString & weapons); |
|
11427 | 96 |
void roomUpdated(const QString & name |
97 |
, quint32 flags |
|
98 |
, const QString & newName |
|
99 |
, int players |
|
100 |
, int teams |
|
101 |
, const QString & host |
|
102 |
, const QString & map |
|
103 |
, const QString & script |
|
104 |
, const QString & scheme |
|
105 |
, const QString & weapons); |
|
11424 | 106 |
void roomRemoved(const QString & name); |
11423 | 107 |
|
10402 | 108 |
public slots: |
10416 | 109 |
|
110 |
private: |
|
10420 | 111 |
QQmlEngine * m_engine; |
11435 | 112 |
QString m_myNickname; |
10416 | 113 |
|
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
114 |
static void guiMessagesCallback(void * context, MessageType mt, const char * msg, uint32_t len); |
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
115 |
void fillModels(); |
10420 | 116 |
|
117 |
private slots: |
|
10430 | 118 |
void engineMessageHandler(MessageType mt, const QByteArray &msg); |
10402 | 119 |
}; |
120 |
||
121 |
#endif // HWENGINE_H |
|
122 |