iCade Support?

Previous topic - Next topic

Gary

Quote from: stinky ox on 2011-Sep-15
:nw: :nw: :nw: :nw: :nw: :nw: :nw: :nw: :nw: :nw: :nw: :nw:

Kitty has competition for the title of coding god on the forum now :)

Anyone know the wereabouts of Matt Smith? :)

Kitty Hello

Quote from: stinky ox on 2011-Sep-15
I basically made the insertText method maintain a single bitmap of all the switch states in a single longword.

You mean - once there has been one character "posted" to the hidden input field, a keyboard seems to be attached? Awesome!

spacefractal

in my game, in Wondows and other devices with keyboard, if there is is some key pressed the pointer is gone, but if you move the mouse, the pointer is back. The last one would of course been hidden in iOS. Buts its that way I would detect touchscreen/keyboard, so its really transperancy.

Also its really stubid move Apple due, just becaues they might not like some thing like that, but its dont break anything at all. You can dedicate to support it as a alternativt or not. So here I dont understand Apple.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

mrplant

If anyone needs anything tested - I have available Ipad2 and iCade unit (as well as apple Bluetooth keyboard).

Kitty Hello

OK, it's working.
The only drawback is: The iCade protocol uses the keys "Z" and "Y", which are SWAPPED on a German keyboard layout. Oh. My.

So you will have to switch to the US keyboard layout before playing iCade/iTouchPad games (in iCade mode).

I hope I can find the keyboard layout to fix that, soon. Otherwise, the iPadControl default "keyboard setting" might be another option to implement instead.
I'll talk to iCade people.

Update during the weekend.

The GETNUMJOYSTICKS() will return "2" once you pressed one button on the iCade. Before that it returns "1", which is the acceleration "Joystick".

The GETJOYX(1), GETJOYY(1) and GETJOYBUTTON(1, n) will return the button/dpad state. I currently implemented 4 buttons to be compatible with the iCade/Atari Arcade.

So long and thanks for all the fish.







mrplant

#20
Sounds amazing!!!

The way its been implemented is very elegant.

Will report all findings!!

Ian Price

Another fantastic feather in GLBasic's already bulging cap =D
I came. I saw. I played.

spacefractal

they allready stated on homepage you need to select "US" keyboard. damn. Its a US unit, so of course they are not aware some keyboards might have keys swapped, which is a common issue in German Keyboads.

If Z and Y is both used, I do guess the values could been swapped if its in German status, or alternative simply let users remap thier buttons before use (etc its could automatic popin when some button is pressed).
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kitty Hello

OK, update is live. Read the logfile for more info.

Yes, the Y/Z issue is a true pain. I hope there's a way to detect the keyboard layout.
Otherwise, I contact iCade and ask for a bugfix. I have a solution to fix it.

spicypixel

This sounds interesting would you mind re-iterating how you grab the iCade information from within GLB. I'm also a little confused about the keys issue I thought this was joystick directions and joystick buttons?
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

mrplant

>I'm also a little confused about the keys issue I thought this was joystick directions and joystick buttons?

The iCade interfaces with iOS by simulating virtual keys being pressed/released. I wasn't aware that German keyboards swapped Y and Z previous so I learnt something interesting there. I hope there is a workaround for getting around this issue.

mrplant

#26
I applied the new update then the standard joystick demo in the help file and checked I have the iCade connected ok. I ran one of Jeff's games to verify it works and it does. My keyboard is set to UK (US layout) but for some reason,
when running on the iPad it can only see the acceleration device only.
I did a bit of manual poking around reading GETJOYX(1) directly and wrote values to screen etc. but still same result. Strange..

When I force it to read the GETJOYX(1) and GETJOYY(1) and button(1) values it seems to be reading a copy of the accelerometer device again. Mind you I am reading from 1 more than the number of joysticks reported, if you
follow.. as It is not actually registering the iCade device.

Anyone else get it to work?

Kitty Hello

try a text box. Does it instert characters when you press a button?
I found a way to get the z,y swap issue fixed! When you press down and then up, the "down" position is still locked. That cant be! Thus you must have a German layout  that way the first down/up movement is a bit broken, but at least it works ok then.

mrplant

Hi. Thats great you have worked around the YZ/ZY issue.
You are saying to create a text box - I take it you mean something link input A$,0,0
I tried this on the iPad and had a flashing cursor but the iCade didn't put in any characters when I pressed things on it.
I also synced up my apple bluetooth keyboard and same there - but I wasn't really expecting that to work. :S
Again, I am not sure if I am testing exactly what you meant above..

I will post some screenshots later of what my test program is seeing.

mrplant

#29
This is my test code for running on the iPad - its mainly the example program provided in the HELP file except I am being naughty and forcing it to read devices that may or may not exist!

// Joy test code below:
//
// iCade Suport Notes:
//
//   - Start App, then press one button on iCade
//  - n% = GETNUMJOYSTICK() returns "2" now on iOS.
//  - GETJOYX(1), GETJOYY(1) and GETJOYBUTTON(1,n) to get status.

LOADFONT "ZXFont.png",1 // This is a 512X256 font (32x32). My screen res is 1024x768! (iPad Landscape)
SETFONT 1

CLEARSCREEN RGB(0,0,0) // Set the backbuffer background colour to Black.
SHOWSCREEN // Show it.
LOCAL a$, b$
LOCAL i%, b%,n

WHILE TRUE
   b = GETNUMJOYSTICKS()
   IF b = 0
      BigPrint ("SCANNING - PLUG IN JOYSTICK NOW.",0,22,1)
      BigPrint ("(NO JOY DEVICES DETECTED)",4,23,1)
   ENDIF

FOR i=0 TO 1 // Bad code here as I am forcing use of joystick numbers instead of reading count in GETNUMJOYSTICKS!!!! But as a test...
  BigPrint ("JOY "+i+" NAME=("+GETJOYNAME$(i)+")", 0, i*9,1 // Name of Device
  BigPrint ("X:"+GETJOYX(i) + " Y:"+GETJOYY(i)+ " Z:"+ GETJOYZ(i),0,(i*9)+1,1) // XYZ-Position
  BigPrint ("RX:"+GETJOYRX(i) + " RX:"+GETJOYRY(i)+ " RX:"+GETJOYRZ(i),0,(i*9)+2,1) // XYZ-Rotation
  a$=""
  FOR n=0 TO 5 // Only look at a few buttons
   a$=a$+"B"+n+":"+GETJOYBUTTON (i, n)+" "
  BigPrint (a$, 0, (i*9)+3,1)

  NEXT
  a$=""
     FOR n=6 TO 10 // Up to 32 Buttons
   a$=a$+"B"+n+":"+GETJOYBUTTON (i, n)+" "
  NEXT
  BigPrint (a$, 0, (i*9)+4,1)

  // DIGI-Joystick
  b$="DX:"+ GETDIGIX(i)+" DY:"+GETDIGIY(i)
  BigPrint (b$, 0, (i*9)+5,1)
NEXT
SHOWSCREEN
SLEEP (75)
WEND


///////////////////////////////////////
//   Big Print
///////////////////////////////////////


FUNCTION BigPrint: Print$, XCoord%, YCoord%, FontNum%
   // 0 means use currently set font again!
   IF FontNum%
      SETFONT FontNum% // Select Font
   ENDIF
   PRINT Print$,32*XCoord,32*YCoord,FALSE // Force fixed width!
ENDFUNCTION

This code produces an output like this on the iPad when running whilst synced with the iCade.

http://www.pictureviewerpro.com/storage/gen/test.png

And yes, that is the Sinclair ZX81 font!! A little project I have going.... :S