TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
carsetupscreen.cpp
Go to the documentation of this file.
1/***************************************************************************
2
3 file : carsetupscreen.cpp
4 created : Wed Aug 21 13:27:34 CET 2013
5 copyright : (C) 2013-2026 Bernhard Wymann
6 email : berniw@bluewin.ch
7
8 ***************************************************************************/
9
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
23
24#include <stdlib.h>
25#ifdef WIN32
26#include <windows.h>
27#endif
28#include <tgfclient.h>
29#include <car.h>
30#include <portability.h>
31#include <racescreens.h>
32#include <robottools.h>
33#include <vector>
34
35static void *scrHandle = NULL;
36static void *prevHandle = NULL;
37
38static void* rmCarHandle = NULL;
39static tCarPitSetup* rmSetup = NULL;
40static char* rmModName = NULL;
41static int rmIdx = 0;
42static char* rmTrack = NULL;
43static char* rmCarName = NULL;
45
46static void enableLoadButtons();
47
49 private:
50 void* scr; // screen
52 int id; // GUI widget id
57 const char* unit;
58 const char* format;
59
60 void setValue(tdble value)
61 {
62 if (value > v->max) {
63 value = v->max;
64 } else if (value < v->min) {
65 value = v->min;
66 }
67 v->value = value;
68 value = GfParmSI2Unit(unit, value);
69 const int BUFSIZE = 32;
70 char buf[BUFSIZE];
71
72 snprintf(buf, BUFSIZE, format, value);
73 GfuiEditboxSetString(scr, id, buf);
74 }
75
76 public:
77 void set()
78 {
79 const char *val = GfuiEditboxGetString(scr, id);
80 tdble value = (tdble) atof(val);
81 value = GfParmUnit2SI(unit, value);
82 setValue(value);
83 }
84
89
90 void update(tdble delta)
91 {
92 if (fabs(v->min - v->max) >= 0.0001f) {
93 tdble value = v->value;
94 value += delta;
95 setValue(value);
96 }
97 }
98
99 cGuiSetupValue(void* scr, tCarPitSetupValue* v, const char* unit, const char* format, int font, int x, int y, int w, int len):
100 scr(scr),
101 v(v),
102 unit(unit),
104 {
105 const int BUFSIZE = 256;
106 char buf[BUFSIZE];
107 int enable = GFUI_ENABLE;
108
109 steerincb = (v->max - v->min)/10.0f;
111 steerincs = steerincb/10.0f;
113
114 // If min == max there is nothing to adjust, so we disable the fields
115 if (fabs(v->min - v->max) < 0.0001f) {
116 snprintf(buf, BUFSIZE, "%s", "N/A");
117 len = 3;
118 enable = GFUI_DISABLE;
119 } else {
120 snprintf(buf, BUFSIZE, format, GfParmSI2Unit(unit, v->value));
121 }
122
123 const int sp = 3;
124 const int bw = 10;
125 const int minw = 30+4*(bw+sp);
126 if (w < minw) w = minw; // Minimal width;
127
128 id = GfuiEditboxCreateAction(scr, buf, font, x + 2*(bw+sp) + 5, y, w - 4*(bw+sp) - 10, len, tGfuiAction(), [this] { set(); }, 5);
129 GfuiEnable(scr, id, enable);
130
131 tdble bid;
132 bid = GfuiLeanButtonCreateAction(scr, "-", font, x+bw/2, y, bw, GFUI_ALIGN_HC_VB, 1,
133 [this] { updateMM(); }, tGfuiAction(), tGfuiAction());
134 GfuiEnable(scr, bid, enable);
135
136 bid = GfuiLeanButtonCreateAction(scr, "-", font, x+bw/2+bw+sp, y, bw, GFUI_ALIGN_HC_VB, 1,
137 [this] { updateM(); }, tGfuiAction(), tGfuiAction());
138 GfuiEnable(scr, bid, enable);
139
140 bid = GfuiLeanButtonCreateAction(scr, "+", font, x+w-(bw+sp+bw/2), y, bw, GFUI_ALIGN_HC_VB, 1,
141 [this] { updateP(); }, tGfuiAction(), tGfuiAction());
142 GfuiEnable(scr, bid, enable);
143
144 bid = GfuiLeanButtonCreateAction(scr, "+", font, x+w-bw/2, y, bw, GFUI_ALIGN_HC_VB, 1,
145 [this] { updatePP(); }, tGfuiAction(), tGfuiAction());
146 GfuiEnable(scr, bid, enable);
147 }
148
149};
150
151
152static void onSave(rtCarPitSetupType *type)
153{
154 void* carhandle = RtLoadOriginalCarSettings(rmCarName);
155 if (carhandle == 0) {
156 GfError("carhandle NULL in %s, line %d\n", __FILE__, __LINE__);
157 return;
158 }
159
161 carhandle,
162 rmSetup,
163 *type,
164 rmModName,
165 rmIdx,
166 rmTrack,
168 );
169
170 GfParmReleaseHandle(carhandle);
172}
173
174
175static void onSaveAndExit(void *vp)
176{
178 void* carhandle = RtLoadOriginalCarSettings(rmCarName);
179 if (carhandle == 0) {
180 GfError("carhandle NULL in %s, line %d\n", __FILE__, __LINE__);
181 return;
182 }
183
185 carhandle,
186 rmSetup,
187 type,
188 rmModName,
189 rmIdx,
190 rmTrack,
192 );
193
194 GfParmReleaseHandle(carhandle);
195 if (vp != NULL) {
197 }
198}
199
200
201static std::vector<cGuiSetupValue*> values;
202
203static const char* unitdeg = "deg";
204static const char* unitkpa = "kPa";
205static const char* unitlbfin = "lbf/in";
206static const char* unitmm = "mm";
207static const char* unitlbfins = "lbf/in/s";
208static const char* unitNm = "N.m";
209static const char* unitcms = "cm/s";
210
211static const char* f52 = "%5.2f";
212static const char* f43 = "%4.3f";
213static const char* d3 = "%3.0f";
214static const char* d5 = "%5.0f";
215
217static const char* setuplabel[6] = { "Practice", "Qualifying", "Race", "Backup 1", "Backup 2", "Backup 3"};
218static int loadbuttonid[6];
219
220
221static void onLoad(rtCarPitSetupType *type)
222{
225 rmSetup,
226 *type,
227 rmModName,
228 rmIdx,
229 rmTrack,
230 rmCarName,
231 false
232 );
233
234 // Update GUI
235 for (std::vector<cGuiSetupValue*>::iterator it = values.begin(); it != values.end(); ++it) {
236 (*it)->update(0.0f);
237 }
238}
239
240
241// Enable/disable load button depending on file existence
242static void enableLoadButtons()
243{
244 const int n = sizeof(loadbuttonid)/sizeof(loadbuttonid[0]);
245 int i;
246 for (i = 0; i < n; i++) {
249 } else {
251 }
252 }
253}
254
255
256static void onActivate(void)
257{
259}
260
261
262static void onLoadDefault(void)
263{
265 GfError("failed to init from default setup in %s, line %d\n", __FILE__, __LINE__);
266 return;
267 }
268
269 // Update GUI
270 for (std::vector<cGuiSetupValue*>::iterator it = values.begin(); it != values.end(); ++it) {
271 (*it)->update(0.0f);
272 }
273}
274
275
285void *RmCarSetupScreenInit(void *prevMenu, tCarElt *car, tRmInfo* reInfo)
286{
287 const int BUFSIZE = 1024;
288 char buf[BUFSIZE];
289
290 prevHandle = prevMenu;
291
292 rmCarHandle = car->_carHandle;
293 rmSetup = &(car->pitcmd.setup);
294 rmModName = car->_modName;
295 rmIdx = car->_driverIndex;
296 rmTrack = reInfo->track->internalname;
297 rmCarName = car->_carName;
298 rmRaceType = reInfo->s->raceInfo.type;
299
300 if (scrHandle) {
302 for (std::vector<cGuiSetupValue*>::iterator it = values.begin(); it != values.end(); ++it) {
303 delete *it;
304 }
305 values.clear();
306 }
307
309 snprintf(buf, BUFSIZE, "Car Setup - %s - %s - %d", rmCarName, rmTrack, rmIdx);
310 GfuiLabelCreate(scrHandle, buf, GFUI_FONT_MEDIUM, 320, 460, GFUI_ALIGN_HC_VB, strlen(buf));
312
313 static const int x0 = 20;
314 static const int y0 = 428;
315 static const int dy = -12;
316 static const int xoff = 112;
317 static const int xoff2 = 40;
318
319 int i;
320 static const int font = GFUI_FONT_SMALL_C;
321 int col = 0;
322
323 // Suspension/Wheel settings
324 GfuiLabelCreate(scrHandle, "Ride height [mm]:", font, x0, y0 + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
325 GfuiLabelCreate(scrHandle, "Camber [deg]:", font, x0, y0 + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
326 GfuiLabelCreate(scrHandle, "Toe [deg]:", font, x0, y0 + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
327 GfuiLabelCreate(scrHandle, "Caster [deg]:", font, x0, y0 + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
328
329 int y = y0 + (4.3f * dy);
330 col = 0;
331 GfuiLabelCreate(scrHandle, "Spring [lbf/in]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
332 GfuiLabelCreate(scrHandle, "Packers [mm]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
333 GfuiLabelCreate(scrHandle, "Slow bump [lbf/in/s]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
334 GfuiLabelCreate(scrHandle, "Slow rebound [lbf/in/s]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
335 GfuiLabelCreate(scrHandle, "Fast bump [lbf/in/s]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
336 GfuiLabelCreate(scrHandle, "Fast rebound [lbf/in/s]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
337 GfuiLabelCreate(scrHandle, "Bump threshold [cm/s]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
338 GfuiLabelCreate(scrHandle, "Rebound threshold [cm/s]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
339
340 static const char* wheellabel[4] = {"Front right wheel", "Front left wheel", "Rear right wheel", "Rear left wheel"};
341
342 for (i = 0; i < 4; i++) {
343 col = 0;
344 GfuiLabelCreate(scrHandle, wheellabel[i], font, x0 + xoff*(i+1) + xoff2, y0 - dy, GFUI_ALIGN_HL_VB, 0);
345 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->wheelrideheight[i]), unitmm, d3, font, x0 + xoff*(i+1) + xoff2, y0 + (col++ * dy), 102, 5));
346 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->wheelcamber[i]), unitdeg, f52, font, x0 + xoff*(i+1) + xoff2, y0 + (col++ * dy), 102, 5));
347 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->wheeltoe[i]), unitdeg, f52, font, x0 + xoff*(i+1) + xoff2, y0 + (col++ * dy), 102, 5));
348 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->wheelcaster[i]), unitdeg, f52, font, x0 + xoff*(i+1) + xoff2, y0 + (col++ * dy), 102, 5));
349
350 y = y0 + (4.3f * dy);
351 col = 0;
352 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->suspspring[i]), unitlbfin, d5, font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), 102, 5));
353 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->susppackers[i]), unitmm, d3, font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), 102, 5));
354 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->suspslowbump[i]), unitlbfins, d5, font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), 102, 5));
355 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->suspslowrebound[i]), unitlbfins, d5, font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), 102, 5));
356 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->suspfastbump[i]), unitlbfins, d5, font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), 102, 5));
357 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->suspfastrebound[i]), unitlbfins, d5, font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), 102, 5));
358
359 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->suspbumpthreshold[i]), unitcms, d3, font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), 102, 5));
360 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->suspreboundthreshold[i]), unitcms, d3, font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), 102, 5));
361
362 }
363
364 // Steer, brake and axle settings
365 y = y0 + 12.7f*dy;
366 col = 1;
367 GfuiLabelCreate(scrHandle, "Various settings", font, x0 + xoff + xoff2, y, GFUI_ALIGN_HL_VB, 0);
368
369 GfuiLabelCreate(scrHandle, "Steer lock [deg]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
370 GfuiLabelCreate(scrHandle, "Brake front-rear [-]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
371 GfuiLabelCreate(scrHandle, "Brake pressure [kPa]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
372 GfuiLabelCreate(scrHandle, "Front wing [deg]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
373 GfuiLabelCreate(scrHandle, "Rear wing [deg]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
374
375 col = 1;
376 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->steerLock), unitdeg, f52, font, x0 + xoff + xoff2, y + (col++ * dy), 102, 5));
377 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->brakeRepartition), NULL, f43, font, x0 + xoff + xoff2, y + (col++ * dy), 102, 5));
378 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->brakePressure), unitkpa, d5, font, x0 + xoff + xoff2, y + (col++ * dy), 102, 5));
379 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->wingangle[0]), unitdeg, f52, font, x0 + xoff + xoff2, y + (col++ * dy), 102, 5));
380 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->wingangle[1]), unitdeg, f52, font, x0 + xoff + xoff2, y + (col++ * dy), 102, 5));
381
382 col = 1;
383 i = 2;
384 GfuiLabelCreate(scrHandle, "ARB spring [lbf/in]:", font, x0 + xoff*i + xoff2, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
385 GfuiLabelCreate(scrHandle, "3rd spring [lbf/in]:", font, x0 + xoff*i + xoff2, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
386 GfuiLabelCreate(scrHandle, "3rd bump [lbf/in/s]:", font, x0 + xoff*i + xoff2, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
387 GfuiLabelCreate(scrHandle, "3rd rebound [lbf/in/s]:", font, x0 + xoff*i + xoff2, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
388 GfuiLabelCreate(scrHandle, "3rd X0 [mm]:", font, x0 + xoff*i + xoff2, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
389
390 static const char* axlelabel[2] = {"Front axle", "Rear axle"};
391
392 int j;
393 for (j = 0; j < 2; j++) {
394 col = 1;
395 i = j + 3;
396
397 GfuiLabelCreate(scrHandle, axlelabel[j], font, x0 + xoff*i + xoff2, y, GFUI_ALIGN_HL_VB, 0);
398 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->arbspring[j]), unitlbfin, d5, font, x0 + xoff*i + xoff2, y + (col++ * dy), 102, 5));
399 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->thirdspring[j]), unitlbfin, d5, font, x0 + xoff*i + xoff2, y + (col++ * dy), 102, 5));
400 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->thirdbump[j]), unitlbfins, d5, font, x0 + xoff*i + xoff2, y + (col++ * dy), 102, 5));
401 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->thirdrebound[j]), unitlbfins, d5, font, x0 + xoff*i + xoff2, y + (col++ * dy), 102, 5));
402 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->thirdX0[j]), unitmm, d3, font, x0 + xoff*i + xoff2, y + (col++ * dy), 102, 5));
403 }
404
405 // Differential and gears
406 y = y + 6.5f*dy;
407 col = 1;
408 GfuiLabelCreate(scrHandle, "Type:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
409 GfuiLabelCreate(scrHandle, "Ratio [-]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
410 GfuiLabelCreate(scrHandle, "Front min bias [-]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
411 GfuiLabelCreate(scrHandle, "Front max bias [-]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
412 GfuiLabelCreate(scrHandle, "Slip bias [-]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
413 GfuiLabelCreate(scrHandle, "Accel locking torque [Nm]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
414 GfuiLabelCreate(scrHandle, "Brake locking torque [Nm]:", font, x0, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
415
416 // enum TDiffType { NONE = 0, SPOOL = 1, FREE = 2, LIMITED_SLIP = 3, VISCOUS_COUPLER = 4};
417 static const char* diffPos[3] = {"Front differential", "Rear differential", "Center differential"};
418 static const char* diffType[5] = {"None", "Spool", "Free", "1.5 way LSD", "Viscous coupler"};
419
420 for (i = 0; i < 3; i++) {
421 col = 0;
422
423 GfuiLabelCreate(scrHandle, diffPos[i], font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
424 GfuiLabelCreate(scrHandle, diffType[rmSetup->diffType[i]], font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
425 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->diffratio[i]), NULL, f43, font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), 102, 5));
426 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->diffmintqbias[i]), NULL, f43, font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), 102, 5));
427 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->diffmaxtqbias[i]), NULL, f43, font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), 102, 5));
428 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->diffslipbias[i]), NULL, f43, font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), 102, 5));
429 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->difflockinginputtq[i]), unitNm, d5, font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), 102, 5));
430 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->difflockinginputbraketq[i]), unitNm, d5, font, x0 + xoff*(i+1) + xoff2, y + (col++ * dy), 102, 5));
431 }
432
433 col = 0;
434 GfuiLabelCreate(scrHandle, "Gearbox ratios", font, x0 + xoff*4 + xoff2, y + (col++ * dy), GFUI_ALIGN_HL_VB, 0);
435
436 for (i = 0; i < 8; i++) {
437 snprintf(buf, BUFSIZE, "%d:", i + 1);
438 GfuiLabelCreate(scrHandle, buf, font, x0 + xoff*4 + xoff2, y + (col * dy), GFUI_ALIGN_HL_VB, 0);
439 values.push_back(new cGuiSetupValue(scrHandle, &(rmSetup->gearsratio[i]), NULL, f43, font, x0 + xoff*4 + xoff2 + 12, y + (col++ * dy), 90, 5));
440 }
441
442 // Save buttons
443 y = y0 + 27.8f*dy;
444 const int buttonwidth = 102;
445 int x = buttonwidth/2 + x0;
446
447 GfuiLabelCreate(scrHandle, "Save setup:", font, x0, y, GFUI_ALIGN_HL_VB, 0);
448
449 for (j = 0; j < 6; j++) {
450 GfuiLeanButtonCreateAction(scrHandle, setuplabel[j], font, x, y + (dy*(j+1)), buttonwidth, GFUI_ALIGN_HC_VB, GFUI_MOUSE_UP,
451 [j] { onSave(&setuptype[j]); }, tGfuiAction(), tGfuiAction());
452 }
453
454 // Load buttons
455 GfuiLabelCreate(scrHandle, "Load setup:", font, x0 + xoff + xoff2, y, GFUI_ALIGN_HL_VB, 0);
456 for (j = 0; j < 6; j++) {
457 loadbuttonid[j] = GfuiLeanButtonCreateAction(scrHandle, setuplabel[j], font, x + xoff + xoff2, y + (dy*(j+1)), buttonwidth, GFUI_ALIGN_HC_VB, GFUI_MOUSE_UP,
458 [j] { onLoad(&setuptype[j]); }, tGfuiAction(), tGfuiAction());
459 }
460
461 // Reload original car setup
462 GfuiLeanButtonCreateAction(scrHandle, "Car default", font, x + xoff + xoff2, y + (dy*7), buttonwidth, GFUI_ALIGN_HC_VB, GFUI_MOUSE_UP,
464
465
466 // Exit/Exit and save buttons
467 //GfuiButtonCreate(scrHandle, "Leave without saving", GFUI_FONT_MEDIUM, 447, 52, 306, GFUI_ALIGN_HC_VB, GFUI_MOUSE_UP,
468 // prevMenu, GfuiScreenActivate, NULL, (tfuiCallback)NULL, (tfuiCallback)NULL);
469
470 const char* savebuttontext;
472 savebuttontext = "Save practice setup and leave";
473 } else {
474 savebuttontext = "Save qualifying setup and leave";
475 }
477 [prevMenu] { onSaveAndExit(prevMenu); }, tGfuiAction(), tGfuiAction());
478
479 return scrHandle;
480}
Scalar min(Scalar x, Scalar y)
Definition Basic.h:49
static Vector y[4]
Definition Convex.cpp:56
struct CarElt tCarElt
Car structure (tCarElt).
static void * rmCarHandle
static char * rmModName
static const char * unitkpa
static void enableLoadButtons()
static void onLoadDefault(void)
static const char * unitlbfins
static int rmRaceType
static const char * unitlbfin
static int loadbuttonid[6]
static const char * d5
static int rmIdx
static const char * d3
static const char * f52
static const char * unitcms
static void onLoad(rtCarPitSetupType *type)
static const char * unitmm
static rtCarPitSetupType setuptype[6]
static void onActivate(void)
static const char * unitdeg
static const char * unitNm
static char * rmCarName
static tCarPitSetup * rmSetup
static std::vector< cGuiSetupValue * > values
static const char * setuplabel[6]
static char * rmTrack
static void onSaveAndExit(void *vp)
static const char * f43
tCarPitSetupValue * v
cGuiSetupValue(void *scr, tCarPitSetupValue *v, const char *unit, const char *format, int font, int x, int y, int w, int len)
const char * unit
void update(tdble delta)
void setValue(tdble value)
const char * format
static void * prevHandle
static void * scrHandle
static void onActivate(void)
static void onSave(void)
float tdble
Floating point type used in TORCS.
Definition tgf.h:47
void * GfuiScreenCreateExAction(float *bgColor, const tGfuiAction &onActivate, const tGfuiAction &onDeactivate, int mouseAllowed)
Create a screen.
Definition gui.cpp:619
void GfuiMenuDefaultKeysAdd(void *scr)
Add the default menu keyboard callback to a screen.
Definition guimenu.cpp:56
void GfuiScreenRelease(void *scr)
Release the given screen.
Definition gui.cpp:670
int GfuiEditboxCreateAction(void *scr, const char *text, int font, int x, int y, int width, int maxlen, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost, int margin)
Add an edit box to a screen.
Definition guiedit.cpp:53
int GfuiLeanButtonCreateAction(void *scr, const char *text, int font, int x, int y, int width, int align, int mouse, const tGfuiAction &onPush, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost)
Create a text button without horizontal margins.
int GfuiEnable(void *scr, int id, int flag)
Enable / Disable an object.
void GfuiEditboxSetString(void *scr, int id, const char *text)
Set a new string.
Definition guiedit.cpp:390
char * GfuiEditboxGetString(void *scr, int id)
Get the current text of an edit box.
Definition guiedit.cpp:364
int GfuiLabelCreate(void *scr, const char *text, int font, int x, int y, int align, int maxlen)
Add a label to a screen.
Definition guilabel.cpp:121
void GfuiScreenActivate(void *screen)
Activate a screen and make it current.
Definition gui.cpp:508
int GfuiButtonCreateAction(void *scr, const char *text, int font, int x, int y, int width, int align, int mouse, const tGfuiAction &onPush, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost)
Add a button to a screen.
tdble GfParmUnit2SI(const char *unit, tdble val)
Convert a value given in unit to SI.
Definition params.cpp:2079
tdble GfParmSI2Unit(const char *unit, tdble val)
Convert a value from SI to given unit.
Definition params.cpp:2133
void GfParmReleaseHandle(void *parmHandle)
Release given parameter set handle parmHandle.
Definition params.cpp:1963
void * RmCarSetupScreenInit(void *prevMenu, tCarElt *car, tRmInfo *reInfo)
Display car setup screen, for loading, saving and changing car setups.
bool RtCarPitSetupExists(rtCarPitSetupType type, const char *modulename, int robidx, const char *trackname, const char *carname)
Checks if a specific car setup is available.
Definition rttrack.cpp:1028
bool RtInitCarPitSetupFromDefault(tCarPitSetup *s, const char *carname)
Initialize the given tCarPitSetup with the original TORCS setup, that means the car setup merged with...
Definition rttrack.cpp:1172
void * RtLoadOriginalCarSettings(const char *carname)
Gets a handle to a parameter file containing the original TORCS car setup, that means the car setup m...
Definition rttrack.cpp:1127
void RtSaveCarPitSetup(void *hdlecar, tCarPitSetup *s, rtCarPitSetupType type, const char *modulename, int robidx, const char *trackname, const char *carname)
Save a custom setup in the robot's local setups directory.
Definition rttrack.cpp:991
bool RtLoadCarPitSetup(void *hdlecar, tCarPitSetup *s, rtCarPitSetupType type, const char *modulename, int robidx, const char *trackname, const char *carname, bool minmaxonly)
Load a custom setup from the robot's local setups directory.
Definition rttrack.cpp:1097
struct RmInfo tRmInfo
Race Manager General Info.
#define RM_TYPE_PRACTICE
Definition raceman.h:70
rtCarPitSetupType
Definition robottools.h:191
@ BACKUP2
Definition robottools.h:196
@ PRACTICE
Definition robottools.h:192
@ RACE
Definition robottools.h:194
@ BACKUP3
Definition robottools.h:197
@ QUALIFYING
Definition robottools.h:193
@ BACKUP1
Definition robottools.h:195
tCarPitCmd pitcmd
private
Definition car.h:465
tTrack * track
Current track.
Definition raceman.h:223
tSituation * s
Situation during race.
Definition raceman.h:222
tRaceAdmInfo raceInfo
Definition raceman.h:85
tCarPitSetup setup
Definition car.h:443
int type
Race type.
Definition raceman.h:69
char * internalname
Internal name of the track.
Definition track.h:538
#define GfError
Definition tgf.h:350
#define GFUI_ENABLE
Definition tgfclient.h:242
#define GFUI_FONT_MEDIUM
Definition tgfclient.h:249
#define GFUI_FONT_SMALL_C
Definition tgfclient.h:254
#define GFUI_ALIGN_HL_VB
Definition tgfclient.h:71
#define GFUI_MOUSE_UP
Definition tgfclient.h:82
std::function< void()> tGfuiAction
Definition tgfclient.h:107
#define GFUI_ALIGN_HC_VB
Definition tgfclient.h:74
#define GFUI_DISABLE
Definition tgfclient.h:241