More cleanup for the input system. Removed a lot of functions from InputDevice that won't be used there anymore.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3815 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
rforder 2009-08-06 19:05:26 +00:00
parent 9ba0bd67d2
commit f3e3206b26
8 changed files with 64 additions and 295 deletions

View File

@ -47,6 +47,7 @@ void DeviceConfig::setBinding ( const PlayerAction action,
//------------------------------------------------------------------------------
// Don't call this directly unless you are KeyboardDevice or GamepadDevice
bool DeviceConfig::getBinding ( Input::InputType type,
const int id,
const int value,

View File

@ -41,6 +41,7 @@ class DeviceConfig
const int id,
Input::AxisDirection direction = Input::AD_NEUTRAL);
// Don't call this directly unless you are KeyboardDevice or GamepadDevice
bool getBinding (Input::InputType type,
const int id,
const int value,

View File

@ -12,8 +12,7 @@
DeviceManager::DeviceManager()
{
m_keyboards.push_back(new KeyboardDevice());
m_keyboard_amount = m_keyboards.size();
m_keyboard_amount = 0;
m_gamepad_amount = 0;
m_latest_used_device = NULL;
m_assign_mode = NO_ASSIGN;
@ -58,10 +57,7 @@ void DeviceManager::setAssignMode(const PlayerAssignMode assignMode)
{
m_gamepads[i].setPlayer(NULL);
}
for(unsigned int n=0; n<m_keyboard_amount; n++)
{
m_keyboards[n].setPlayer(NULL);
}
m_keyboard->setPlayer(NULL);
}
}
// -----------------------------------------------------------------------------
@ -113,8 +109,11 @@ GamepadConfig *DeviceManager::getGamepadConfig(const int irr_id)
// -----------------------------------------------------------------------------
void DeviceManager::add(KeyboardDevice* d)
{
m_keyboard = d;
/*
m_keyboards.push_back(d);
m_keyboard_amount = m_keyboards.size();
*/
}
// -----------------------------------------------------------------------------
void DeviceManager::add(GamePadDevice* d)
@ -137,23 +136,23 @@ bool DeviceManager::mapInputToPlayerAndAction( Input::InputType type, int device
{
for(unsigned int n=0; n<m_keyboard_amount; n++)
{
if( m_keyboards[n].hasBinding(btnID, action) )
if( m_keyboard->hasBinding(btnID, action) )
{
// We found which device was triggered.
if(m_assign_mode == NO_ASSIGN)
{
// In no-assign mode, simply keep track of which device is used
if(!programaticallyGenerated) m_latest_used_device = m_keyboards.get(n);
if(!programaticallyGenerated) m_latest_used_device = m_keyboard;
//if(programaticallyGenerated) std::cout << "devieManager ignores programatical event\n";
}
else
{
// In assign mode, find to which active player this binding belongs
if (m_keyboards[n].m_player != NULL)
if (m_keyboard->m_player != NULL)
{
*player = m_keyboards[n].m_player;
*player = m_keyboard->m_player;
if (m_assign_mode == DETECT_NEW && *action == PA_RESCUE)
{
@ -167,22 +166,19 @@ bool DeviceManager::mapInputToPlayerAndAction( Input::InputType type, int device
// no active player has this binding. if we want to check for new players trying to join,
// check now
if (m_assign_mode == DETECT_NEW)
{
for(unsigned int n=0; n<m_keyboard_amount; n++)
{
PlayerAction localaction = PA_FIRST; // none
if (m_keyboards[n].hasBinding(btnID, &localaction))
if (m_keyboard->hasBinding(btnID, &localaction))
{
if(localaction == PA_FIRE)
{
if (value > Input::MAX_VALUE/2)
KartSelectionScreen::firePressedOnNewDevice( m_keyboards.get(n) );
KartSelectionScreen::firePressedOnNewDevice( m_keyboard );
}
*action = PA_FIRST; // FIXME : returning PA_FIRST is quite a hackish way to tell input was handled internally
return true;
}
} // end for
} // end if assign_mode == DETECT_NEW
}
@ -281,7 +277,7 @@ bool DeviceManager::mapInputToPlayerAndAction( Input::InputType type, int device
InputDevice* DeviceManager::getLatestUsedDevice()
{
// If none, probably the user clicked or used enter; give keyboard by default
if (m_latest_used_device == NULL ) return m_keyboards.get(0);
if (m_latest_used_device == NULL ) return m_keyboard;
return m_latest_used_device;
}
@ -365,6 +361,8 @@ bool DeviceManager::deserialize()
if (m_keyboard_configs.size() == 0)
m_keyboard_configs.push_back(new KeyboardConfig());
m_keyboard->setConfiguration(m_keyboard_configs.get(0));
for (int n = 0; n < m_keyboard_configs.size(); n++)
printf("%s\n", m_keyboard_configs[n].toString().c_str());

View File

@ -14,7 +14,7 @@ enum PlayerAssignMode
class DeviceManager
{
ptr_vector<KeyboardDevice, HOLD> m_keyboards;
KeyboardDevice *m_keyboard;
ptr_vector<GamePadDevice, HOLD> m_gamepads;
ptr_vector<KeyboardConfig, HOLD> m_keyboard_configs;
ptr_vector<GamepadConfig, HOLD> m_gamepad_configs;
@ -49,7 +49,7 @@ public:
void setAssignMode(const PlayerAssignMode assignMode);
int getKeyboardAmount() const { return m_keyboard_amount; }
KeyboardDevice* getKeyboard(const int i) { return m_keyboards.get(i); }
KeyboardDevice* getKeyboard(const int i) { return m_keyboard; }
/** Given some input, finds to which device it belongs and, using the corresponding device object,
maps this input to the corresponding player and game action. returns false if player/action could not be set.

View File

@ -9,12 +9,6 @@
InputDevice::InputDevice()
{
for(int n=0; n<PA_COUNT; n++)
{
m_default_bindings[n].id = -1;
m_default_bindings[n].type = Input::IT_NONE;
m_default_bindings[n].dir = Input::AD_NEUTRAL;
}
m_player = NULL;
}
// -----------------------------------------------------------------------------
@ -25,87 +19,6 @@ void InputDevice::setPlayer(ActivePlayer* owner)
{
m_player = owner;
}
// -----------------------------------------------------------------------------
void InputDevice::serialize(std::ofstream& stream)
{
if (m_type == DT_KEYBOARD) stream << "<keyboard>\n\n";
else if (m_type == DT_GAMEPAD) stream << "<gamepad name=\"" << m_name.c_str() << "\" >\n\n";
else std::cerr << "Warning, unknown input device type, skipping it\n";
// stream << "owner=\"" << m_player << "\">\n\n";
for(int n=0; n<PA_COUNT; n++)
{
stream << " <action name=\"" << KartActionStrings[n] << "\" id=\""
<< m_default_bindings[n].id << "\" event=\"" << m_default_bindings[n].type << "\" ";
if (m_type == DT_GAMEPAD) stream << "direction=\"" << m_default_bindings[n].dir << "\"";
stream << "/>\n";
}
if (m_type == DT_KEYBOARD) stream << "\n</keyboard>\n\n\n";
else if (m_type == DT_GAMEPAD) stream << "\n</gamepad>\n\n\n";
}
// -----------------------------------------------------------------------------
bool InputDevice::deserializeAction(irr::io::IrrXMLReader* xml)
{
// ---- read name
const char* name_string = xml->getAttributeValue("name");
if(name_string == NULL) return false;
int binding_id = -1;
for(int n=0; n<PA_COUNT; n++)
{
if(strcmp(name_string,KartActionStrings[n].c_str()) == 0)
{
binding_id = n;
break;
}
}
if(binding_id == -1)
{
std::cerr << "Unknown action type : " << name_string << std::endl;
return false;
}
// ---- read id
const char* id_string = xml->getAttributeValue("id");
if(id_string == NULL) return false;
const int id = atoi(id_string);
// ---- read event type
const char* event_string = xml->getAttributeValue("event");
if(event_string == NULL) return false;
const int event_id = atoi(event_string);
m_default_bindings[binding_id].id = id;
m_default_bindings[binding_id].type = (Input::InputType)event_id;
// ---- read axis direction
const char* dir_string = xml->getAttributeValue("direction");
if(dir_string != NULL)
{
const int dir = atoi(dir_string);
m_default_bindings[binding_id].dir = (Input::AxisDirection)dir;
}
return true;
}
// -----------------------------------------------------------------------------
std::string InputDevice::getBindingAsString(const PlayerAction action) const
{
return Input::getInputAsString(m_default_bindings[action].type, m_default_bindings[action].id, m_default_bindings[action].dir);
}
#if 0
#pragma mark -
#pragma mark Keyboard
#endif
// -----------------------------------------------------------------------------
KeyboardDevice::KeyboardDevice(KeyboardConfig *configuration)
@ -119,55 +32,11 @@ KeyboardDevice::KeyboardDevice()
m_configuration = new KeyboardConfig();
m_type = DT_KEYBOARD;
}
// -----------------------------------------------------------------------------
KeyboardDevice::KeyboardDevice(irr::io::IrrXMLReader* xml)
{
m_type = DT_KEYBOARD;
}
// -----------------------------------------------------------------------------
void KeyboardDevice::loadDefaults()
bool KeyboardDevice::hasBinding(const int id, PlayerAction* action)
{
m_default_bindings[PA_NITRO].id = KEY_KEY_N;
m_default_bindings[PA_ACCEL].id = KEY_UP;
m_default_bindings[PA_BRAKE].id = KEY_DOWN;
m_default_bindings[PA_LEFT].id = KEY_LEFT;
m_default_bindings[PA_RIGHT].id = KEY_RIGHT;
m_default_bindings[PA_DRIFT].id = KEY_KEY_V;
m_default_bindings[PA_RESCUE].id = KEY_BACK;
m_default_bindings[PA_FIRE].id = KEY_SPACE;
m_default_bindings[PA_LOOK_BACK].id = KEY_KEY_B ;
m_default_bindings[PA_NITRO].type = Input::IT_KEYBOARD;
m_default_bindings[PA_ACCEL].type = Input::IT_KEYBOARD;
m_default_bindings[PA_BRAKE].type = Input::IT_KEYBOARD;
m_default_bindings[PA_LEFT].type = Input::IT_KEYBOARD;
m_default_bindings[PA_RIGHT].type = Input::IT_KEYBOARD;
m_default_bindings[PA_DRIFT].type = Input::IT_KEYBOARD;
m_default_bindings[PA_RESCUE].type = Input::IT_KEYBOARD;
m_default_bindings[PA_FIRE].type = Input::IT_KEYBOARD;
m_default_bindings[PA_LOOK_BACK].type = Input::IT_KEYBOARD;
}
// -----------------------------------------------------------------------------
void KeyboardDevice::editBinding(PlayerAction action, int key_id)
{
m_default_bindings[action].id = key_id;
}
// -----------------------------------------------------------------------------
/** checks if this key belongs to this belongs. if yes, sets action and returns true; otherwise returns false */
bool KeyboardDevice::hasBinding(const int key_id, PlayerAction* action /* out */) const
{
/*
for(int n=0; n<PA_COUNT; n++)
{
if(m_default_bindings[n].id == key_id)
{
*action = (PlayerAction)n;
return true;
}
}// next device
*/
return m_configuration->getBinding(Input::IT_KEYBOARD, key_id, 0, action);
return m_configuration->getBinding(Input::IT_KEYBOARD, id, 0, action);
}
// -----------------------------------------------------------------------------
@ -177,28 +46,7 @@ bool KeyboardDevice::hasBinding(const int key_id, PlayerAction* action /* out */
#pragma mark gamepad
#endif
/**
* Creates a GamePade device from a config file. Note that this device will not yet be ready to be used,
* it must first be detected to be connected by irrLicht, to be properly initialized
*/
GamePadDevice::GamePadDevice(irr::io::IrrXMLReader* xml)
{
m_type = DT_GAMEPAD;
m_prevAxisDirections = NULL;
m_deadzone = DEADZONE_JOYSTICK;
const char* name_string = xml->getAttributeValue("name");
if(name_string == NULL)
{
std::cerr << "Warning, joystick without name in config file, making it undetectable\n";
}
else m_name = name_string;
m_index = -1; // Set to -1 so we can establish when a device ID has been associated
for(int n=0; n<SEvent::SJoystickEvent::NUMBER_OF_BUTTONS; n++)
m_buttonPressed[n] = false;
}
// -----------------------------------------------------------------------------
/** Constructor for GamePadDevice from a connected gamepad for which no configuration existed
* (defaults will be used)
* \param sdlIndex Index of stick.
@ -209,83 +57,24 @@ GamePadDevice::GamePadDevice(const int irrIndex, const std::string name, const i
m_deadzone = DEADZONE_JOYSTICK;
m_prevAxisDirections = NULL;
m_configuration = configuration;
m_axis_count = axis_count;
m_prevAxisDirections = new Input::AxisDirection[axis_count];
m_button_count = btnAmount;
printf("New Gamepad Created. Assigned the following configuration:\n%s", m_configuration->toString().c_str());
std::cout << "(i) This gamepad has " << axis_count << " axes and " << m_button_count << " buttons\n";
open(irrIndex, name, axis_count, btnAmount);
m_index = irrIndex;
m_name = name;
loadDefaults();
for (int i = 0; i < axis_count; i++)
m_prevAxisDirections[i] = Input::AD_NEUTRAL;
for(int n=0; n<SEvent::SJoystickEvent::NUMBER_OF_BUTTONS; n++)
m_buttonPressed[n] = false;
} // GamePadDevice
// -----------------------------------------------------------------------------
void GamePadDevice::open(const int irrIndex, const std::string name, const int axis_count, const int btnCount)
{
m_axis_count = axis_count;
m_prevAxisDirections = new Input::AxisDirection[axis_count];
m_button_count = btnCount;
std::cout << "(i) This gamepad has " << axis_count << " axes and " << m_button_count << " buttons\n";
for (int i = 0; i < axis_count; i++)
m_prevAxisDirections[i] = Input::AD_NEUTRAL;
m_index = irrIndex;
}
// -----------------------------------------------------------------------------
void GamePadDevice::loadDefaults()
{
// buttons
m_default_bindings[PA_FIRE].type = Input::IT_STICKBUTTON;
m_default_bindings[PA_FIRE].id = 0;
m_default_bindings[PA_NITRO].type = Input::IT_STICKBUTTON;
m_default_bindings[PA_NITRO].id = 1;
m_default_bindings[PA_DRIFT].type = Input::IT_STICKBUTTON;
m_default_bindings[PA_DRIFT].id = 2;
m_default_bindings[PA_RESCUE].type = Input::IT_STICKBUTTON;
m_default_bindings[PA_RESCUE].id = 3;
m_default_bindings[PA_LOOK_BACK].type = Input::IT_STICKBUTTON;
m_default_bindings[PA_LOOK_BACK].id = 4;
// axes
m_default_bindings[PA_ACCEL].type = Input::IT_STICKMOTION;
m_default_bindings[PA_ACCEL].id = 1;
m_default_bindings[PA_ACCEL].dir = Input::AD_NEGATIVE;
m_default_bindings[PA_BRAKE].type = Input::IT_STICKMOTION;
m_default_bindings[PA_BRAKE].id = 1;
m_default_bindings[PA_BRAKE].dir = Input::AD_POSITIVE;
m_default_bindings[PA_LEFT].type = Input::IT_STICKMOTION;
m_default_bindings[PA_LEFT].id = 0;
m_default_bindings[PA_LEFT].dir = Input::AD_NEGATIVE;
m_default_bindings[PA_RIGHT].type = Input::IT_STICKMOTION;
m_default_bindings[PA_RIGHT].id = 0;
m_default_bindings[PA_RIGHT].dir = Input::AD_POSITIVE;
/*
TODO - mappings for clear/enter/leave ?
set(GA_CLEAR_MAPPING,
Input(Input::IT_STICKBUTTON, 0, 2));
set(GA_ENTER,
Input(Input::IT_STICKBUTTON, 0, 0),
set(GA_LEAVE,
Input(Input::IT_STICKBUTTON, 0, 1),
*/
}
// -----------------------------------------------------------------------------
bool GamePadDevice::isButtonPressed(const int i)
{
return m_buttonPressed[i];
@ -295,13 +84,7 @@ void GamePadDevice::setButtonPressed(const int i, bool isButtonPressed)
m_buttonPressed[i] = isButtonPressed;
}
// -----------------------------------------------------------------------------
void GamePadDevice::editBinding(const PlayerAction action, const Input::InputType type, const int id, Input::AxisDirection direction)
{
m_default_bindings[action].type = type;
m_default_bindings[action].id = id;
m_default_bindings[action].dir = direction;
}
// -----------------------------------------------------------------------------
void GamePadDevice::resetAxisDirection(const int axis, Input::AxisDirection direction, ActivePlayer* player)
{
if(!StateManager::get()->isGameState()) return; // ignore this while in menus
@ -313,6 +96,7 @@ void GamePadDevice::resetAxisDirection(const int axis, Input::AxisDirection dire
return;
}
/*
for(int n=0; n<PA_COUNT; n++)
{
if(m_default_bindings[n].id == axis && m_default_bindings[n].dir == direction)
@ -321,12 +105,16 @@ void GamePadDevice::resetAxisDirection(const int axis, Input::AxisDirection dire
return;
}
}
*/
}
// -----------------------------------------------------------------------------
/**
* Player ID can either be a player ID or -1. If -1, the method only returns whether a binding exists for this player.
* If it's a player name, it also handles axis resets, direction changes, etc.
*/
bool GamePadDevice::hasBinding(Input::InputType type, const int id, const int value, ActivePlayer* player, PlayerAction* action /* out */)
{
if(m_prevAxisDirections == NULL) return false; // device not open

View File

@ -21,14 +21,15 @@ class InputDevice
friend class DeviceManager;
protected:
DeviceType m_type;
KeyBinding m_default_bindings[PA_COUNT];
ActivePlayer* m_player;
DeviceConfig* m_configuration;
public:
std::string m_name; // if device has a name; unused for keyboards since AFAIK we can't tell keyboards apart
InputDevice();
void setConfiguration(DeviceConfig *config) {m_configuration = config;}
DeviceConfig *getConfiguration() {return m_configuration;}
DeviceType getType() const { return m_type; };
@ -37,27 +38,16 @@ public:
/**
* returns a human-readable string for the key binded with the given action
*/
std::string getBindingAsString(const PlayerAction action) const;
void serialize(std::ofstream& stream);
bool deserializeAction(irr::io::IrrXMLReader* xml);
};
class KeyboardDevice : public InputDevice
{
public:
KeyboardConfig *m_configuration;
bool hasBinding(const int id, PlayerAction* action);
KeyboardDevice();
KeyboardDevice(KeyboardConfig *configuration);
KeyboardDevice(irr::io::IrrXMLReader* xml);
/** checks if this key belongs to this belongs. if yes, sets action and returns true; otherwise returns false */
bool hasBinding(const int key_id, PlayerAction* action /* out */) const;
void editBinding(PlayerAction action, int key_id);
void loadDefaults();
};
class GamePadDevice : public InputDevice
@ -66,26 +56,18 @@ class GamePadDevice : public InputDevice
bool m_buttonPressed[SEvent::SJoystickEvent::NUMBER_OF_BUTTONS];
public:
GamepadConfig *m_configuration;
Input::AxisDirection *m_prevAxisDirections;
int m_deadzone;
int m_index;
int m_axis_count;
int m_button_count;
Input::AxisDirection *m_prevAxisDirections;
/** checks if this key belongs to this belongs. if yes, sets action and returns true; otherwise returns false.
The 'player' id passed is simply to know where to send 'axis reset's when necessary*/
bool hasBinding(Input::InputType type, const int id, const int value, ActivePlayer* player, PlayerAction* action /* out */);
void editBinding(const PlayerAction action, const Input::InputType type, const int id,
Input::AxisDirection direction=Input::AD_NEUTRAL);
void open(const int irrIndex, const std::string name, const int axis_count, const int btnCount);
void loadDefaults();
bool hasBinding(Input::InputType type, const int id, const int value, ActivePlayer* player, PlayerAction* action);
GamePadDevice(const int irrIndex, const std::string name, const int axis_number, const int btnAmount, GamepadConfig *configuration);
GamePadDevice(irr::io::IrrXMLReader* xml);
bool isButtonPressed(const int i);
void setButtonPressed(const int i, bool isButtonPressed);

View File

@ -64,8 +64,6 @@ InputManager::InputManager() : m_sensed_input(0), m_mode(BOOTSTRAP),
// could not read config file so use defaults
KeyboardDevice* default_device = new KeyboardDevice();
default_device->loadDefaults();
something_new_to_write = true;
}

View File

@ -19,6 +19,7 @@
#include "audio/sfx_manager.hpp"
#include "audio/sfx_base.hpp"
#include "config/player.hpp"
#include "config/device_config.hpp"
#include "graphics/irr_driver.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/screen.hpp"
@ -222,44 +223,44 @@ namespace OptionsScreen
}
// -----------------------------------------------------------------------------
void updateInputButtons(const InputDevice* device)
void updateInputButtons(InputDevice* device)
{
{
ButtonWidget* btn = getCurrentScreen()->getWidget<ButtonWidget>("binding_up");
btn->setLabel( device->getBindingAsString(PA_ACCEL).c_str() );
btn->setLabel( device->getConfiguration()->getBindingAsString(PA_ACCEL).c_str() );
}
{
ButtonWidget* btn = getCurrentScreen()->getWidget<ButtonWidget>("binding_down");
btn->setLabel( device->getBindingAsString(PA_BRAKE).c_str() );
btn->setLabel( device->getConfiguration()->getBindingAsString(PA_BRAKE).c_str() );
}
{
ButtonWidget* btn = getCurrentScreen()->getWidget<ButtonWidget>("binding_left");
btn->setLabel( device->getBindingAsString(PA_LEFT).c_str() );
btn->setLabel( device->getConfiguration()->getBindingAsString(PA_LEFT).c_str() );
}
{
ButtonWidget* btn = getCurrentScreen()->getWidget<ButtonWidget>("binding_right");
btn->setLabel( device->getBindingAsString(PA_RIGHT).c_str() );
btn->setLabel( device->getConfiguration()->getBindingAsString(PA_RIGHT).c_str() );
}
{
ButtonWidget* btn = getCurrentScreen()->getWidget<ButtonWidget>("binding_fire");
btn->setLabel( device->getBindingAsString(PA_FIRE).c_str() );
btn->setLabel( device->getConfiguration()->getBindingAsString(PA_FIRE).c_str() );
}
{
ButtonWidget* btn = getCurrentScreen()->getWidget<ButtonWidget>("binding_nitro");
btn->setLabel( device->getBindingAsString(PA_NITRO).c_str() );
btn->setLabel( device->getConfiguration()->getBindingAsString(PA_NITRO).c_str() );
}
{
ButtonWidget* btn = getCurrentScreen()->getWidget<ButtonWidget>("binding_drift");
btn->setLabel( device->getBindingAsString(PA_DRIFT).c_str() );
btn->setLabel( device->getConfiguration()->getBindingAsString(PA_DRIFT).c_str() );
}
{
ButtonWidget* btn = getCurrentScreen()->getWidget<ButtonWidget>("binding_rescue");
btn->setLabel( device->getBindingAsString(PA_RESCUE).c_str() );
btn->setLabel( device->getConfiguration()->getBindingAsString(PA_RESCUE).c_str() );
}
{
ButtonWidget* btn = getCurrentScreen()->getWidget<ButtonWidget>("binding_look_back");
btn->setLabel( device->getBindingAsString(PA_LOOK_BACK).c_str() );
btn->setLabel( device->getConfiguration()->getBindingAsString(PA_LOOK_BACK).c_str() );
}
}
@ -462,7 +463,7 @@ namespace OptionsScreen
std::cout << "% Binding " << KartActionStrings[binding_to_set] << " : setting to keyboard key " << sensedInput->btnID << " \n\n";
KeyboardDevice* keyboard = input_manager->getDeviceList()->getKeyboard(0);
keyboard->editBinding(binding_to_set, sensedInput->btnID);
keyboard->getConfiguration()->setBinding(binding_to_set, Input::IT_KEYBOARD, sensedInput->btnID, Input::AD_NEUTRAL);
// refresh display
initInput(NULL, "init");
@ -503,7 +504,7 @@ namespace OptionsScreen
}
GamePadDevice* gamepad = input_manager->getDeviceList()->getGamePad(gamepadID);
gamepad->editBinding(binding_to_set, sensedInput->type, sensedInput->btnID,
gamepad->getConfiguration()->setBinding(binding_to_set, sensedInput->type, sensedInput->btnID,
(Input::AxisDirection)sensedInput->axisDirection);
// refresh display