The Dink Network

Reply to Re: DinkHD Android Controller woes

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
July 10th 2018, 09:14 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
I was looking into getting one of those; it would make playing Dink a whole lot more tolerable than touch controls.

I looked into the source, and I'm not sure what's going on.

Here, Seth's binding the keys; the third parameter is what's in the platform-specific code, and the fourth parameter is what's in the Dink-specific code (sometimes identical, but not always):
		AddKeyBinding(pComp, "Left", VIRTUAL_KEY_DIR_LEFT, VIRTUAL_KEY_DIR_LEFT);
		AddKeyBinding(pComp, "Right", VIRTUAL_KEY_DIR_RIGHT, VIRTUAL_KEY_DIR_RIGHT);
		AddKeyBinding(pComp, "Up", VIRTUAL_KEY_DIR_UP, VIRTUAL_KEY_DIR_UP);
		AddKeyBinding(pComp, "Down", VIRTUAL_KEY_DIR_DOWN, VIRTUAL_KEY_DIR_DOWN);
		AddKeyBinding(pComp, "Talk", ' ', VIRTUAL_KEY_GAME_TALK);

		AddKeyBinding(pComp, "GamePadInventory", VIRTUAL_DPAD_SELECT, VIRTUAL_KEY_GAME_INVENTORY);
		AddKeyBinding(pComp, "GamePadInventory2", VIRTUAL_DPAD_BUTTON_UP, VIRTUAL_KEY_GAME_INVENTORY);
		AddKeyBinding(pComp, "GamePadEscape", VIRTUAL_DPAD_START, VIRTUAL_KEY_BACK, true);
		AddKeyBinding(pComp, "GamePadFire", VIRTUAL_DPAD_BUTTON_DOWN, VIRTUAL_KEY_GAME_FIRE);
		AddKeyBinding(pComp, "GamePadTalk", VIRTUAL_DPAD_BUTTON_RIGHT, VIRTUAL_KEY_GAME_TALK);
		AddKeyBinding(pComp, "GamePadMagic", VIRTUAL_DPAD_BUTTON_LEFT, VIRTUAL_KEY_GAME_MAGIC);
		
		AddKeyBinding(pComp, "GamePadSpeedup", VIRTUAL_DPAD_LBUTTON, 'M', true);
		AddKeyBinding(pComp, "GamePadSpeedup2", VIRTUAL_DPAD_RBUTTON, 9);
	
		AddKeyBinding(pComp, "GamePadInventory3", VIRTUAL_DPAD_LTRIGGER, VIRTUAL_KEY_GAME_INVENTORY);
		AddKeyBinding(pComp, "GamePadPause", VIRTUAL_DPAD_RTRIGGER, VIRTUAL_KEY_BACK, true);
In the android specific code, he has this:
	case 4:
		//actually this will never get hit, the java side will send VIRTUAL_DPAD_BUTTON_RIGHT directly, because it
		//shares stuff with the back button and has to detect which one it is on that side
		keycode = VIRTUAL_DPAD_BUTTON_RIGHT;
		break;
'case 4' is the Android keycode, so that is supposed to be translated into talking. But 4 is actually KEYCODE_BACK in Android-speak. Despite what the comment says, this doesn't seem to work.

I couldn't find anywhere that the Android platform code sets VIRTUAL_DPAD_BUTTON_DOWN, which means there is no way to attack with Android if I'm reading the code correctly.

According to the android docs (https://developer.android.com/training/game-controllers/controller-input), they have several keycodes defined for the buttons, and we could probably convince Seth to update the buttons with something reasonable.

What should the buttons do?

Maybe something like this?
LB - Map (button6)
RB - Turbo Mode
LT - Nothing
RT - Nothing
Start - Escape Menu
Sel - DinkHD Menu
X - Attack
A - Talk
B - Magic
Y - Inventory (but not wonky)