本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}