Explorar o código

Add InputManager::num_joypads()

Daniele Bartolini %!s(int64=10) %!d(string=hai) anos
pai
achega
50b5d9cdfb
Modificáronse 2 ficheiros con 8 adicións e 0 borrados
  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;
 }
 
+uint8_t InputManager::num_joypads()
+{
+	return CE_COUNTOF(_joypad);
+}
+
 InputDevice* InputManager::joypad(uint8_t i)
 {
 	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.
 	InputDevice* touch();
 
+	/// Returns the number of joypads.
+	uint8_t num_joypads();
+
 	/// Returns the joypad @a i.
 	InputDevice* joypad(uint8_t i);