Controll on android

thank you very much for help, i would never have figure it out by myself :wink:
that’s solved problem :wink: awesome

maybe you found some mistakes in my code design ? You have much more experience than me :wink:

1 Like
@SetasSan said: thank you very much for help, i would never have figure it out by myself ;) that's solved problem ;) awesome

maybe you found some mistakes in my code design ? You have much more experience than me :wink:

Actually, it all looked good to me. But, I’m a semi-hack… so don’t take my word as gold.

The only thing you may want to experiment with is adding all of the bricks as QuadData in a single AnimElement.

Don’t change your existing code… create a new class you can swap out, as this might have a negative impact on Android… then again… it may be better. The tradeoff is:

1 object in your scene as apposed to the # of bricks.

for

Updating the mesh buffers when you remove a brick.

Since you only remove them occasionally, you may see an increase (slight) in fps since the single object is static until a brick is hit.

1 Like

ok i will try that, thank you :wink:

here I’m again ;D
if you haven’t got tired of me, can you look again in test.

in main class event is not firing ( on android), on pc it’s working
[java]
@Override
public void onMouseMotionEvent(MouseMotionEvent evt) {
player.moveBrick(evt.getX());
if(!ball.isActive()){
ball.moveBall(evt.getX());
}
}
[/java]

if in andoid i’m minimaizing the game and taking it back this event starts working, i linked test down if you need it.

maybe i should use different event ?

Test

@SetasSan said: here I'm again ;D if you haven't got tired of me, can you look again in test.

in main class event is not firing ( on android), on pc it’s working
[java]
@Override
public void onMouseMotionEvent(MouseMotionEvent evt) {
player.moveBrick(evt.getX());
if(!ball.isActive()){
ball.moveBall(evt.getX());
}
}
[/java]

if in andoid i’m minimaizing the game and taking it back this event starts working, i linked test down if you need it.

maybe i should use different event ?

Test

Taking a look at it now…

Do you have logging disabled or something? I can’t get any output through logcat.

nope i haven’t disabled it

I’m seeing the same issue with focus being lost. But, I can’t repro this with any of my projects.

Have you made any alterations to you res > layout > main.xml?
Or your Android Main Activity class?

In this project i was not touching those files

Did you by chance update to the latest JME build before creating this project? It looks like there was an update for android support and I’m wondering if the problem isn’t there.

MainActivity.view is losing focus as soon as it is created.

I’m not sure to tag in this to for support as most Android support requests go unanswered if not answered by another user. @nehon ? @normen ? @pspeed ? Do any of you know who is handling the Android issues now?

Yes I have updated to the latest JME build.
And i don’t know who is handling those issues. Damn…

and i noticed if i’m touching screen before game has started it’s gives null point exception related onTouchEvent

There is definitely something wrong with the current build.

I set screenOrientation in MainActivity to:

[java]
screenOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
[/java]

And started the game and flipped my tablet. Nothing happens =(

So we should wait for other guys . Damn…

@SetasSan said: So we should wait for other guys . Damn...

I know this makes it harder to develop with this, however… I believe you’ll want to change your onTouchEvent method to something like below, since simulateMouseEvents is disabled. This will cover the Android side of things, while you mouse events will handle the rest.

[java]
@Override
public void onTouchEvent(TouchEvent evt) {
if (evt.getType() == TouchEvent.Type.MOVE) {
player.moveBrick(evt.getX());
if(!ball.isActive()){
ball.moveBall(evt.getX());
}
} else if (evt.getType() == TouchEvent.Type.UP) {
if (!ball.isActive()) {
ball.setActive(true);
updateGUI = true;
gameOn = true;
}
}
}
[/java]

1 Like

That’s exactly what I was looking for a while ago. Thank you. I hope someday I will get a wife like you xD

1 Like

I forgot to mention 2 things:

  1. It took me a while to get back to you at first because I started the game and at least had to clear the screen before stopping it =)
  2. After minimizing the app and maximizing it again on Android, it ran really well! Can’t wait to play the final version. (I actually liked Pong/Breakout/etc)
1 Like

The final version is possible only with your help. But it looks like we will make it ;D

1 Like
@SetasSan said: The final version is possible only with your help. But it looks like we will make it ;D

Np there. Happy to see someone else is daring enough to write something in an undocumented framework :wink:

it’s working, and i don’t need to minimize.
I have removed all stuff from onMouseButtonEvent(MouseButtonEvent evt) and used only onTouchEvent(TouchEvent evt) event, and now it is working. so I thing is bad idea to use both of them or at least you need to identify on which platform game is running.

P.S still getting Null point exception if i’m touching screen before game has started