1 package de.jos.game.objects.buttons;
2
3 import de.jos.game.objects.screen.AbstractGameObject;
4 import de.jos.game.objects.screen.Screen;
5
6 /***
7 *
8 */
9 public class CreditsButton extends GameButton {
10
11 /***
12 * Create a CreditsButton at the position.
13 *
14 * @param gameObject
15 * @param x
16 * @param y
17 */
18 public CreditsButton(AbstractGameObject gameObject, int x, int y) {
19 super(gameObject.getString("menu.credits"), x, y, 0, 0, gameObject);
20
21 setButtonClickCallback(new CreditsButtonClickCallback(gameObject));
22 }
23
24 @Override
25 public Action getAction() {
26 return Action.CREDITS;
27 }
28
29 /***
30 * Callback fuer einen Button click.
31 *
32 * @author root
33 *
34 */
35 private static final class CreditsButtonClickCallback implements ButtonClickCallback {
36
37 AbstractGameObject gameObject = null;
38
39 public CreditsButtonClickCallback(AbstractGameObject gameObject) {
40 this.gameObject = gameObject;
41 }
42
43 /***
44 * {@inheritDoc}
45 */
46 public void performClickAction() {
47 gameObject.setNextScreen(Screen.CREDITS);
48 }
49
50 }
51
52 }