summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/rustanddust/menu/MainMenu.java29
-rw-r--r--core/src/ch/asynk/rustanddust/ui/Menu.java6
2 files changed, 22 insertions, 13 deletions
diff --git a/core/src/ch/asynk/rustanddust/menu/MainMenu.java b/core/src/ch/asynk/rustanddust/menu/MainMenu.java
index 620205a..e69329f 100644
--- a/core/src/ch/asynk/rustanddust/menu/MainMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/MainMenu.java
@@ -9,29 +9,34 @@ public class MainMenu extends Menu
{
public enum Items implements Menu.MenuItem
{
- EXIT(0),
- OPTIONS(1),
- TUTORIALS(2),
- PLAY(3),
- NONE(4);
+ EXIT(0, "Exit"),
+ OPTIONS(1, "Options"),
+ TUTORIALS(2, "Tutorials"),
+ PLAY(3, "Play"),
+ NONE(5, null);
public int i;
- Items(int i)
+ public String s;
+ Items(int i, String s)
{
this.i = i;
+ this.s = s;
}
+ public String s() { return s; }
public int i() { return i; }
public int last() { return NONE.i; }
+ public Menu.MenuItem get(int i)
+ {
+ if (i == EXIT.i) return EXIT;
+ else if (i == OPTIONS.i) return OPTIONS;
+ else if (i == TUTORIALS.i) return TUTORIALS;
+ else if (i == PLAY.i) return PLAY;
+ else return NONE;
+ }
};
public MainMenu(RustAndDust game)
{
super(Items.NONE, game.font, game.ninePatch);
-
- label(Items.PLAY).write("Play");
- label(Items.TUTORIALS).write("Tutorials");
- label(Items.OPTIONS).write("Options");
- label(Items.EXIT).write("Exit");
-
this.visible = true;
}
diff --git a/core/src/ch/asynk/rustanddust/ui/Menu.java b/core/src/ch/asynk/rustanddust/ui/Menu.java
index 2fe93a7..78f5964 100644
--- a/core/src/ch/asynk/rustanddust/ui/Menu.java
+++ b/core/src/ch/asynk/rustanddust/ui/Menu.java
@@ -15,6 +15,8 @@ public class Menu extends Patch
{
public int last();
public int i();
+ public String s();
+ public MenuItem get(int i);
};
protected MenuItem menuItem;
@@ -24,8 +26,10 @@ public class Menu extends Patch
super(ninePatch);
this.menuItem = menuItem;
this.labels = new Label[menuItem.last()];
- for (int i = 0; i< menuItem.last(); i ++)
+ for (int i = 0; i< menuItem.last(); i ++) {
labels[i] = new Label(font, 10);
+ labels[i].write(menuItem.get(i).s());
+ }
}
protected Label label(MenuItem m)