Daniele Bartolini 8 anni fa
parent
commit
a2219abaf9

+ 5 - 5
src/device/device.cpp

@@ -232,19 +232,19 @@ bool Device::process_events(bool vsync)
 				switch (ev.device_id)
 				{
 				case InputDeviceType::KEYBOARD:
-					im->keyboard()->set_button_state(ev.button_num, ev.pressed);
+					im->keyboard()->set_button(ev.button_num, ev.pressed);
 					break;
 
 				case InputDeviceType::MOUSE:
-					im->mouse()->set_button_state(ev.button_num, ev.pressed);
+					im->mouse()->set_button(ev.button_num, ev.pressed);
 					break;
 
 				case InputDeviceType::TOUCHSCREEN:
-					im->touch()->set_button_state(ev.button_num, ev.pressed);
+					im->touch()->set_button(ev.button_num, ev.pressed);
 					break;
 
 				case InputDeviceType::JOYPAD:
-					im->joypad(ev.device_num)->set_button_state(ev.button_num, ev.pressed);
+					im->joypad(ev.device_num)->set_button(ev.button_num, ev.pressed);
 					break;
 				}
 			}
@@ -272,7 +272,7 @@ bool Device::process_events(bool vsync)
 				switch (ev.device_id)
 				{
 				case InputDeviceType::JOYPAD:
-					im->joypad(ev.device_num)->set_connected(ev.connected);
+					im->joypad(ev.device_num)->_connected = ev.connected;
 					break;
 				}
 			}

+ 1 - 6
src/device/input_device.cpp

@@ -105,12 +105,7 @@ u8 InputDevice::axis_id(StringId32 name)
 	return UINT8_MAX;
 }
 
-void InputDevice::set_connected(bool connected)
-{
-	_connected = connected;
-}
-
-void InputDevice::set_button_state(u8 i, bool state)
+void InputDevice::set_button(u8 i, bool state)
 {
 	CE_ASSERT(i < _num_buttons, "Index out of bounds");
 	_last_button = i;

+ 1 - 3
src/device/input_device.h

@@ -70,9 +70,7 @@ struct InputDevice
 	/// Returns the id of the axis @a name of UINT8_MAX if no matching axis is found.
 	u8 axis_id(StringId32 name);
 
-	void set_connected(bool connected);
-
-	void set_button_state(u8 i, bool state);
+	void set_button(u8 i, bool state);
 
 	void set_axis(u8 i, const Vector3& value);
 

+ 3 - 3
src/device/input_manager.cpp

@@ -208,9 +208,9 @@ InputManager::InputManager(Allocator& a)
 			);
 	}
 
-	_keyboard->set_connected(true);
-	_mouse->set_connected(true);
-	_touch->set_connected(true);
+	_keyboard->_connected = true;
+	_mouse->_connected = true;
+	_touch->_connected = true;
 }
 
 InputManager::~InputManager()