當前位置: 首頁>>代碼示例>>Java>>正文


Java Window.setPosition方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.Window.setPosition方法的典型用法代碼示例。如果您正苦於以下問題:Java Window.setPosition方法的具體用法?Java Window.setPosition怎麽用?Java Window.setPosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.scenes.scene2d.ui.Window的用法示例。


在下文中一共展示了Window.setPosition方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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 );
}
 
開發者ID:Vhati,項目名稱:OverdriveGDX,代碼行數:27,代碼來源:TestScreen.java

示例2: createWindowDebug

import com.badlogic.gdx.scenes.scene2d.ui.Window; //導入方法依賴的package包/類
public static Window createWindowDebug(ResourcesManager resourcesManager){

        BitmapFont font = (BitmapFont) resourcesManager.get(resourcesManager.DEBUG_FONT);
        font.setScale(1 / 150F);
        font.setUseIntegerPositions(false);
        Window.WindowStyle style = new Window.WindowStyle();
        //style.background = background;
        style.titleFont = font;
        style.titleFontColor=new Color(1, 1, 1, 0.4f);
        Sprite background = new Sprite((Texture) resourcesManager.get(resourcesManager.DEBUG_BACKGROUND));
        background.setSize(10,8);
        background.setOrigin(background.getWidth() / 2, background.getHeight() / 2);
        background.setColor(1,1,1,0.4f);
        style.background= new SpriteDrawable(background);
        Window window = new DebugWindow("", style);
        window.setPosition(0, 0);
        window.setKeepWithinStage(false);
        window.setTransform(false);
        window.setFillParent(true);

        Label.LabelStyle labelStyle= new Label.LabelStyle(font,new Color(1, 1, 1, 1)) ;
        myLabel= new Label("",labelStyle);
        window.add(myLabel).pad(0.2f).width(8);

        return window;
    }
 
開發者ID:Rubentxu,項目名稱:DreamsLibGdx,代碼行數:27,代碼來源:DebugWindow.java

示例3: create

import com.badlogic.gdx.scenes.scene2d.ui.Window; //導入方法依賴的package包/類
@Override
public void create () {
	spriteBatch = new SpriteBatch();
	font = new BitmapFont(Gdx.files.internal("data/verdana39.fnt"), false);

	multiPageFont = new BitmapFont(Gdx.files.internal("data/multipagefont.fnt"));

	// Add user defined color
	Colors.put("PERU", Color.valueOf("CD853F"));

	renderer = new ShapeRenderer();
	renderer.setProjectionMatrix(spriteBatch.getProjectionMatrix());

	stage = new Stage();

	Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));

	BitmapFont labelFont = skin.get("default-font", BitmapFont.class);
	labelFont.setMarkupEnabled(true);

	// Notice that the last [] has been deliberately added to test the effect of excessive pop operations.
	// They are silently ignored, as expected.
	Label label = new Label("<<[BLUE]M[RED]u[YELLOW]l[GREEN]t[OLIVE]ic[]o[]l[]o[]r[]*[MAROON]Label[][]>>", skin);

	label.setPosition(200, 200);
	stage.addActor(label);

	Window window = new Window("[RED]Multicolor[GREEN] Title", skin);
	window.setPosition(400, 200);
	window.pack();
	stage.addActor(window);
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:33,代碼來源:BitmapFontTest.java

示例4: initialize

import com.badlogic.gdx.scenes.scene2d.ui.Window; //導入方法依賴的package包/類
/**
 * Initializes this MenuScreen's table with all necessary elements.
 */
protected void initialize() {
	window = new Window(title, skin);
	window.setSize(Display.getPreferredWidth(),
			Display.getPreferredHeight());
	window.setPosition(0, 0);

	if (background != null)
		window.setBackground(background);

	stage.addActor(window);
}
 
開發者ID:LostCodeStudios,項目名稱:JavaLib,代碼行數:15,代碼來源:MenuScreen.java

示例5: 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);
}
 
開發者ID:baobob,項目名稱:bloblines,代碼行數:10,代碼來源:MenuGroup.java

示例6: 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());

}
 
開發者ID:baobob,項目名稱:bloblines,代碼行數:29,代碼來源:MapScreen.java

示例7: initUI

import com.badlogic.gdx.scenes.scene2d.ui.Window; //導入方法依賴的package包/類
private void initUI(final Skin uiSkin, Opus generator,
					final Stage pStage, LwjglApplicationConfiguration cfg,
					Settings settings) {

	samplerEditor = new SamplerEditor(uiSkin, pStage, noisePool, samplers);
	samplerEditor.left().top();
	windowList.add(samplerEditor);

	layerEditor = new LayerEditor(uiSkin, generator.getLayers().get(0), pStage, samplers, generator);
	layerEditor.left().top();
	windowList.add(layerEditor);

	worldEditor = new WorldEditor(uiSkin, generator, pStage, generator.getConfig().name);
	worldEditor.left().top();
	windowList.add(worldEditor);


	samplerOverview = new SamplerOverview(uiSkin, pStage, samplers);
	samplerOverview.left().top();
	windowList.add(samplerOverview);

	projectWindow = new ProjectWindow(uiSkin, opus, samplers);
	projectWindow.left().top();
	windowList.add(projectWindow);

	interpreterList = new ColorInterpreterList(uiSkin, samplers);
	interpreterList.left().top();
	windowList.add(interpreterList);

	settingsWindow = new SettingsWindow(uiSkin);
	settingsWindow.left().top();
	windowList.add(settingsWindow);

	aboutWindow = new AboutWindow(uiSkin);
	aboutWindow.left().top();
	aboutWindow.setVisible(false);
	windowList.add(aboutWindow);

	for (Window window : windowList) {
		bus.register(window);
		pStage.addActor(window);
		Settings.WindowSetting windowSetting = getWindowSetting(window.getClass());
		if (windowSetting != null) {
			window.setPosition(windowSetting.x, windowSetting.y);
			window.setVisible(windowSetting.visible);
		}

	}

	// others
	topMenu = new TopMenu(uiSkin, layerEditor, samplerEditor, worldEditor, samplers);
	topMenu.left().top();
	pStage.addActor(topMenu);

	updatePosition(cfg.width, cfg.height);
	limitWindowSizes(null);
	topMenu.toFront();
}
 
開發者ID:aphex-,項目名稱:Opus-Prototype,代碼行數:59,代碼來源:UI.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.Window.setPosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。