Created
January 28, 2012 16:30
-
-
Save Justin42/1694936 to your computer and use it in GitHub Desktop.
BigGameProject screen controller patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/mygame/Game.java b/src/mygame/Game.java | |
index 44673bf..bdd588d 100644 | |
--- a/src/mygame/Game.java | |
+++ b/src/mygame/Game.java | |
@@ -1,6 +1,5 @@ | |
package mygame; | |
-import mygame.states.MainMenuAppState; | |
import mygame.states.InGameAppState; | |
import com.jme3.app.SimpleApplication; | |
import com.jme3.renderer.RenderManager; | |
diff --git a/src/mygame/gui/GuiAppState.java b/src/mygame/gui/GuiAppState.java | |
index d108a5b..225f0f1 100644 | |
--- a/src/mygame/gui/GuiAppState.java | |
+++ b/src/mygame/gui/GuiAppState.java | |
@@ -25,13 +25,14 @@ public class GuiAppState extends AbstractAppState{ | |
app.getAudioRenderer(), | |
app.getGuiViewPort()); | |
Nifty nifty = niftyDisplay.getNifty(); | |
+ | |
+ // Screen controllers | |
+ nifty.registerScreenController(new MainMenuGuiController(this)); | |
+ | |
nifty.addXml("Interface/mainmenu.xml"); | |
nifty.addXml("Interface/cinematic.xml"); | |
nifty.gotoScreen("mainmenu"); | |
- MainMenuGuiController mainmenu = (MainMenuGuiController) nifty.getScreen("mainmenu").getScreenController(); | |
- mainmenu.setGui(this); | |
- | |
setClickModeEnabled(true); | |
app.getGuiViewPort().addProcessor(niftyDisplay); | |
} | |
diff --git a/src/mygame/gui/MainMenuGuiController.java b/src/mygame/gui/MainMenuGuiController.java | |
index c93191a..688a50b 100644 | |
--- a/src/mygame/gui/MainMenuGuiController.java | |
+++ b/src/mygame/gui/MainMenuGuiController.java | |
@@ -1,10 +1,8 @@ | |
package mygame.gui; | |
-import com.jme3.niftygui.NiftyJmeDisplay; | |
import de.lessvoid.nifty.Nifty; | |
import de.lessvoid.nifty.screen.Screen; | |
import de.lessvoid.nifty.screen.ScreenController; | |
-import mygame.Game; | |
/** | |
* Manages the main menu GUI | |
@@ -18,6 +16,10 @@ public class MainMenuGuiController implements ScreenController{ | |
public MainMenuGuiController() { | |
} | |
+ MainMenuGuiController(GuiAppState gui) { | |
+ this.gui = gui; | |
+ } | |
+ | |
public void setGui(GuiAppState gui) { | |
this.gui = gui; | |
} | |
@@ -30,14 +32,17 @@ public class MainMenuGuiController implements ScreenController{ | |
// app.getGuiViewPort().removeProcessor(niftyDisplay); | |
// } | |
+ @Override | |
public void bind(Nifty nifty, Screen screen) { | |
//TODO save the variables? | |
} | |
+ @Override | |
public void onStartScreen() { | |
//TODO check if there is a saved game. If not, disable continue and loadgame buttons | |
} | |
+ @Override | |
public void onEndScreen() {} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment