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


Java ShatteredPixelDungeon.scale方法代码示例

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


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

示例1: 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

示例2: 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

示例3: DisplayTab

import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; //导入方法依赖的package包/类
public DisplayTab() {
	super();

	OptionSlider scale = new OptionSlider(Messages.get(this, "scale"),
			(int)Math.ceil(2* Game.density)+ "X",
			PixelScene.maxDefaultZoom + "X",
			(int)Math.ceil(2* Game.density),
			PixelScene.maxDefaultZoom ) {
		@Override
		protected void onChange() {
			if (getSelectedValue() != ShatteredPixelDungeon.scale()) {
				ShatteredPixelDungeon.scale(getSelectedValue());
				ShatteredPixelDungeon.switchNoFade((Class<? extends PixelScene>) ShatteredPixelDungeon.scene().getClass(), new Game.SceneChangeCallback() {
					@Override
					public void beforeCreate() {
						//do nothing
					}

					@Override
					public void afterCreate() {
						Game.scene().add(new WndSettings());
					}
				});
			}
		}
	};
	if ((int)Math.ceil(2* Game.density) < PixelScene.maxDefaultZoom) {
		scale.setSelectedValue(PixelScene.defaultZoom);
		scale.setRect(0, 0, WIDTH, SLIDER_HEIGHT);
		add(scale);
	}

	RedButton btnResolution = new RedButton(Gdx.graphics.isFullscreen() ? TXT_SWITCH_WIN : TXT_SWITCH_FULL ) {
		@Override
		protected void onClick() {
			ShatteredPixelDungeon.fullscreen(!ShatteredPixelDungeon.fullscreen());
		}
	};
	btnResolution.enable(ShatteredPixelDungeon.instance.getPlatformSupport().isFullscreenEnabled() );
	btnResolution.setRect(0, scale.bottom() + GAP_TINY, WIDTH, BTN_HEIGHT);
	add(btnResolution);

	OptionSlider brightness = new OptionSlider(Messages.get(this, "brightness"),
			Messages.get(this, "dark"), Messages.get(this, "bright"), -2, 2) {
		@Override
		protected void onChange() {
			ShatteredPixelDungeon.brightness(getSelectedValue());
		}
	};
	brightness.setSelectedValue(ShatteredPixelDungeon.brightness());
	brightness.setRect(0, btnResolution.bottom() + GAP_LRG, WIDTH, SLIDER_HEIGHT);
	add(brightness);

	OptionSlider tileGrid = new OptionSlider(Messages.get(this, "visual_grid"),
			Messages.get(this, "off"), Messages.get(this, "high"), -1, 3) {
		@Override
		protected void onChange() {
			ShatteredPixelDungeon.visualGrid(getSelectedValue());
		}
	};
	tileGrid.setSelectedValue(ShatteredPixelDungeon.visualGrid());
	tileGrid.setRect(0, brightness.bottom() + GAP_TINY, WIDTH, SLIDER_HEIGHT);
	add(tileGrid);
}
 
开发者ID:00-Evan,项目名称:shattered-pixel-dungeon-gdx,代码行数:65,代码来源:WndSettings.java


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