Android Extras (Micro Game Consoles/GPS/Keyboard/Audio)

Previous topic - Next topic

spacefractal

#60
I'm can't remember the right stick name (mightbeen called it "RightLeft"? For right stick pressed left?), but it's should been supported and tags could been seen in game controllers function. I'm look when went home.

Also you can see the full returned string what it get when you update the game controller function. So look there.

Back button can been checked by game controller function too ("
GameControllers("Menu",0)" if I'm remember correct. I'm did that for greedy mouse.

Howover I'm on ski vaccation and is first home in few days.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Ian Price

Cheers. And please have a safe vacation - no broken legs, arms or anything more serious. :)
I came. I saw. I played.

spicypixel

I have attempted to use the EnableBackButton flag and have set it to both FALSE and TRUE and on my device it seems to do nothing at all but exit the app when I press the back button. I also added the code for GameControllers too to try to change my App State and again all it did was exit the app, regardless of the EnableBackButton flag being set for either FALSE or TRUE. Please see the enclosed photo to show the button I'm pressing to make sure I'm not being an absolute gibbon here.

Code (glbasic) Select

EnableBackButton(FALSE)
//EnableBackButton(TRUE)

IF GameControllers("Menu",0)
APPSTATE% = AS_GAME_DONE%
ENDIF


My test device here is a Star B6000 Chinese Android phone, and I was wondering if this was the issue or indeed I am a closer descendant to the gibbon than I realise :-)
Thanks in advance for any info here or pointers (especially regarding heritage).

//Spicy
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.

spicypixel

On my Star B6000 device I'm getting lots of issues when I quit/resume my game. I did begin to think it was my code as I implemented all the relevant commands needed into a full game and not implementing it from the ground up. However I have been experiencing similar issues resuming my the e sample application, and have been experiencing the same issues. I can only presume there are some stability issues on certain devices as such I might have to abandon AE which is a shame as it's awesome :-(

I am getting hangs (black screen), music playing (app not starting) and other such quirks when resuming on my device when testing with the sample application. Any ideas guys?
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.

spacefractal

#64
im was not home, "Menu", should have been "Pause", which was mapped to the back button. Sorry for the confuction.

In newest version, Back when menu is enabled will quit, while back when menu is disabled will pause the app. Its property confuction how its works, so im changes that in the next version (very soon, im was just been home from my vacation).

PS. Look like its a bug in the latest SDLActivity.java, im got its fixed as important one. Im forget a "Return False;" in one place. Sorry SpicyPixel.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Ian Price

Still can't find a right control stick for OUYA. I looked in the Java file and throughout Androids Extras, I'm no expert, but couldn't see anything that might fit the bill. And I know nothing about Java, so adding it wouldn't be possible for me.
I came. I saw. I played.

spacefractal

name for the right stick was "PadR_Left", "PadR_Right", "PadR_Up", "PadR_Down". its was stated in the GameControllers function under SetButtonLayout case.

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Ian Price

It doesn't work though - that's what I was using. I did state that in my original post (I think).

[EDIT] Yep

QuoteThe source mentions a "Rpad_Left" etc., which I assumed to be for the right stick, but this doesn't seem to work and there are no controllers with a right D-pad that I'm aware of. I'm using v1.6 of Android Extras (I think).

Ahh, noticed it's PadR nor RPad (D'oh). OK. Cheers. Will try that. Maybe I did already. Can't remember now though.
I came. I saw. I played.

spacefractal

you was named as "Rpad_Left", which is incorrect. howover im look what its happens and why. Then im will fix that as well the back button issue.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Ian Price

Actually nope. I didn't do it wrong in my code at all. PadR_Left/Right etc. doesn;t work on OUYA. I just mistyped it in the forum.
I came. I saw. I played.

spacefractal

