Added MULTITOUCH_CONTROLS_... enum for m_multitouch_controls config option
This commit is contained in:
parent
9f923fdfaa
commit
64e0c6312e
@ -352,6 +352,14 @@ enum GeometryLevel
|
||||
GEOLEVEL_2 = 2
|
||||
};
|
||||
|
||||
enum MultitouchControls
|
||||
{
|
||||
MULTITOUCH_CONTROLS_UNDEFINED = 0,
|
||||
MULTITOUCH_CONTROLS_STEERING_WHEEL = 1,
|
||||
MULTITOUCH_CONTROLS_ACCELEROMETER = 2,
|
||||
MULTITOUCH_CONTROLS_GYROSCOPE = 3,
|
||||
};
|
||||
|
||||
/** Using X-macros for setting-possible values is not very pretty, but it's a
|
||||
* no-maintenance case :
|
||||
* when you want to add a new parameter, just add one signle line below and
|
||||
|
@ -2083,7 +2083,7 @@ int main(int argc, char *argv[] )
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
if (UserConfigParams::m_multitouch_controls == 0)
|
||||
if (UserConfigParams::m_multitouch_controls == MULTITOUCH_CONTROLS_UNDEFINED)
|
||||
{
|
||||
int32_t touch = AConfiguration_getTouchscreen(
|
||||
global_android_app->config);
|
||||
|
@ -83,9 +83,9 @@ void InitAndroidDialog::beforeAddingWidgets()
|
||||
Widget* accelerometer = &control_type->getChildren()[index];
|
||||
accelerometer->setActive(false);
|
||||
|
||||
if (UserConfigParams::m_multitouch_controls == 2)
|
||||
if (UserConfigParams::m_multitouch_controls == MULTITOUCH_CONTROLS_ACCELEROMETER)
|
||||
{
|
||||
UserConfigParams::m_multitouch_controls = 1;
|
||||
UserConfigParams::m_multitouch_controls = MULTITOUCH_CONTROLS_STEERING_WHEEL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,9 +98,9 @@ void InitAndroidDialog::beforeAddingWidgets()
|
||||
Widget* gyroscope = &control_type->getChildren()[index];
|
||||
gyroscope->setActive(false);
|
||||
|
||||
if (UserConfigParams::m_multitouch_controls == 3)
|
||||
if (UserConfigParams::m_multitouch_controls == MULTITOUCH_CONTROLS_GYROSCOPE)
|
||||
{
|
||||
UserConfigParams::m_multitouch_controls = 1;
|
||||
UserConfigParams::m_multitouch_controls = MULTITOUCH_CONTROLS_STEERING_WHEEL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,15 +127,15 @@ GUIEngine::EventPropagation InitAndroidDialog::processEvent(
|
||||
|
||||
if (selected == "steering_wheel")
|
||||
{
|
||||
UserConfigParams::m_multitouch_controls = 1;
|
||||
UserConfigParams::m_multitouch_controls = MULTITOUCH_CONTROLS_STEERING_WHEEL;
|
||||
}
|
||||
else if (selected == "accelerometer")
|
||||
{
|
||||
UserConfigParams::m_multitouch_controls = 2;
|
||||
UserConfigParams::m_multitouch_controls = MULTITOUCH_CONTROLS_ACCELEROMETER;
|
||||
}
|
||||
else if (selected == "gyroscope")
|
||||
{
|
||||
UserConfigParams::m_multitouch_controls = 3;
|
||||
UserConfigParams::m_multitouch_controls = MULTITOUCH_CONTROLS_GYROSCOPE;
|
||||
}
|
||||
|
||||
user_config->saveConfig();
|
||||
@ -154,12 +154,12 @@ void InitAndroidDialog::updateValues()
|
||||
RibbonWidget* control_type = getWidget<RibbonWidget>("control_type");
|
||||
assert(control_type != NULL);
|
||||
|
||||
if (UserConfigParams::m_multitouch_controls == 2)
|
||||
if (UserConfigParams::m_multitouch_controls == MULTITOUCH_CONTROLS_ACCELEROMETER)
|
||||
{
|
||||
int id = control_type->findItemNamed("accelerometer");
|
||||
control_type->setSelection(id, PLAYER_ID_GAME_MASTER);
|
||||
}
|
||||
else if (UserConfigParams::m_multitouch_controls == 3)
|
||||
else if (UserConfigParams::m_multitouch_controls == MULTITOUCH_CONTROLS_GYROSCOPE)
|
||||
{
|
||||
int id = control_type->findItemNamed("gyroscope");
|
||||
control_type->setSelection(id, PLAYER_ID_GAME_MASTER);
|
||||
@ -175,7 +175,7 @@ void InitAndroidDialog::updateValues()
|
||||
|
||||
bool InitAndroidDialog::onEscapePressed()
|
||||
{
|
||||
UserConfigParams::m_multitouch_controls = 1;
|
||||
UserConfigParams::m_multitouch_controls = MULTITOUCH_CONTROLS_STEERING_WHEEL;
|
||||
user_config->saveConfig();
|
||||
ModalDialog::dismiss();
|
||||
return true;
|
||||
|
@ -119,16 +119,16 @@ GUIEngine::EventPropagation MultitouchSettingsDialog::processEvent(
|
||||
CheckBoxWidget* gyroscope = getWidget<CheckBoxWidget>("gyroscope");
|
||||
assert(gyroscope != NULL);
|
||||
|
||||
UserConfigParams::m_multitouch_controls = 1;
|
||||
UserConfigParams::m_multitouch_controls = MULTITOUCH_CONTROLS_STEERING_WHEEL;
|
||||
|
||||
if (accelerometer->getState())
|
||||
{
|
||||
UserConfigParams::m_multitouch_controls = 2;
|
||||
UserConfigParams::m_multitouch_controls = MULTITOUCH_CONTROLS_ACCELEROMETER;
|
||||
}
|
||||
|
||||
if (gyroscope->getState())
|
||||
{
|
||||
UserConfigParams::m_multitouch_controls = 3;
|
||||
UserConfigParams::m_multitouch_controls = MULTITOUCH_CONTROLS_GYROSCOPE;
|
||||
}
|
||||
|
||||
MultitouchDevice* touch_device = input_manager->getDeviceManager()->
|
||||
@ -224,11 +224,11 @@ void MultitouchSettingsDialog::updateValues()
|
||||
|
||||
CheckBoxWidget* accelerometer = getWidget<CheckBoxWidget>("accelerometer");
|
||||
assert(accelerometer != NULL);
|
||||
accelerometer->setState(UserConfigParams::m_multitouch_controls == 2);
|
||||
accelerometer->setState(UserConfigParams::m_multitouch_controls == MULTITOUCH_CONTROLS_ACCELEROMETER);
|
||||
|
||||
CheckBoxWidget* gyroscope = getWidget<CheckBoxWidget>("gyroscope");
|
||||
assert(gyroscope != NULL);
|
||||
gyroscope->setState(UserConfigParams::m_multitouch_controls == 3);
|
||||
gyroscope->setState(UserConfigParams::m_multitouch_controls == MULTITOUCH_CONTROLS_GYROSCOPE);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -116,7 +116,7 @@ void RaceGUIMultitouch::init()
|
||||
if (m_device == NULL)
|
||||
return;
|
||||
|
||||
if (UserConfigParams::m_multitouch_controls == 2)
|
||||
if (UserConfigParams::m_multitouch_controls == MULTITOUCH_CONTROLS_ACCELEROMETER)
|
||||
{
|
||||
m_device->activateAccelerometer();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user