Skip to content

Commit

Permalink
Rename joystick resources
Browse files Browse the repository at this point in the history
  • Loading branch information
AntumDeluge committed Nov 26, 2023
1 parent 3cb3e11 commit d488be1
Show file tree
Hide file tree
Showing 22 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,20 @@ public ArrowView(final Context ctx, final Dir dir) {

switch (dir) {
case LEFT:
id = R.drawable.dpad_arrow_left;
id_active = R.drawable.dpad_arrow_left_active;
id = R.drawable.dpad_left;
id_active = R.drawable.dpad_left_active;
break;
case RIGHT:
id = R.drawable.dpad_arrow_right;
id_active = R.drawable.dpad_arrow_right_active;
id = R.drawable.dpad_right;
id_active = R.drawable.dpad_right_active;
break;
case UP:
id = R.drawable.dpad_arrow_up;
id_active = R.drawable.dpad_arrow_up_active;
id = R.drawable.dpad_up;
id_active = R.drawable.dpad_up_active;
break;
default:
id = R.drawable.dpad_arrow_down;
id_active = R.drawable.dpad_arrow_down_active;
id = R.drawable.dpad_down;
id_active = R.drawable.dpad_down_active;
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ public OuterButton(final Context ctx) {
pressedKeys = new ArrayList<>();

setBackgroundColor(android.graphics.Color.TRANSPARENT);
setImageResource(R.drawable.dpad_circle_outer);
setImageResource(R.drawable.joystick_outer);

innerButton = new InnerButton(ctx);
innerButton.setBackgroundColor(android.graphics.Color.TRANSPARENT);
innerButton.setImageResource(R.drawable.dpad_circle_inner);
innerButton.setImageResource(R.drawable.joystick_inner);

setOnTouchListener(new View.OnTouchListener() {
@Override
Expand All @@ -156,7 +156,7 @@ public boolean onTouch(final View view, final MotionEvent event) {

if (action == MotionEvent.ACTION_DOWN && !keyDown) {
keyDown = true;
innerButton.setImageResource(R.drawable.dpad_circle_inner_active);
innerButton.setImageResource(R.drawable.joystick_inner_active);
innerButton.setRelativeX(event.getX());
innerButton.setRelativeY(event.getY());

Expand All @@ -167,7 +167,7 @@ public boolean onTouch(final View view, final MotionEvent event) {
}
} else if (action == MotionEvent.ACTION_UP && keyDown) {
keyDown = false;
innerButton.setImageResource(R.drawable.dpad_circle_inner);
innerButton.setImageResource(R.drawable.joystick_inner);
innerButton.centerOn((JoyPadButton) view);

clearPresses();
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
16 changes: 8 additions & 8 deletions srcjs/stendhal/ui/joystick/DirectionPad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,19 @@ export class DirectionPad extends JoystickBase {
let action: {[index: string]: string} = {type: "move"};
switch(e.target) {
case this.up:
this.up.src = this.getResource("dpad_arrow_up_active");
this.up.src = this.getResource("dpad_up_active");
action.dir = "1";
break;
case this.right:
this.right.src = this.getResource("dpad_arrow_right_active");
this.right.src = this.getResource("dpad_right_active");
action.dir = "2";
break;
case this.down:
this.down.src = this.getResource("dpad_arrow_down_active");
this.down.src = this.getResource("dpad_down_active");
action.dir = "3";
break;
case this.left:
this.left.src = this.getResource("dpad_arrow_left_active");
this.left.src = this.getResource("dpad_left_active");
action.dir = "4";
break;
}
Expand All @@ -135,10 +135,10 @@ export class DirectionPad extends JoystickBase {

public override reset() {
// reset images
this.up.src = this.getResource("dpad_arrow_up");
this.down.src = this.getResource("dpad_arrow_down");
this.left.src = this.getResource("dpad_arrow_left");
this.right.src = this.getResource("dpad_arrow_right");
this.up.src = this.getResource("dpad_up");
this.down.src = this.getResource("dpad_down");
this.left.src = this.getResource("dpad_left");
this.right.src = this.getResource("dpad_right");
}

public override onRemoved() {
Expand Down

0 comments on commit d488be1

Please sign in to comment.