iCade thoughts/solutions?

Monkey Targets Forums/iOS/iCade thoughts/solutions?

ElectricBoogaloo(Posted 2013) [#1]
I'm annoyed that what I coded didn't work!
I imagined that, since the iCade sends keypress signals, supporting it would be as simple as adding a bunch of "KeyHit()" if statements, and then converting those to a button-push array that I can then deal with wherever needed.

It didn't work.
In fact, it didn't appear to get any input whatsoever.

Do I need to enable something, somewhere, for "bluetooth keyboard" support? Or do I need something more to get this working?


skid(Posted 2013) [#2]
Unfortunately MonkeyView does not implement the UIKeyInput delegate protocol. Will take a look as I can test with standard bluetooth keyboard...

What version of Monkey are you running?

Have you tried the EnableKeyboard test in bananas/mak?

[edit]

I just installed the keyboard test and tested with bluetooth keyboard and it works fine, doesn't even show the software keyboard...


ElectricBoogaloo(Posted 2013) [#3]
D'oh!
Serves me right for lazily not RTFM!
KeyHit() doesn't work with EnableKeyboard()/Bluetooth/iOS, only GetChar() does.
Rejigged, took a jiffy, working nicely.
Thanks, skid!

Working nicely, now, although it's currently QWERTY Layout. Not a clue how I can find out what language the current layout is in, for other-keyboard support. Any thoughts?

If iCadeControls=1
	Repeat
		a=GetChar()
		If a>0
		Select String.FromChar(a)
			Case "W","w"	but[0]=2
			Case "E","e"	but[0]=0

			Case "X","x"	but[8]=2
			Case "Z","z"	but[8]=0

			Case "A","a"	but[3]=2
			Case "Q","q"	but[3]=0

			Case "D","d"	but[5]=2
			Case "C","c"	but[5]=0


			Case "Y","y"	but[13]=2
			Case "T","t"	but[13]=0

			Case "U","u"	but[14]=2
			Case "F","f"	but[14]=0

			Case "I","i"	but[15]=2
			Case "M","m"	but[15]=0

			Case "O","o"	but[16]=2
			Case "G","g"	but[16]=0


			Case "H","h"	but[10]=2
			Case "R","r"	but[10]=0
			
			Case "J","j"	but[11]=2
			Case "N","n"	but[11]=0

			Case "K","k"	but[12]=2
			Case "P","p"	but[12]=0

			Case "L","l"	but[17]=2
			Case "V","v"	but[17]=0
			
		End Select
		DebugLog(a)
		Endif
	Until a=0
	
Endif



Grey Alien(Posted 2013) [#4]
So the iCade it's digital not analogue I guess if you can only read GetChar()?

For one player left/right and fire which keys do I use please? Thx!


muddy_shoes(Posted 2013) [#5]
http://www.raywenderlich.com/8618/adding-icade-support-to-your-game


Grey Alien(Posted 2013) [#6]
Cool thanks!


Spinal(Posted 2013) [#7]
Is there a way to invoke keyboard input without the onecreen keyboard popping up? All of the games I have seen with iCade support never show the keyboard, even when an external keyboard is not present.


ElectricBoogaloo(Posted 2013) [#8]
It probably means digging inside the Monkey-generated code, finding the "EnableKeyboard" bit, and perhaps hiding the keyboard-layer behind the game-layer, or something.

I dunno.


Winterstein(Posted 2013) [#9]
Just tried the "GetChar" stuff in my game and it literally worked out of the box! Thank you for sharing!

The keyboard never shows up in my game though (which is a good thing)

If you are still puzzled with the QWERTY Layout problem: as far as I know, the "official" statement is "make the user switch to QWERTZ". The iCade is only designed with QWERTZ in mind :(


ElectricBoogaloo(Posted 2013) [#10]
You know what... I completely forgot that was even a problem!
Truth be told, once I'd got the basic iCade support working in my framework, I pretty much ignored it.
It's there if people want to use it, but so far I haven't actually coded anything that NEEDS it.
.. Good to support, I suppose, but. .. *shrugs*

.. That's a good £50 wasted!