Commit 3b4948ff authored by Matyáš Latner's avatar Matyáš Latner

#12 Fixed release version NullPointer, Changed default screen to GameMenu,...

#12 Fixed release version NullPointer, Changed default screen to GameMenu, ViewportDebugScreen added to debug versions mainmenu
parent eefacb3a
......@@ -9,6 +9,7 @@ mainmenu_encyclopedia=Encyklopedie
mainmenu_preferences=Nastavení
mainmenu_about=O aplikaci
mainmenu_logout=Odhlásit
mainmenu_screendebug=Debug Screen
gamedifficulty_easy=Lehká
gamedifficulty_medium=Střední
......
......@@ -9,6 +9,7 @@ mainmenu_encyclopedia=Encyklopédia
mainmenu_preferences=Nastavenie
mainmenu_about=O aplikácií
mainmenu_logout=Odhlásiť
mainmenu_screendebug=Debug Screen
gamedifficulty_easy=Ľahká
gamedifficulty_medium=Stredná
......
......@@ -80,7 +80,7 @@ public abstract class TablexiaApplication implements ApplicationListener {
@Override
public void create() {
stage = new Stage(new XFillViewport());
stage = new Stage();
inputMultiplexer = new InputMultiplexer(stage);
Gdx.input.setInputProcessor(inputMultiplexer);
prepareDebugInfo();
......@@ -109,7 +109,9 @@ public abstract class TablexiaApplication implements ApplicationListener {
if (screen != null) screen.resize(width, height);
stage.getViewport().update(width, height, true);
// keep debug info on edges of the screen
debugInfo.onResize();
if (TablexiaSettings.getInstance().isDebug()) {
debugInfo.onResize();
}
}
......
......@@ -13,7 +13,7 @@ import cz.nic.tablexia.game.GameDefinition;
import cz.nic.tablexia.game.difficulty.GameDifficulty;
import cz.nic.tablexia.loader.application.ApplicationTextManager;
import cz.nic.tablexia.screen.AbstractTablexiaScreen;
import cz.nic.tablexia.screen.viewport.ViewportDebugScreen;
import cz.nic.tablexia.screen.gamemenu.GameMenuScreen;
import cz.nic.tablexia.util.Log;
import cz.nic.tablexia.util.Utility;
......@@ -24,7 +24,7 @@ public class TablexiaSettings {
private static final int MIN_SCREEN_HEIGHT = (int) (DEFAULT_SCREEN_WIDTH * MAXIMUM_RATIO);
private static final boolean DEBUG_SHOW_BOUNDING_BOXES = true;
public static final Class<? extends AbstractTablexiaScreen<?>> INITIAL_SCREEN = ViewportDebugScreen.class;
public static final Class<? extends AbstractTablexiaScreen<?>> INITIAL_SCREEN = GameMenuScreen.class;
private static final String PREFERENCES_KEY = "cz.nic.tablexia.";
public static final String LOCALE_KEY = "locale";
......
......@@ -102,7 +102,7 @@ public class MainMenu extends Stack {
menuTableLayout.reset();
menuTableLayout.setDebug(TablexiaSettings.getInstance().isShowBoundingBoxes());
for (final MainMenuDefinition menuItem : MainMenuDefinition.values()) {
for (final MainMenuDefinition menuItem : MainMenuDefinition.getItemsForMenu()) {
addMenuItem(menuItem);
IMenuItem[] subMenu = menuItem.getSubmenu();
if (subMenu != null) {
......
package cz.nic.tablexia.menu;
import java.util.ArrayList;
import java.util.List;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.TablexiaApplication;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.bus.ApplicationBus;
import cz.nic.tablexia.bus.ApplicationBus.ApplicationEvent;
import cz.nic.tablexia.game.GameDefinition;
......@@ -11,31 +15,35 @@ import cz.nic.tablexia.screen.encyclopedia.EncyclopediaScreen;
import cz.nic.tablexia.screen.halloffame.HallOfFameScreen;
import cz.nic.tablexia.screen.preferences.PreferencesScreen;
import cz.nic.tablexia.screen.statistics.StatisticsScreen;
import cz.nic.tablexia.screen.viewport.ViewportDebugScreen;
public enum MainMenuDefinition implements IMenuItem {
GAMES ("mainmenu_games", GameDefinition.values(), false, null), // TODO open menu event
HALL_OF_FAME ("mainmenu_halloffame", null, true, new Tablexia.ChangeScreenEvent(HallOfFameScreen.class, TablexiaApplication.ScreenTransaction.FADE)),
STATISTICS ("mainmenu_statistics", null, true, new Tablexia.ChangeScreenEvent(StatisticsScreen.class, TablexiaApplication.ScreenTransaction.FADE)),
ENCYCLOPEDIA ("mainmenu_encyclopedia", null, true, new Tablexia.ChangeScreenEvent(EncyclopediaScreen.class, TablexiaApplication.ScreenTransaction.FADE)),
PREFERENCES ("mainmenu_preferences", null, true, new Tablexia.ChangeScreenEvent(PreferencesScreen.class, TablexiaApplication.ScreenTransaction.FADE)),
ABOUT_APPLICATION ("mainmenu_about", null, true, new Tablexia.ChangeScreenEvent(AboutScreen.class, TablexiaApplication.ScreenTransaction.FADE)),
LOGOUT ("mainmenu_logout", null, true, null); // TODO specify event
GAMES (false, "mainmenu_games", GameDefinition.values(), false, null), // TODO open menu event
HALL_OF_FAME (false, "mainmenu_halloffame", null, true, new Tablexia.ChangeScreenEvent(HallOfFameScreen.class, TablexiaApplication.ScreenTransaction.FADE)),
STATISTICS (false, "mainmenu_statistics", null, true, new Tablexia.ChangeScreenEvent(StatisticsScreen.class, TablexiaApplication.ScreenTransaction.FADE)),
ENCYCLOPEDIA (false, "mainmenu_encyclopedia", null, true, new Tablexia.ChangeScreenEvent(EncyclopediaScreen.class, TablexiaApplication.ScreenTransaction.FADE)),
PREFERENCES (false, "mainmenu_preferences", null, true, new Tablexia.ChangeScreenEvent(PreferencesScreen.class, TablexiaApplication.ScreenTransaction.FADE)),
ABOUT_APPLICATION (false, "mainmenu_about", null, true, new Tablexia.ChangeScreenEvent(AboutScreen.class, TablexiaApplication.ScreenTransaction.FADE)),
LOGOUT (false, "mainmenu_logout", null, true, null), // TODO specify event
SCREEN_DEBUG (true, "mainmenu_screendebug", null, true, new Tablexia.ChangeScreenEvent(ViewportDebugScreen.class, TablexiaApplication.ScreenTransaction.FADE));
private String menuTextKey;
private boolean debug;
private String menuTextKey;
private IMenuItem[] submenu;
private boolean isCloseMenu;
private ApplicationEvent action;
private MainMenuDefinition(String nameResource, IMenuItem[] submenu, boolean isCloseMenu, ApplicationEvent action) {
this.menuTextKey = nameResource;
private MainMenuDefinition(boolean debug, String nameResource, IMenuItem[] submenu, boolean isCloseMenu, ApplicationEvent action) {
this.debug = debug;
this.menuTextKey = nameResource;
this.submenu = submenu;
this.isCloseMenu = isCloseMenu;
this.action = action;
}
public ApplicationEvent getAction() {
public ApplicationEvent getAction() {
return action;
}
......@@ -57,4 +65,14 @@ public enum MainMenuDefinition implements IMenuItem {
public boolean isCloseMenu() {
return isCloseMenu;
}
public static List<MainMenuDefinition> getItemsForMenu() {
List<MainMenuDefinition> mainMenu = new ArrayList<MainMenuDefinition>();
for (MainMenuDefinition mainMenuDefinition : MainMenuDefinition.values()) {
if (TablexiaSettings.getInstance().isDebug() || !mainMenuDefinition.debug) {
mainMenu.add(mainMenuDefinition);
}
}
return mainMenu;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment