当前位置: 首页>>代码示例>>Java>>正文


Java ShatteredPixelDungeon.landscape方法代码示例

本文整理汇总了Java中com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon.landscape方法的典型用法代码示例。如果您正苦于以下问题:Java ShatteredPixelDungeon.landscape方法的具体用法?Java ShatteredPixelDungeon.landscape怎么用?Java ShatteredPixelDungeon.landscape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon的用法示例。


在下文中一共展示了ShatteredPixelDungeon.landscape方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillFields

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入方法依赖的package包/类
private void fillFields( int image, ItemSprite.Glowing glowing, int titleColor, String title, String info ) {

		int width = ShatteredPixelDungeon.landscape() ? WIDTH_L : WIDTH_P;

		IconTitle titlebar = new IconTitle();
		titlebar.icon( new ItemSprite( image, glowing ) );
		titlebar.label( Messages.titleCase( title ), titleColor );
		titlebar.setRect( 0, 0, width, 0 );
		add( titlebar );
		
		RenderedTextMultiline txtInfo = PixelScene.renderMultiline( info, 6 );
		txtInfo.maxWidth(width);
		txtInfo.setPos(titlebar.left(), titlebar.bottom() + GAP);
		add( txtInfo );
		
		resize( width, (int)(txtInfo.top() + txtInfo.height()) );
	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:18,代码来源:WndInfoItem.java

示例2: WndOptions

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入方法依赖的package包/类
public WndOptions( String title, String message, String... options ) {
	super();

	int width = ShatteredPixelDungeon.landscape() ? WIDTH_L : WIDTH_P;

	RenderedTextMultiline tfTitle = PixelScene.renderMultiline( title, 9 );
	tfTitle.hardlight( TITLE_COLOR );
	tfTitle.setPos(MARGIN, MARGIN);
	tfTitle.maxWidth(width - MARGIN * 2);
	add( tfTitle );
	
	RenderedTextMultiline tfMesage = PixelScene.renderMultiline( 6 );
	tfMesage.text(message, width - MARGIN * 2);
	tfMesage.setPos( MARGIN, tfTitle.top() + tfTitle.height() + MARGIN );
	add( tfMesage );
	
	float pos = tfMesage.bottom() + MARGIN;
	
	for (int i=0; i < options.length; i++) {
		final int index = i;
		RedButton btn = new RedButton( options[i] ) {
			@Override
			protected void onClick() {
				hide();
				onSelect( index );
			}
		};
		btn.setRect( MARGIN, pos, width - MARGIN * 2, BUTTON_HEIGHT );
		add( btn );
		
		pos += BUTTON_HEIGHT + MARGIN;
	}
	
	resize( width, (int)pos );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:36,代码来源:WndOptions.java

示例3: orientationText

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入方法依赖的package包/类
private String orientationText() {
	return ShatteredPixelDungeon.landscape() ? TXT_SWITCH_PORT : TXT_SWITCH_LAND;
}
 
开发者ID:wolispace,项目名称:soft-pixel-dungeon,代码行数:4,代码来源:WndSettings.java

示例4: create

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入方法依赖的package包/类
@Override
public void create() {

	super.create();

	GameScene.scene = null;

	float minWidth, minHeight;
	if (ShatteredPixelDungeon.landscape()) {
		minWidth = MIN_WIDTH_L;
		minHeight = MIN_HEIGHT_L;
	} else {
		minWidth = MIN_WIDTH_P;
		minHeight = MIN_HEIGHT_P;
	}

	maxDefaultZoom = (int)Math.min(Game.width/minWidth, Game.height/minHeight);
	maxScreenZoom = (int)Math.min(Game.dispWidth/minWidth, Game.dispHeight/minHeight);
	defaultZoom = ShatteredPixelDungeon.scale();

	if (defaultZoom < Math.ceil( Game.density * 2 ) || defaultZoom > maxDefaultZoom){
		defaultZoom = (int)Math.ceil( Game.density * 2.5 );
		while ((
			Game.width / defaultZoom < minWidth ||
			Game.height / defaultZoom < minHeight
		) && defaultZoom > 1) {
			defaultZoom--;
		}
	}

	minZoom = 1;
	maxZoom = defaultZoom * 2;

	Camera.reset( new PixelCamera( defaultZoom ) );

	float uiZoom = defaultZoom;
	uiCamera = Camera.createFullscreen( uiZoom );
	Camera.add( uiCamera );

	if (pixelFont == null) {

		// 3x5 (6)
		pixelFont = Font.colorMarked(
			BitmapCache.get( Assets.PIXELFONT), 0x00000000, BitmapText.Font.LATIN_FULL );
		pixelFont.baseLine = 6;
		pixelFont.tracking = -1;

		// 9x15 (18)
		font1x = Font.colorMarked(
				BitmapCache.get( Assets.FONT1X), 22, 0x00000000, BitmapText.Font.LATIN_FULL );
		font1x.baseLine = 17;
		font1x.tracking = -2;
		font1x.texture.filter(Texture.LINEAR, Texture.LINEAR);

		//font1x double scaled
		font2x = Font.colorMarked(
				BitmapCache.get( Assets.FONT2X), 44, 0x00000000, BitmapText.Font.LATIN_FULL );
		font2x.baseLine = 38;
		font2x.tracking = -4;
		font2x.texture.filter(Texture.LINEAR, Texture.NEAREST);
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:63,代码来源:PixelScene.java

示例5: create

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入方法依赖的package包/类
@Override
public void create() {

	super.create();

	Music.INSTANCE.play( Assets.THEME, true );

	uiCamera.visible = false;

	int w = Camera.main.width;
	int h = Camera.main.height;

	Archs archs = new Archs();
	archs.setSize( w, h );
	add( archs );

	float left = 5;
	float top = 15;

	RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9 );
	title.hardlight(Window.TITLE_COLOR);
	title.x = (w - title.width()) / 2 ;
	title.y = (top - title.baseLine()) / 2 ;
	align(title);
	add(title);

	Badges.loadGlobal();

	List<Badges.Badge> badges = Badges.filtered( true );

	int blankBadges = 34;
	blankBadges -= badges.size();
	if (badges.contains(Badges.Badge.ALL_ITEMS_IDENTIFIED))	blankBadges -= 6;
	if (badges.contains(Badges.Badge.YASD)) 				blankBadges -= 5;
	blankBadges = Math.max(0, blankBadges);

	//guarantees a max of 5 rows in landscape, and 8 in portrait, assuming a max of 40 buttons
	int nCols = ShatteredPixelDungeon.landscape() ? 7 : 4;
	if (badges.size() + blankBadges > 32 && !ShatteredPixelDungeon.landscape())	nCols++;

	int nRows = 1 + (blankBadges + badges.size())/nCols;

	float badgeWidth = (w - 2*left)/nCols;
	float badgeHeight = (h - 2*top)/nRows;

	for (int i = 0; i < badges.size() + blankBadges; i++){
		int row = i / nCols;
		int col = i % nCols;
		Badges.Badge b = i < badges.size() ? badges.get( i ) : null;
		BadgeButton button = new BadgeButton( b );
		button.setPos(
				left + col * badgeWidth + (badgeWidth - button.width()) / 2,
				top + row * badgeHeight + (badgeHeight - button.height()) / 2);
		align(button);
		add( button );
	}

	ExitButton btnExit = new ExitButton();
	btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
	add( btnExit );

	fadeIn();

	Badges.loadingListener = new Callback() {
		@Override
		public void call() {
			if (Game.scene() == BadgesScene.this) {
				ShatteredPixelDungeon.switchNoFade( BadgesScene.class );
			}
		}
	};
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:73,代码来源:BadgesScene.java

示例6: WndItem

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入方法依赖的package包/类
public WndItem( final WndBag owner, final Item item , final boolean options ) {
	
	super();

	int width = ShatteredPixelDungeon.landscape() ? WIDTH_L : WIDTH_P;
	
	IconTitle titlebar = new IconTitle( item );
	titlebar.setRect( 0, 0, width, 0 );
	add( titlebar );

	if (item.levelKnown && item.level() > 0) {
		titlebar.color( ItemSlot.UPGRADED );
	} else if (item.levelKnown && item.level() < 0) {
		titlebar.color( ItemSlot.DEGRADED );
	}
	
	RenderedTextMultiline info = PixelScene.renderMultiline( item.info(), 6 );
	info.maxWidth(width);
	info.setPos(titlebar.left(), titlebar.bottom() + GAP);
	add( info );

	float y = info.top() + info.height() + GAP;
	float x = 0;
	
	if (Dungeon.hero.isAlive() && options) {
		ArrayList<RedButton> line = new ArrayList<>();
		for (final String action:item.actions( Dungeon.hero )) {
			
			RedButton btn = new RedButton( Messages.get(item, "ac_" + action), 8 ) {
				@Override
				protected void onClick() {
					hide();
					if (owner != null && owner.parent != null) owner.hide();
					item.execute( Dungeon.hero, action );
				};
			};
			btn.setSize( btn.reqWidth(), BUTTON_HEIGHT );
			if (x + btn.width() > width || line.size() == 3) {
				layoutButtons(line, width - x, y);
				x = 0;
				y += BUTTON_HEIGHT + 1;
				line = new ArrayList<>();
			}
			x++;
			add( btn );
			line.add( btn );

			if (action.equals(item.defaultAction)) {
				btn.textColor( TITLE_COLOR );
			}

			x += btn.width();
		}
		layoutButtons(line, width - x, y);
	}
	
	resize( width, (int)(y + (x > 0 ? BUTTON_HEIGHT : 0)) );
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:59,代码来源:WndItem.java

示例7: WndBag

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入方法依赖的package包/类
public WndBag( Bag bag, Listener listener, Mode mode, String title ) {
	
	super();
	
	this.listener = listener;
	this.mode = mode;
	this.title = title;
	
	lastMode = mode;
	lastBag = bag;

	nCols = ShatteredPixelDungeon.landscape() ? COLS_L : COLS_P;
	nRows = (int)Math.ceil((Belongings.BACKPACK_SIZE + 4) / (float)nCols);

	int slotsWidth = SLOT_WIDTH * nCols + SLOT_MARGIN * (nCols - 1);
	int slotsHeight = SLOT_HEIGHT * nRows + SLOT_MARGIN * (nRows - 1);

	placeTitle( bag, slotsWidth );
	
	placeItems( bag );

	resize( slotsWidth, slotsHeight + TITLE_HEIGHT );

	Belongings stuff = Dungeon.hero.belongings;
	Bag[] bags = {
		stuff.backpack,
		stuff.getItem( SeedPouch.class ),
		stuff.getItem( ScrollHolder.class ),
		stuff.getItem( PotionBandolier.class ),
		stuff.getItem( WandHolster.class )};

	for (Bag b : bags) {
		if (b != null) {
			BagTab tab = new BagTab( b );
			add( tab );
			tab.select( b == bag );
		}
	}

	layoutTabs();
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:42,代码来源:WndBag.java

示例8: WndTitledMessage

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入方法依赖的package包/类
public WndTitledMessage( Component titlebar, String message ) {

		super();

		int width = ShatteredPixelDungeon.landscape() ? WIDTH_L : WIDTH_P;

		titlebar.setRect( 0, 0, width, 0 );
		add(titlebar);

		RenderedTextMultiline text = PixelScene.renderMultiline( 6 );
		text.text( message, width );
		text.setPos( titlebar.left(), titlebar.bottom() + GAP );
		add( text );

		resize( width, (int)text.bottom() );
	}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon,代码行数:17,代码来源:WndTitledMessage.java

示例9: create

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入方法依赖的package包/类
@Override
public void create() {

	super.create();

	GameScene.scene = null;

	float minWidth, minHeight;
	if (ShatteredPixelDungeon.landscape()) {
		minWidth = MIN_WIDTH_L;
		minHeight = MIN_HEIGHT_L;
	} else {
		minWidth = MIN_WIDTH_P;
		minHeight = MIN_HEIGHT_P;
	}

	maxDefaultZoom = (int)Math.min(Game.width/minWidth, Game.height/minHeight);
	defaultZoom = ShatteredPixelDungeon.scale();

	if (defaultZoom < Math.ceil( Game.density * 2 ) || defaultZoom > maxDefaultZoom){
		defaultZoom = (int)Math.round((Math.ceil( Game.density * 2 ) + maxDefaultZoom)/2);
		while ((
			Game.width / defaultZoom < minWidth ||
			Game.height / defaultZoom < minHeight
		) && defaultZoom > 1) {
			defaultZoom--;
		}
	}

	minZoom = 1;
	maxZoom = defaultZoom * 2;

	Camera.reset( new PixelCamera( defaultZoom ) );

	float uiZoom = defaultZoom;
	uiCamera = Camera.createFullscreen( uiZoom );
	Camera.add( uiCamera );

	if (pixelFont == null) {

		// 3x5 (6)
		pixelFont = Font.colorMarked(
			BitmapCache.get( Assets.PIXELFONT), 0x00000000, BitmapText.Font.LATIN_FULL );
		pixelFont.baseLine = 6;
		pixelFont.tracking = -1;

		// 9x15 (18)
		font1x = Font.colorMarked(
				BitmapCache.get( Assets.FONT1X), 22, 0x00000000, BitmapText.Font.LATIN_FULL );
		font1x.baseLine = 17;
		font1x.tracking = -2;
		font1x.texture.filter(Texture.LINEAR, Texture.LINEAR);

		//font1x double scaled
		font2x = Font.colorMarked(
				BitmapCache.get( Assets.FONT2X), 44, 0x00000000, BitmapText.Font.LATIN_FULL );
		font2x.baseLine = 38;
		font2x.tracking = -4;
		font2x.texture.filter(Texture.LINEAR, Texture.LINEAR);
	}
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:62,代码来源:PixelScene.java


注:本文中的com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon.landscape方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。