its not a bug in the GameControllers.java due the string in ANDROIDKEYS$ does contain the right stick as well (its a variable which hold all button states on all buttons/controllers pressed as a returned string. Its works fine here when im stdout ANDROIDKEYS$ to the logcat.

Howover that can been eventuelly been a process bug in GameControllers() function eventuelly (not checked). There is different between small and big letters as well (howover im should do have lcase them).
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Ian Price

Yeah, I was  careful to check that (upper/lowercase). I checked through the AndroidExtras when it didn't work. That's why I wrote here - I always try to check everything twice before seeking help.

I'll check with Java and AndroidExtras to ensure that the case is the same. It's no big deal as I was hoping to offer the Right stick as and alternative control scheme.
I came. I saw. I played.

spacefractal

#72
Im guess im know what it happens.

The right stick is a analog one. That stick  does FIRST works after the first digital button press. The reason im did that is because the remap functions did newer works correctly with analoge controls, before after its have detected the controller name (the remap function was too aggresive on normale Android devices).

So tryout "Press a button" and then the right stick should works.

So until now for your game, just do a "press a button" to activate the menu screen when the game starts. That will hide the issue....

edit:
its no reason doing that on OUYA, but on other android based console. So if you want to checks out, you can in GameControllers.java in around line 192 change this line:

if (motion==1) return false;

to

if (motion==1 && isOuya==false) return false;
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Ian Price

No, I noticed that with the other (left) stick - not working until digital button pressed. It makes no difference with the right stick.

I'll try that code later and let you know how I get on.
I came. I saw. I played.

spacefractal

odd since its works nice here and just see it working nice in Greedy mouse.

here is the GameControllers$ function im uses (if its make different?):

Code (glbasic) Select

FUNCTION GameControllers: Command$, PlayerID=0
STATIC ANDROIDKEYS$=""
STATIC KEYTIMER

KEYTIMER=KEYTIMER+1
IF KEYTIMER<60
RETURN
ENDIF
KEYTIMER=100

// this require before invoking keys, example after a SHOWSCREEN or in your controller code.
SELECT Command$

CASE "Update"
IF ANDROIDKEYS$="" THEN GameControllers("SetButtonLayout")
ANDROIDKEYS$=CallJava$("JoyUpdateKeys")
// this retrive all inputs from the first PlayerID connected. If you doing a multiplayer game
// you need set a PlayeerID after invoking this (can been done on a "press button for player 1 screen").
ButtonRemapMessage$=""
IF LEFT$(ANDROIDKEYS$, 8)="Message=" THEN ButtonRemapMessage$=RIGHT$(ANDROIDKEYS$, LEN(ANDROIDKEYS$)-8)
DEPRINT("got: "+ANDROIDKEYS$)
CASE "SetButtonLayout"
// Java controller codes supported for remap (MouseX and MouseX cant been remapped):
// {"Left", "Right", "Up", "Down"
// "PadL_Left", "PadL_Right", "PadL_Up", "PadL_Down"
// "PadR_Left", "PadR_Right", "PadR_Up", "PadR_Down"
// "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8"
// "TriggerLeft", "TriggerRight"
LOCAL layout$="Left=Move Left;Right=Move Right;Up=Move Up;Down=Move Down;b1=Look Map;b2=Pause/Menu";
CallJava$("JoySetButtonLayout:"+layout$)
ENDSELECT

// any other command will detect the current button from the current ANDROIDKEYS$ list. All buttons value
// do return value between 0 and 1. Some buttons can analog as well and will return a float.
LOCAL start=INSTR(ANDROIDKEYS$, "Player="+PlayerID)
start=INSTR(ANDROIDKEYS$, Command$+"=", start)
start=start+LEN(Command$)+1
LOCAL finish=INSTR(ANDROIDKEYS$," ", start-1)
LOCAL value$=MID$(ANDROIDKEYS$, start, finish-start)
RETURN value$
ENDFUNCTION


and here is the control code:
Code (glbasic) Select

KD=0; KR=0; KL=0; KU=0;
IF GameControllers("Down")>600 OR GameControllers("PadL_Down")>600 OR GameControllers("PadR_Down")>600 THEN KD=1
IF GameControllers("Up")>600 OR GameControllers("PadL_Up")>600 OR GameControllers("PadR_Up")>600 THEN KU=1
IF GameControllers("Left")>600 OR GameControllers("PadL_Left")>600 OR GameControllers("PadR_Left")>600  THEN KL=1
IF GameControllers("Right")>600 OR GameControllers("PadL_Right")>600 OR GameControllers("PadR_Right")>600 THEN KR=1


That did works here.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/