…if you click a button run a void like:…
It’s the problem. The start screen have just a progress bar, no buttons. The progress bar have to be started automatically. Btw, it’s alreay have a load var. It seems be an easy thing, but it’s not. I think it’s almost impossible. The start screen code is this :
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package rhythmgame.nifty.control.screen;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import rhythmgame.nifty.control.progressbar.ProgressBar;
import rhythmgame.nifty.control.progressbar.ProgressBarControl;
/**
*
* @author Glauco Márdano
*/
public class StartScreenControl extends RhythmGameScreenController {
private ProgressBar loadingBar;
private boolean load;
@Override
public void bind(Nifty nifty, Screen screen) {
super.bind(nifty, screen);
loadingBar = screen.findControl("startLoadingBar", ProgressBarControl.class);
}
@Override
public void onStartScreen() {
super.onStartScreen();
loadStuffs();
}
@Override
public void loadStuffs() {
getApp().loadStuffs(loadingBar);
load = true;
}
@Override
public void update(float tpf) {
super.update(tpf);
if (load) {
goToScreen("mainMenuScreen");
getNifty().removeScreen("startScreen");
load = false;
getStateManager().detach(this);
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<nifty xmlns="http://nifty-gui.sourceforge.net/nifty-1.3.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd">
<!-- +++++++++++++++++++++++++++++++++++++++ -->
<!-- start screen -->
<!-- +++++++++++++++++++++++++++++++++++++++ -->
<useStyles filename="Interface/Styles/styles.xml" />
<useControls filename="nifty-default-controls.xml" />
<useControls filename="Interface/Controls/controls.xml" />
<screen id="startScreen" controller="rhythmgame.nifty.control.screen.StartScreenControl">
<layer id="startLoadingLayer" childLayout="horizontal">
<panel height="10%"/>
<panel id = "startLoadingPanel" childLayout="vertical" align="center" valign="center" height="32px" width="80%">
<control image="Interface/Skins/ProgressBar/inner-orange.png" id="startLoadingBar" name="progressBar" align="center" valign="center" width="100%" height="100%" progress="0f" direction="horizontal" progresstext=""/>
</panel>
<panel height="10%"/>
</layer>
</screen>
</nifty>