Making GUI ELements "dead spots" for android

Hi there!

This is probably a questions for @t0neg0d, so here it goes.

I’m making a game for Android that requires two fingers on the screen at once. One is the awesome t0neg0d joystick, the other is just the default click drag for the chase cam.

Combining these two effects can hopefully create a smooth joystick/aiming ability for android.

However, the current controls only allow for one to be done at a time, as two fingers will engage the zoom function.

If somehow the joystick area became unresponsive or a dead spot to allow for touching the screen elsewhere without engaging the two finger zoom function!

Here’s the github

I still have yet to find a solution to this D’=

Any input would be helpful!

@BigBob said: I still have yet to find a solution to this D'=

Any input would be helpful!

Gah… I’m glad you posted to this again. I read it at night and then completely forgot.

Tomorrow when I get up, I’ll see if I can figure out a way to do this.

You have multitouch enabled, correct?

One thing you can try in the mean time is… extend Joystick and add the TouchListener. on touchDown and touchMove, check if the Event.Type == Zoom and consume the event so it does forward to you app. This will stifle one of the two events creating the zoom event and the second event should pass through as camera movement.

EDIT: Actually just consume all events that pass through the TouchListener.

EDIT 2: Screen is set up to pass both mouse and touch events when running on android… so if you have both listeners, the element receives the two separate events.

that totally went over my head D:

So I gotta like… consume something with the joystick!

D’= Bawb is very lawst.

1 Like
@BigBob said: that totally went over my head D:

So I gotta like… consume something with the joystick!

D’= Bawb is very lawst.

[java]
public class MyJoystick extends Joystick implements TouchListener {

public MyJoystick(ElementManager screen, Vector2f position, int size) {
	super(screen, position, size);
}

@Override
public void onTouchDown(TouchEvent evt) {
	evt.setConsumed();
}

@Override
public void onTouchMove(TouchEvent evt) {
	evt.setConsumed();
}

@Override
public void onTouchUp(TouchEvent evt) {
	evt.setConsumed();
}

}

MyJoystick js = new MyJoystick(screen, Vector2f.ZERO, 100);
[/java]

I think this should solve the issue.

@t0neg0d

Unfortunately it doesn’t seem to like that I dont have

public void onUpdate(float f, float f1, float f2) {}

if I do implement that when I construct a new MyJoystick, it doesn’t want the update method and says method does not override or implement a method from a supertype.

:stuck_out_tongue: Sorry about being dense

@BigBob said: @t0neg0d

Unfortunately it doesn’t seem to like that I dont have

public void onUpdate(float f, float f1, float f2) {}

if I do implement that when I construct a new MyJoystick, it doesn’t want the update method and says method does not override or implement a method from a supertype.

:stuck_out_tongue: Sorry about being dense

Ooops… correct! It wouldn’t like that… make the class above abstract. That way when you create the new MyJoystick… it will prompt you to implement the onUpdate method. Soo…

public abstract class MyJoystick extends… etc etc

@t0neg0d

Got it to go with the MyJoystick by making it abstract but unfortunately does not seem to have made a difference with the issue

@BigBob said: @t0neg0d

Got it to go with the MyJoystick by making it abstract but unfortunately does not seem to have made a difference with the issue

Ok… I’ll have a look at it tomorrow and see if I can figure out a proper way of making this work then.

Any news on the Jostick :stuck_out_tongue:

@BigBob said: Any news on the Jostick :P

I’ve been sort down with a fever… not sick (maybe allergies or something?)… just next to useless today (I think I slept more than not). Now that I am semi-coherent, I’ll have at it.

@t0neg0d

Any news on the anroid dead spots :stuck_out_tongue:

As I’ve completely depended on this style of controlling for my last like… 5 games.

To reiterate

My control system consists of a drag to rotate camera, and a tonegod joystick. At the moment you are only able to do one or the other. Move the character, or drag the camera. Attempting to do both at the same time initiates the zoom function.

I don’t want to eliminate the zoom function completely… just make when a thumb is on the joystick it doesn’t count for the multi touch zoom function! This would enable one to control the character with the joystick, while dragging the camera left to right simultaneously

Thanks for reading