本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.Window.setMovable方法的典型用法代碼示例。如果您正苦於以下問題:Java Window.setMovable方法的具體用法?Java Window.setMovable怎麽用?Java Window.setMovable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.scenes.scene2d.ui.Window
的用法示例。
在下文中一共展示了Window.setMovable方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: textWindowDemo
import com.badlogic.gdx.scenes.scene2d.ui.Window; //導入方法依賴的package包/類
private void textWindowDemo() {
BitmapFont plotFont = context.getAssetManager().get( PLOT_FONT, BitmapFont.class );
String loremIpsum = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, ";
loremIpsum += "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.";
loremIpsum += "\n\nThis window is draggable.";
rootAtlas = context.getAssetManager().get( ROOT_ATLAS, TextureAtlas.class );
TextureRegion plotDlgRegion = rootAtlas.findRegion( "box-text1" );
NinePatchDrawable plotDlgBgDrawable = new NinePatchDrawable( new NinePatch( plotDlgRegion, 20, 20, 35, 20 ) );
Window plotDlg = new Window( "", new Window.WindowStyle( plotFont, new Color( 1f, 1f, 1f, 1f ), plotDlgBgDrawable ) );
plotDlg.setKeepWithinStage( true );
plotDlg.setMovable( true );
plotDlg.setSize( 200, 250 );
plotDlg.setPosition( 765, 60 );
plotDlg.row().top().expand().fill();
Label plotLbl = new Label( loremIpsum, new Label.LabelStyle( plotFont, new Color( 1f, 1f, 1f, 1f ) ) );
plotLbl.setAlignment( Align.top|Align.left, Align.center|Align.left );
plotLbl.setWrap( true );
plotDlg.add( plotLbl );
// setKeepWithinStage() only applies if added to the stage root. :/
popupStage.addActor( plotDlg );
}
示例2: ErrorScreen
import com.badlogic.gdx.scenes.scene2d.ui.Window; //導入方法依賴的package包/類
public ErrorScreen(String errorMessage, String optionalButtonText) {
this.skin = new SkinWithTrueTypeFonts(Gdx.files.internal(ModuleSelectionScreen.SKIN_PATH));
TextButton exitButton = new TextButton("Exit", skin);
exitButton.addListener(new EventListener() {
@Override
public boolean handle(Event event) {
if (event instanceof ChangeEvent) {
dispose();
Gdx.app.exit();
}
return false;
}
});
Window window = new Window("Error", skin);
window.pad(30, 10, 10, 10);
window.setModal(true);
window.setMovable(false);
window.add(new Label(errorMessage, skin)).padBottom(20).padTop(10);
window.row();
Table buttonsTable = new Table();
if (optionalButtonText != null) {
optionalButton = new TextButton(optionalButtonText, skin);
buttonsTable.add(optionalButton).fill().minWidth(100).height(40).padRight(30);
}
buttonsTable.add(exitButton).fill().minWidth(100).height(40);
window.add(buttonsTable).center();
window.pack();
stage.addActor(window);
WindowPosition.CENTER.position(window);
}
示例3: initMenuComponents
import com.badlogic.gdx.scenes.scene2d.ui.Window; //導入方法依賴的package包/類
private void initMenuComponents(Stage stage) {
descWindow = new Window("", Game.assets.getSkin());
int w = 320;
descWindow.setWidth(w);
descWindow.setHeight(100);
descWindow.setPosition((Gdx.graphics.getWidth() - w) / 2, 50);
descWindow.setMovable(false);
stage.addActor(descWindow);
}
示例4: initStatusWindow
import com.badlogic.gdx.scenes.scene2d.ui.Window; //導入方法依賴的package包/類
private void initStatusWindow() {
statusWindow = new Window("Blobs Status", getDefaultSkin());
int margin = 50;
int w = 300;
statusWindow.setWidth(w);
statusWindow.setMovable(false);
stage.addActor(statusWindow);
// Display blobs
for (Blob b : game.player.blobs) {
Table blobTable = new Table(getDefaultSkin());
blobTable.setColor(0.5f, 0.3f, 0.8f, 0.7f);
addStat("Name", b.name, blobTable);
addStat("Age", String.valueOf(b.age), blobTable);
addStat("Life", b.getAttributeCurrent(Attributes.HP) + "/" + b.getAttributeBase(Attributes.HP), blobTable);
blobTable.setWidth(w - 2 * margin);
statusWindow.add(blobTable);
statusWindow.add("").expandX();
statusWindow.row();
statusWindow.add("").height(50);
statusWindow.row();
}
statusWindow.setHeight(120 * game.player.blobs.size());
statusWindow.add("").expandY();
statusWindow.setPosition(margin, Gdx.graphics.getHeight() - margin - statusWindow.getHeight());
}
示例5: ModuleSelectionScreen
import com.badlogic.gdx.scenes.scene2d.ui.Window; //導入方法依賴的package包/類
public ModuleSelectionScreen(FishchickenGame game) {
super();
this.skin = new SkinWithTrueTypeFonts(Gdx.files.internal(ModuleSelectionScreen.SKIN_PATH));
this.game = game;
Array<FileHandle> modules = getModules();
Window window = new Window("Module selection", skin);
window.pad(30, 10, 10, 10);
window.setModal(true);
window.setMovable(false);
TextButton exitButton = new TextButton("Exit", skin);
exitButton.addListener(this);
exitButton.setName("EXIT");
if (modules == null) {
window.add(new Label("No modules found.", skin)).padBottom(20).padTop(10);
window.row();
window.add(exitButton).fill().width(100).height(40).center();
} else {
moduleSelectBox = new SelectBox<SelectOption<String>>(skin.get(SelectBoxStyle.class));
Array<SelectOption<String>> options = new Array<SelectOption<String>>();
for (FileHandle moduleDir : modules) {
SelectOption<String> option = new SelectOption<String>(" "+moduleDir.name(), moduleDir.name());
options.add(option);
}
moduleSelectBox.setItems(options);
TextButton okButton = new TextButton("Ok", skin);
okButton.addListener(this);
okButton.setName("OK");
window.add(new Label("Please choose a module:", skin)).padBottom(10).padTop(10).left();
window.row();
window.add(moduleSelectBox).padBottom(20).center().minWidth(170);
window.row();
Table buttonsTable = new Table();
buttonsTable.add(exitButton).fill().width(100).height(40);
buttonsTable.add(okButton).fill().width(100).height(40).padLeft(30);
window.add(buttonsTable).center();
}
window.pack();
stage.addActor(window);
WindowPosition.CENTER.position(window);
}
示例6: process
import com.badlogic.gdx.scenes.scene2d.ui.Window; //導入方法依賴的package包/類
@Override
public void process(final LmlParser parser, final LmlTag tag, final Window actor, final String rawAttributeData) {
actor.setMovable(parser.parseBoolean(rawAttributeData, actor));
}