fix engine quitting, refactor buttons in menu
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
337da83070
commit
3682497060
@ -432,6 +432,8 @@ public class Main {
|
|||||||
if(!Globals.HEADLESS && Globals.RUN_CLIENT){
|
if(!Globals.HEADLESS && Globals.RUN_CLIENT){
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
}
|
}
|
||||||
|
//reset globals
|
||||||
|
Globals.resetGlobals();
|
||||||
//used to signal threads to stop
|
//used to signal threads to stop
|
||||||
Globals.threadManager.close();
|
Globals.threadManager.close();
|
||||||
//shut down audio engine
|
//shut down audio engine
|
||||||
@ -444,8 +446,6 @@ public class Main {
|
|||||||
}
|
}
|
||||||
//shutdown ode
|
//shutdown ode
|
||||||
OdeHelper.closeODE();
|
OdeHelper.closeODE();
|
||||||
//reset globals
|
|
||||||
Globals.resetGlobals();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sleep(int i) {
|
static void sleep(int i) {
|
||||||
|
|||||||
@ -61,20 +61,8 @@ public class MenuGeneratorsInGame {
|
|||||||
return false;
|
return false;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
//black texture background
|
//Back
|
||||||
// ImagePanel imagePanel = new ImagePanel(0,0,width,height,Globals.blackTexture);
|
div.addChild(Button.createButton("Back", () -> {
|
||||||
// imagePanel.setWidth(width);
|
|
||||||
// imagePanel.setHeight(height);
|
|
||||||
// imagePanel.setTexture(Globals.assetManager.fetchTexture(Globals.blackTexture));
|
|
||||||
// div.addChild(imagePanel);
|
|
||||||
|
|
||||||
//label 1 (back)
|
|
||||||
Button backButton = new Button();
|
|
||||||
Label backLabel = new Label(1.0f);
|
|
||||||
backLabel.setText("Back");
|
|
||||||
backButton.addChild(backLabel);
|
|
||||||
div.addChild(backButton);
|
|
||||||
backButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN), false);
|
WindowUtils.recursiveSetVisible(Globals.elementManager.getWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN), false);
|
||||||
Globals.elementManager.unregisterWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN);
|
Globals.elementManager.unregisterWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN);
|
||||||
if(Globals.cameraHandler.getTrackPlayerEntity()){
|
if(Globals.cameraHandler.getTrackPlayerEntity()){
|
||||||
@ -82,47 +70,28 @@ public class MenuGeneratorsInGame {
|
|||||||
} else {
|
} else {
|
||||||
Globals.controlHandler.hintUpdateControlState(ControlsState.IN_GAME_FREE_CAMERA);
|
Globals.controlHandler.hintUpdateControlState(ControlsState.IN_GAME_FREE_CAMERA);
|
||||||
}
|
}
|
||||||
return false;
|
}));
|
||||||
}});
|
|
||||||
|
|
||||||
|
|
||||||
//label 2 (quit)
|
|
||||||
Button saveButton = new Button();
|
|
||||||
Label saveLabel = new Label(1.0f);
|
|
||||||
saveLabel.setText("Save");
|
|
||||||
saveButton.addChild(saveLabel);
|
|
||||||
div.addChild(saveButton);
|
|
||||||
saveButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
Main.running = false;
|
|
||||||
//save terrain
|
|
||||||
saveWorld();
|
|
||||||
return false;
|
|
||||||
}});
|
|
||||||
|
|
||||||
//label 3 (quit)
|
//Return to main menu
|
||||||
Button quitButton = new Button();
|
div.addChild(Button.createButton("Return To Main Menu", () -> {
|
||||||
Label quitLabel = new Label(1.0f);
|
|
||||||
quitLabel.setText("Quit");
|
|
||||||
quitButton.addChild(quitLabel);
|
|
||||||
div.addChild(quitButton);
|
|
||||||
quitButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
Globals.threadManager.start(new LoadingThread(LoadingThreadType.RETURN_TITLE_MENU));
|
Globals.threadManager.start(new LoadingThread(LoadingThreadType.RETURN_TITLE_MENU));
|
||||||
return false;
|
}));
|
||||||
}});
|
|
||||||
|
|
||||||
|
//Save
|
||||||
|
div.addChild(Button.createButton("Save", () -> {
|
||||||
|
SaveUtils.overwriteSave(Globals.currentSave.getName());
|
||||||
|
}));
|
||||||
|
|
||||||
|
//Quit
|
||||||
|
div.addChild(Button.createButton("Quit", () -> {
|
||||||
|
Main.running = false;
|
||||||
|
}));
|
||||||
|
|
||||||
//checking macro data is a poor man's check for whether we're arena or full gamemode
|
//checking macro data is a poor man's check for whether we're arena or full gamemode
|
||||||
// if(Globals.server != null && Globals.macroData == null){
|
div.addChild(Button.createButton("Debug", () -> {
|
||||||
//label 4 (debug)
|
|
||||||
Button debugButton = new Button();
|
|
||||||
Label debugLabel = new Label(1.0f);
|
|
||||||
debugLabel.setText("Debug");
|
|
||||||
debugButton.addChild(debugLabel);
|
|
||||||
div.addChild(debugButton);
|
|
||||||
debugButton.setOnClick(new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
|
||||||
WindowUtils.replaceWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN, createInGameDebugMainMenu());
|
WindowUtils.replaceWindow(WindowStrings.WINDOW_MENU_INGAME_MAIN, createInGameDebugMainMenu());
|
||||||
return false;
|
}));
|
||||||
}});
|
|
||||||
// }
|
|
||||||
|
|
||||||
if(MenuGeneratorsInGame.shouldShowLevelEditor()){
|
if(MenuGeneratorsInGame.shouldShowLevelEditor()){
|
||||||
div.addChild(Button.createButton("Open Level Editor Tools", () -> {
|
div.addChild(Button.createButton("Open Level Editor Tools", () -> {
|
||||||
@ -135,13 +104,6 @@ public class MenuGeneratorsInGame {
|
|||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves the world
|
|
||||||
*/
|
|
||||||
static void saveWorld(){
|
|
||||||
SaveUtils.overwriteSave(Globals.currentSave.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Window createInGameDebugMainMenu(){
|
public static Window createInGameDebugMainMenu(){
|
||||||
// int screenTop = Globals.WINDOW_HEIGHT - 150;
|
// int screenTop = Globals.WINDOW_HEIGHT - 150;
|
||||||
int width = 500;
|
int width = 500;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user