
Untitled
By: a guest on
Mar 15th, 2012 | syntax:
Java | size: 1.36 KB | hits: 49 | expires: Never
package game.gui.screens;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.builder.LayerBuilder;
import de.lessvoid.nifty.builder.ScreenBuilder;
import de.lessvoid.nifty.controls.scrollpanel.builder.ScrollPanelBuilder;
public class ShowQuestObjectiveStateStartScreen {
private static ShowQuestObjectiveStateStartScreen instance;
public static ShowQuestObjectiveStateStartScreen getInstance() {
if (instance == null) {
instance = new ShowQuestObjectiveStateStartScreen();
}
return instance;
}
public void createScreen(Nifty nifty) {
nifty.loadControlFile("nifty-default-controls.xml");
nifty.loadStyleFile("nifty-default-styles.xml");
new ScreenBuilder("ShowQuestObjective", null) {
{
layer(new LayerBuilder("background") {
{
backgroundImage("resources/images/Book.png");
// Using the builder pattern create a ScrollPanel with the id "scrollPanelId" that uses an image as the content to be scrolled around
childLayoutAbsoluteInside();
control(new ScrollPanelBuilder("scrollPanel") {{
x("100px"); y("100px");
width("200px"); height("200px");
set( "vertical", "true" );
set( "horizontal", "true" );
}});
}
});
}
}.build(nifty);
nifty.gotoScreen("ShowQuestObjective");
nifty.getCurrentScreen().startScreen();
}
}