I’m on my way to work on the gamepad support. But I found this interface method on the JoyInput class (see below). What does it do? How does it work?
Firstable, the InputManager class creates an instance of Joyinput instead of implementing it. I didn’t know you could do that with an interface.
Secondable, the loadJoysticks method returns something of the type JoyStick but the method doesn’t have a return statement. What’s happening here? Also, the returned JoyStick value is supposed to be an array but the InputManager’s call of this method doesn’t ask for a Joystick[] array.
[java]
package com.jme3.input;
…JoyInput…
{
/**
* Loads a list of joysticks from the system.
*
* @param inputManager The input manager requesting to load joysticks
* @return A list of joysticks that are installed.
*/
public Joystick[] loadJoysticks(InputManager inputManager);
}
[/java]
This is the other code (see below) that calls the method above .
[java]
package com.jme3.input;
…InputManager…
{
public InputManager(MouseInput mouse, KeyInput keys, JoyInput joystick, TouchInput touch) {
JoyInput joysticks = joystick.loadJoysticks(this); // JoyInput word was added for illustration purposes, it doesn't appear on the real code
@Pixelapp said:
I'm on my way to work on the gamepad support. But I found this interface method on the JoyInput class (see below). What does it do? How does it work?
@Pixelapp said:
Firstable, the InputManager class creates an instance of Joyinput instead of implementing it. I didn't know you could do that with an interface.
@Pixelapp said:
Secondable, the loadJoysticks method returns something of the type JoyStick but the method doesn't have a return statement. What's happening here? Also, the returned JoyStick value is supposed to be an array but the InputManager's call of this method doesn't ask for a Joystick[] array.
…and now you’ve totally lost me. What code are you looking at?