Преглед изворни кода

Add InputManager::num_joypads()

Daniele Bartolini пре 10 година
родитељ
комит
50b5d9cdfb
2 измењених фајлова са 8 додато и 0 уклоњено
  1. 5 0
      src/input/input_manager.cpp
  2. 3 0
      src/input/input_manager.h

+ 5 - 0
src/input/input_manager.cpp

@@ -225,6 +225,11 @@ InputDevice* InputManager::touch()
 	return _touch;
 	return _touch;
 }
 }
 
 
+uint8_t InputManager::num_joypads()
+{
+	return CE_COUNTOF(_joypad);
+}
+
 InputDevice* InputManager::joypad(uint8_t i)
 InputDevice* InputManager::joypad(uint8_t i)
 {
 {
 	CE_ASSERT(i < CROWN_MAX_JOYPADS, "Index out of bounds");
 	CE_ASSERT(i < CROWN_MAX_JOYPADS, "Index out of bounds");

+ 3 - 0
src/input/input_manager.h

@@ -31,6 +31,9 @@ public:
 	/// Returns the default touch input device.
 	/// Returns the default touch input device.
 	InputDevice* touch();
 	InputDevice* touch();
 
 
+	/// Returns the number of joypads.
+	uint8_t num_joypads();
+
 	/// Returns the joypad @a i.
 	/// Returns the joypad @a i.
 	InputDevice* joypad(uint8_t i);
 	InputDevice* joypad(uint8_t i);