3 Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 Used for tuning constants when developing.
23 Eg. if you have this constant somewhere that you just can't get right
24 by changing it and recompiling all over again:
25 v3f wield_position = v3f(55, -35, 65);
27 Make it look like this:
28 v3f wield_position = v3f(55, -35, 65);
29 QUICKTUNE_AUTONAME(QVT_FLOAT, wield_position.X, 0, 100);
30 QUICKTUNE_AUTONAME(QVT_FLOAT, wield_position.Y, -80, 20);
31 QUICKTUNE_AUTONAME(QVT_FLOAT, wield_position.Z, 0, 100);
33 Then you can modify the values at runtime, using the keys
39 Once you have modified the values at runtime and then quit, the game
40 will print out all the modified values at the end:
41 Modified quicktune values:
43 wield_position.Y = -30
46 The QUICKTUNE macros shouldn't generally be left in committed code.
49 #ifndef QUICKTUNE_HEADER
50 #define QUICKTUNE_HEADER
52 #include "irrlichttypes.h"
57 enum QuicktuneValueType{
63 QuicktuneValueType type;
77 std::string getString();
78 void relativeAdd(float amount);
81 std::vector<std::string> getQuicktuneNames();
82 QuicktuneValue getQuicktuneValue(const std::string &name);
83 void setQuicktuneValue(const std::string &name, const QuicktuneValue &val);
85 void updateQuicktuneValue(const std::string &name, QuicktuneValue &val);
88 #define QUICKTUNE(type_, var, min_, max_, name){\
91 qv.value_##type_.current = var;\
92 qv.value_##type_.min = min_;\
93 qv.value_##type_.max = max_;\
94 updateQuicktuneValue(name, qv);\
95 var = qv.value_##type_.current;\
98 #define QUICKTUNE(type, var, min_, max_, name){}
101 #define QUICKTUNE_AUTONAME(type_, var, min_, max_)\
102 QUICKTUNE(type_, var, min_, max_, #var)