author | unc0rr |
Mon, 11 May 2015 00:27:16 +0300 | |
branch | qmlfrontend |
changeset 10927 | 336f5ad638be |
parent 10896 | 5a74923120d5 |
child 10951 | 89a7f617e091 |
permissions | -rw-r--r-- |
10402 | 1 |
#include <QLibrary> |
2 |
#include <QtQml> |
|
10404
1baaab44a0b2
- Fix arguments parsing in engine assuming paramcount > 0
unc0rr
parents:
10402
diff
changeset
|
3 |
#include <QDebug> |
10420 | 4 |
#include <QPainter> |
10424
4be6cd55f1cf
- Get rid of engine's PathPrefix and UserPathPrefix
unc0rr
parents:
10420
diff
changeset
|
5 |
#include <QUuid> |
10402 | 6 |
|
7 |
#include "hwengine.h" |
|
10420 | 8 |
#include "previewimageprovider.h" |
10436 | 9 |
#include "themeiconprovider.h" |
10402 | 10 |
|
11 |
extern "C" { |
|
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
12 |
RunEngine_t *flibRunEngine; |
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
13 |
registerGUIMessagesCallback_t *flibRegisterGUIMessagesCallback; |
10430 | 14 |
setSeed_t *flibSetSeed; |
15 |
getSeed_t *flibGetSeed; |
|
10456 | 16 |
setTheme_t *flibSetTheme; |
10612 | 17 |
setScript_t *flibSetScript; |
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10616
diff
changeset
|
18 |
setScheme_t *flibSetScheme; |
10888 | 19 |
setAmmo_t *flibSetAmmo; |
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
20 |
getPreview_t *flibGetPreview; |
10432 | 21 |
runQuickGame_t *flibRunQuickGame; |
10448 | 22 |
runLocalGame_t *flibRunLocalGame; |
10416 | 23 |
flibInit_t *flibInit; |
10424
4be6cd55f1cf
- Get rid of engine's PathPrefix and UserPathPrefix
unc0rr
parents:
10420
diff
changeset
|
24 |
flibFree_t *flibFree; |
10450 | 25 |
resetGameConfig_t * flibResetGameConfig; |
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
26 |
getThemesList_t *flibGetThemesList; |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
27 |
freeThemesList_t *flibFreeThemesList; |
10436 | 28 |
getThemeIcon_t *flibGetThemeIcon; |
10517 | 29 |
getScriptsList_t *flibGetScriptsList; |
10616 | 30 |
getSchemesList_t *flibGetSchemesList; |
10888 | 31 |
getAmmosList_t *flibGetAmmosList; |
10442 | 32 |
getTeamsList_t *flibGetTeamsList; |
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
|
33 |
tryAddTeam_t * flibTryAddTeam; |
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 |
tryRemoveTeam_t * flibTryRemoveTeam; |
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
35 |
changeTeamColor_t * flibChangeTeamColor; |
10896
5a74923120d5
Start network support: only setting up a connection for now
unc0rr
parents:
10888
diff
changeset
|
36 |
|
5a74923120d5
Start network support: only setting up a connection for now
unc0rr
parents:
10888
diff
changeset
|
37 |
connectOfficialServer_t * flibConnectOfficialServer; |
10402 | 38 |
} |
10420 | 39 |
|
10430 | 40 |
Q_DECLARE_METATYPE(MessageType); |
41 |
||
10420 | 42 |
HWEngine::HWEngine(QQmlEngine *engine, QObject *parent) : |
43 |
QObject(parent), |
|
44 |
m_engine(engine) |
|
10402 | 45 |
{ |
10430 | 46 |
qRegisterMetaType<MessageType>("MessageType"); |
47 |
||
10404
1baaab44a0b2
- Fix arguments parsing in engine assuming paramcount > 0
unc0rr
parents:
10402
diff
changeset
|
48 |
QLibrary hwlib("./libhwengine.so"); |
10402 | 49 |
|
50 |
if(!hwlib.load()) |
|
10404
1baaab44a0b2
- Fix arguments parsing in engine assuming paramcount > 0
unc0rr
parents:
10402
diff
changeset
|
51 |
qWarning() << "Engine library not found" << hwlib.errorString(); |
10402 | 52 |
|
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
53 |
flibRunEngine = (RunEngine_t*) hwlib.resolve("RunEngine"); |
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
54 |
flibRegisterGUIMessagesCallback = (registerGUIMessagesCallback_t*) hwlib.resolve("registerGUIMessagesCallback"); |
10430 | 55 |
flibGetSeed = (getSeed_t*) hwlib.resolve("getSeed"); |
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
56 |
flibGetPreview = (getPreview_t*) hwlib.resolve("getPreview"); |
10432 | 57 |
flibRunQuickGame = (runQuickGame_t*) hwlib.resolve("runQuickGame"); |
10448 | 58 |
flibRunLocalGame = (runLocalGame_t*) hwlib.resolve("runLocalGame"); |
10416 | 59 |
flibInit = (flibInit_t*) hwlib.resolve("flibInit"); |
10424
4be6cd55f1cf
- Get rid of engine's PathPrefix and UserPathPrefix
unc0rr
parents:
10420
diff
changeset
|
60 |
flibFree = (flibFree_t*) hwlib.resolve("flibFree"); |
10416 | 61 |
|
10612 | 62 |
flibSetSeed = (setSeed_t*) hwlib.resolve("setSeed"); |
63 |
flibSetTheme = (setTheme_t*) hwlib.resolve("setTheme"); |
|
64 |
flibSetScript = (setScript_t*) hwlib.resolve("setScript"); |
|
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10616
diff
changeset
|
65 |
flibSetScheme = (setScheme_t*) hwlib.resolve("setScheme"); |
10888 | 66 |
flibSetAmmo = (setAmmo_t*) hwlib.resolve("setAmmo"); |
10612 | 67 |
|
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
68 |
flibGetThemesList = (getThemesList_t*) hwlib.resolve("getThemesList"); |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
69 |
flibFreeThemesList = (freeThemesList_t*) hwlib.resolve("freeThemesList"); |
10436 | 70 |
flibGetThemeIcon = (getThemeIcon_t*) hwlib.resolve("getThemeIcon"); |
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
71 |
|
10517 | 72 |
flibGetScriptsList = (getScriptsList_t*) hwlib.resolve("getScriptsList"); |
10616 | 73 |
flibGetSchemesList = (getSchemesList_t*) hwlib.resolve("getSchemesList"); |
10888 | 74 |
flibGetAmmosList = (getAmmosList_t*) hwlib.resolve("getAmmosList"); |
10517 | 75 |
|
10450 | 76 |
flibResetGameConfig = (resetGameConfig_t*) hwlib.resolve("resetGameConfig"); |
10442 | 77 |
flibGetTeamsList = (getTeamsList_t*) hwlib.resolve("getTeamsList"); |
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
|
78 |
flibTryAddTeam = (tryAddTeam_t*) hwlib.resolve("tryAddTeam"); |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
79 |
flibTryRemoveTeam = (tryRemoveTeam_t*) hwlib.resolve("tryRemoveTeam"); |
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
80 |
flibChangeTeamColor = (changeTeamColor_t*) hwlib.resolve("changeTeamColor"); |
10442 | 81 |
|
10896
5a74923120d5
Start network support: only setting up a connection for now
unc0rr
parents:
10888
diff
changeset
|
82 |
flibConnectOfficialServer = (connectOfficialServer_t*) hwlib.resolve("connectOfficialServer"); |
5a74923120d5
Start network support: only setting up a connection for now
unc0rr
parents:
10888
diff
changeset
|
83 |
|
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
84 |
flibInit("/usr/home/unC0Rr/Sources/Hedgewars/Hedgewars-GC/share/hedgewars/Data", "/usr/home/unC0Rr/.hedgewars"); |
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
85 |
flibRegisterGUIMessagesCallback(this, &guiMessagesCallback); |
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
86 |
|
10436 | 87 |
ThemeIconProvider * themeIcon = (ThemeIconProvider *)m_engine->imageProvider(QLatin1String("theme")); |
88 |
themeIcon->setFileContentsFunction(flibGetThemeIcon); |
|
89 |
||
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
90 |
fillModels(); |
10402 | 91 |
} |
92 |
||
93 |
HWEngine::~HWEngine() |
|
94 |
{ |
|
10424
4be6cd55f1cf
- Get rid of engine's PathPrefix and UserPathPrefix
unc0rr
parents:
10420
diff
changeset
|
95 |
flibFree(); |
10402 | 96 |
} |
97 |
||
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
98 |
void HWEngine::getPreview() |
10402 | 99 |
{ |
10430 | 100 |
flibSetSeed(QUuid::createUuid().toString().toLatin1()); |
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
101 |
flibGetPreview(); |
10402 | 102 |
} |
103 |
||
10432 | 104 |
void HWEngine::runQuickGame() |
105 |
{ |
|
106 |
flibSetSeed(QUuid::createUuid().toString().toLatin1()); |
|
107 |
flibRunQuickGame(); |
|
108 |
} |
|
109 |
||
10448 | 110 |
void HWEngine::runLocalGame() |
111 |
{ |
|
112 |
flibRunLocalGame(); |
|
113 |
} |
|
114 |
||
115 |
||
10402 | 116 |
static QObject *hwengine_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine) |
117 |
{ |
|
118 |
Q_UNUSED(scriptEngine) |
|
119 |
||
10420 | 120 |
HWEngine *hwengine = new HWEngine(engine); |
10402 | 121 |
return hwengine; |
122 |
} |
|
123 |
||
124 |
void HWEngine::exposeToQML() |
|
125 |
{ |
|
126 |
qDebug("HWEngine::exposeToQML"); |
|
127 |
qmlRegisterSingletonType<HWEngine>("Hedgewars.Engine", 1, 0, "HWEngine", hwengine_singletontype_provider); |
|
128 |
} |
|
10416 | 129 |
|
130 |
||
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
131 |
void HWEngine::guiMessagesCallback(void *context, MessageType mt, const char * msg, uint32_t len) |
10420 | 132 |
{ |
133 |
HWEngine * obj = (HWEngine *)context; |
|
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
|
134 |
QByteArray b = QByteArray(msg, len); |
10420 | 135 |
|
136 |
qDebug() << "FLIPC in" << b.size() << b; |
|
137 |
||
10430 | 138 |
QMetaObject::invokeMethod(obj, "engineMessageHandler", Qt::QueuedConnection, Q_ARG(MessageType, mt), Q_ARG(QByteArray, b)); |
10416 | 139 |
} |
140 |
||
10430 | 141 |
void HWEngine::engineMessageHandler(MessageType mt, const QByteArray &msg) |
10416 | 142 |
{ |
10430 | 143 |
switch(mt) |
10426 | 144 |
{ |
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
|
145 |
case MSG_PREVIEW: { |
10426 | 146 |
PreviewImageProvider * preview = (PreviewImageProvider *)m_engine->imageProvider(QLatin1String("preview")); |
147 |
preview->setPixmap(msg); |
|
148 |
emit previewImageChanged(); |
|
10430 | 149 |
break; |
10426 | 150 |
} |
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
|
151 |
case MSG_ADDPLAYINGTEAM: { |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
152 |
QStringList l = QString::fromUtf8(msg).split('\n'); |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
153 |
emit playingTeamAdded(l[1], l[0].toInt(), true); |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
154 |
break; |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
155 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
156 |
case MSG_REMOVEPLAYINGTEAM: { |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
157 |
emit playingTeamRemoved(msg); |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
158 |
break; |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
159 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
160 |
case MSG_ADDTEAM: { |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
161 |
emit localTeamAdded(msg, 0); |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
162 |
break; |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
163 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
164 |
case MSG_REMOVETEAM: { |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
165 |
emit localTeamRemoved(msg); |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
166 |
break; |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
167 |
} |
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
168 |
case MSG_TEAMCOLOR: { |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
169 |
QStringList l = QString::fromUtf8(msg).split('\n'); |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
170 |
emit teamColorChanged(l[0], QColor::fromRgba(l[1].toInt()).name()); |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
171 |
break; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
172 |
} |
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
|
173 |
} |
10424
4be6cd55f1cf
- Get rid of engine's PathPrefix and UserPathPrefix
unc0rr
parents:
10420
diff
changeset
|
174 |
} |
10416 | 175 |
|
10424
4be6cd55f1cf
- Get rid of engine's PathPrefix and UserPathPrefix
unc0rr
parents:
10420
diff
changeset
|
176 |
QString HWEngine::currentSeed() |
4be6cd55f1cf
- Get rid of engine's PathPrefix and UserPathPrefix
unc0rr
parents:
10420
diff
changeset
|
177 |
{ |
10430 | 178 |
return QString::fromLatin1(flibGetSeed()); |
10416 | 179 |
} |
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
180 |
|
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
181 |
void HWEngine::fillModels() |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
182 |
{ |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
183 |
QStringList resultModel; |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
184 |
|
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
185 |
char ** themes = flibGetThemesList(); |
10616 | 186 |
for (char **i = themes; *i != NULL; i++) |
187 |
resultModel << QString::fromUtf8(*i); |
|
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
188 |
flibFreeThemesList(themes); |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
189 |
|
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
190 |
m_engine->rootContext()->setContextProperty("themesModel", QVariant::fromValue(resultModel)); |
10612 | 191 |
|
10616 | 192 |
// scripts model |
10612 | 193 |
resultModel.clear(); |
10616 | 194 |
for (char **i = flibGetScriptsList(); *i != NULL; i++) |
195 |
resultModel << QString::fromUtf8(*i); |
|
10612 | 196 |
|
197 |
m_engine->rootContext()->setContextProperty("scriptsModel", QVariant::fromValue(resultModel)); |
|
10616 | 198 |
|
199 |
// schemes model |
|
200 |
resultModel.clear(); |
|
201 |
for (char **i = flibGetSchemesList(); *i != NULL; i++) |
|
202 |
resultModel << QString::fromUtf8(*i); |
|
203 |
||
204 |
m_engine->rootContext()->setContextProperty("schemesModel", QVariant::fromValue(resultModel)); |
|
10888 | 205 |
|
206 |
// ammos model |
|
207 |
resultModel.clear(); |
|
208 |
for (char **i = flibGetAmmosList(); *i != NULL; i++) |
|
209 |
resultModel << QString::fromUtf8(*i); |
|
210 |
||
211 |
m_engine->rootContext()->setContextProperty("ammosModel", QVariant::fromValue(resultModel)); |
|
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
212 |
} |
10442 | 213 |
|
214 |
void HWEngine::getTeamsList() |
|
215 |
{ |
|
216 |
char ** teams = flibGetTeamsList(); |
|
217 |
for (char **i = teams; *i != NULL; i++) { |
|
218 |
QString team = QString::fromUtf8(*i); |
|
219 |
||
220 |
emit localTeamAdded(team, 0); |
|
221 |
} |
|
222 |
} |
|
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
|
223 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
224 |
void HWEngine::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
|
225 |
{ |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
226 |
flibTryAddTeam(teamName.toUtf8().constData()); |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
227 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
228 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
229 |
void HWEngine::tryRemoveTeam(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
|
230 |
{ |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
231 |
flibTryRemoveTeam(teamName.toUtf8().constData()); |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
232 |
} |
10450 | 233 |
|
234 |
void HWEngine::resetGameConfig() |
|
235 |
{ |
|
236 |
flibResetGameConfig(); |
|
237 |
} |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
238 |
|
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
239 |
void HWEngine::changeTeamColor(const QString &teamName, int dir) |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
240 |
{ |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
241 |
flibChangeTeamColor(teamName.toUtf8().constData(), dir); |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
242 |
} |
10456 | 243 |
|
10896
5a74923120d5
Start network support: only setting up a connection for now
unc0rr
parents:
10888
diff
changeset
|
244 |
void HWEngine::connect(const QString &host, quint16 port) |
5a74923120d5
Start network support: only setting up a connection for now
unc0rr
parents:
10888
diff
changeset
|
245 |
{ |
5a74923120d5
Start network support: only setting up a connection for now
unc0rr
parents:
10888
diff
changeset
|
246 |
flibConnectOfficialServer(); |
5a74923120d5
Start network support: only setting up a connection for now
unc0rr
parents:
10888
diff
changeset
|
247 |
} |
5a74923120d5
Start network support: only setting up a connection for now
unc0rr
parents:
10888
diff
changeset
|
248 |
|
10456 | 249 |
void HWEngine::setTheme(const QString &theme) |
250 |
{ |
|
251 |
flibSetTheme(theme.toUtf8().constData()); |
|
252 |
} |
|
10612 | 253 |
|
254 |
void HWEngine::setScript(const QString &script) |
|
255 |
{ |
|
256 |
flibSetScript(script.toUtf8().constData()); |
|
257 |
} |
|
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10616
diff
changeset
|
258 |
|
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10616
diff
changeset
|
259 |
void HWEngine::setScheme(const QString &scheme) |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10616
diff
changeset
|
260 |
{ |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10616
diff
changeset
|
261 |
flibSetScheme(scheme.toUtf8().constData()); |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10616
diff
changeset
|
262 |
} |
10888 | 263 |
|
264 |
void HWEngine::setAmmo(const QString &ammo) |
|
265 |
{ |
|
266 |
flibSetAmmo(ammo.toUtf8().constData()); |
|
267 |
} |