本文整理汇总了Java中com.watabou.noosa.NinePatch.size方法的典型用法代码示例。如果您正苦于以下问题:Java NinePatch.size方法的具体用法?Java NinePatch.size怎么用?Java NinePatch.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.watabou.noosa.NinePatch
的用法示例。
在下文中一共展示了NinePatch.size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Window
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
public Window( int width, int height, NinePatch chrome ) {
super();
blocker = new TouchArea( 0, 0, PixelScene.uiCamera.width, PixelScene.uiCamera.height ) {
@Override
protected void onClick( Touch touch ) {
if (!Window.this.chrome.overlapsScreenPoint(
(int)touch.current.x,
(int)touch.current.y )) {
onBackPressed();
}
}
};
blocker.camera = PixelScene.uiCamera;
add( blocker );
this.chrome = chrome;
this.width = width;
this.height = height;
chrome.x = -chrome.marginLeft();
chrome.y = -chrome.marginTop();
chrome.size(
width - chrome.x + chrome.marginRight(),
height - chrome.y + chrome.marginBottom() );
add( chrome );
camera = new Camera( 0, 0,
(int)chrome.width,
(int)chrome.height,
PixelScene.defaultZoom );
camera.x = (int)(Game.width - camera.width * camera.zoom) / 2;
camera.y = (int)(Game.height - camera.height * camera.zoom) / 2;
camera.scroll.set( chrome.x, chrome.y );
Camera.add( camera );
Keys.event.add( this );
}
示例2: Window
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
public Window( int width, int height, NinePatch chrome ) {
super();
TouchArea blocker = new TouchArea(0, 0, PixelScene.uiCamera.width, PixelScene.uiCamera.height) {
@Override
protected void onTouchDown(Touch touch) {
if (!Window.this.chrome.overlapsScreenPoint(
(int) touch.current.x,
(int) touch.current.y)) {
onBackPressed();
}
}
};
blocker.camera = PixelScene.uiCamera;
add(blocker);
this.chrome = chrome;
this.width = width;
this.height = height;
chrome.x = -chrome.marginLeft();
chrome.y = -chrome.marginTop();
chrome.size(
width - chrome.x + chrome.marginRight(),
height - chrome.y + chrome.marginBottom() );
add( chrome );
camera = new Camera( 0, 0,
(int)chrome.width,
(int)chrome.height,
PixelScene.defaultZoom );
camera.x = (int)(Game.width() - camera.width * camera.zoom) / 2;
camera.y = (int)(Game.height() - camera.height * camera.zoom) / 2;
camera.scroll.set( chrome.x, chrome.y );
Camera.add( camera );
Keys.event.add( this );
}
示例3: create
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
@Override
public void create() {
super.create();
int w = Camera.main.width;
int h = Camera.main.height;
RenderedText title = PixelScene.renderText(Messages.get(this, "title"), 9);
title.hardlight(Window.TITLE_COLOR);
title.x = (w - title.width()) / 2;
title.y = 4;
align(title);
add(title);
ExitButton btnExit = new ExitButton();
btnExit.setPos(Camera.main.width - btnExit.width(), 0);
add(btnExit);
RenderedTextMultiline text = renderMultiline(TXT_Update, 6);
NinePatch panel = Chrome.get(Chrome.Type.TOAST);
int pw = 135 + panel.marginLeft() + panel.marginRight() - 2;
int ph = h - 16;
panel.size(pw, ph);
panel.x = (w - pw) / 2f;
panel.y = title.y + title.height();
align(panel);
add(panel);
ScrollPane list = new ScrollPane(new Component());
add(list);
Component content = list.content();
content.clear();
text.maxWidth((int) panel.innerWidth());
content.add(text);
content.setSize(panel.innerWidth(), (int) Math.ceil(text.height()));
list.setRect(
panel.x + panel.marginLeft(),
panel.y + panel.marginTop() - 1,
panel.innerWidth(),
panel.innerHeight() + 2);
list.scrollTo(0, 0);
Archs archs = new Archs();
archs.setSize(Camera.main.width, Camera.main.height);
addToBack(archs);
fadeIn();
}
示例4: create
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
@Override
public void create() {
super.create();
int w = Camera.main.width;
int h = Camera.main.height;
RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9 );
title.hardlight(Window.TITLE_COLOR);
title.x = (w - title.width()) / 2 ;
title.y = 4;
align(title);
add(title);
ExitButton btnExit = new ExitButton();
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
add( btnExit );
RenderedTextMultiline text = renderMultiline(TXT_Update, 6 );
NinePatch panel = Chrome.get(Chrome.Type.TOAST);
int pw = 135 + panel.marginLeft() + panel.marginRight() - 2;
int ph = h - 16;
panel.size( pw, ph );
panel.x = (w - pw) / 2f;
panel.y = title.y + title.height();
align( panel );
add( panel );
ScrollPane list = new ScrollPane( new Component() );
add( list );
Component content = list.content();
content.clear();
text.maxWidth((int) panel.innerWidth());
content.add(text);
content.setSize( panel.innerWidth(), (int)Math.ceil(text.height()) );
list.setRect(
panel.x + panel.marginLeft(),
panel.y + panel.marginTop() - 1,
panel.innerWidth(),
panel.innerHeight() + 2);
list.scrollTo(0, 0);
Archs archs = new Archs();
archs.setSize( Camera.main.width, Camera.main.height );
addToBack( archs );
fadeIn();
}
示例5: create
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
@Override
public void create() {
super.create();
Music.INSTANCE.play( Assets.THEME, true );
Music.INSTANCE.volume( 1f );
uiCamera.visible = false;
int w = Camera.main.width;
int h = Camera.main.height;
Archs archs = new Archs();
archs.setSize( w, h );
add( archs );
int pw = Math.min( MAX_PANE_WIDTH, w - 6 );
int ph = h - 30;
NinePatch panel = Chrome.get( Chrome.Type.WINDOW );
panel.size( pw, ph );
panel.x = (w - pw) / 2;
panel.y = (h - ph) / 2;
add( panel );
BitmapText title = PixelScene.createText( TXT_TITLE, 9 );
title.hardlight( Window.TITLE_COLOR );
title.measure();
title.x = align( (w - title.width()) / 2 );
title.y = align( (panel.y - title.baseLine()) / 2 );
add( title );
ScrollPane list = new BadgesList( true );
add( list );
list.setRect(
panel.x + panel.marginLeft(),
panel.y + panel.marginTop(),
panel.innerWidth(),
panel.innerHeight() );
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) {
// YetAnotherPixelDungeon.switchNoFade(BadgesScene.class);
// }
// }
// };
}
示例6: Window
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
public Window( int width, int height, NinePatch chrome ) {
super();
blocker = new TouchArea( 0, 0, PixelScene.uiCamera.width, PixelScene.uiCamera.height ) {
@Override
protected void onClick( Touch touch ) {
if (!Window.this.chrome.overlapsScreenPoint(
(int)touch.current.x,
(int)touch.current.y )) {
onBackPressed();
}
}
};
blocker.camera = PixelScene.uiCamera;
add( blocker );
this.chrome = chrome;
this.width = width;
this.height = height;
shadow = new ShadowBox();
shadow.am = 0.5f;
shadow.camera = PixelScene.uiCamera.visible ?
PixelScene.uiCamera : Camera.main;
add( shadow );
chrome.x = -chrome.marginLeft();
chrome.y = -chrome.marginTop();
chrome.size(
width - chrome.x + chrome.marginRight(),
height - chrome.y + chrome.marginBottom() );
add( chrome );
camera = new Camera( 0, 0,
(int)chrome.width,
(int)chrome.height,
PixelScene.defaultZoom );
camera.x = (int)(Game.width - camera.width * camera.zoom) / 2;
camera.y = (int)(Game.height - camera.height * camera.zoom) / 2;
camera.scroll.set( chrome.x, chrome.y );
Camera.add( camera );
shadow.boxRect(
camera.x / camera.zoom,
camera.y / camera.zoom,
chrome.width(), chrome.height );
Keys.event.add( this );
}
示例7: create
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
@Override
public void create() {
super.create();
Music.INSTANCE.play( Assets.THEME, true );
Music.INSTANCE.volume( 1f );
uiCamera.visible = false;
int w = Camera.main.width;
int h = Camera.main.height;
Archs archs = new Archs();
archs.setSize( w, h );
add( archs );
int pw = Math.min( MAX_PANE_WIDTH, w - 6 );
int ph = h - 30;
NinePatch panel = Chrome.get( Chrome.Type.WINDOW );
panel.size( pw, ph );
panel.x = (w - pw) / 2;
panel.y = (h - ph) / 2;
add( panel );
BitmapText title = PixelScene.createText( TXT_TITLE, 9 );
title.hardlight( Window.TITLE_COLOR );
title.measure();
title.x = align( (w - title.width()) / 2 );
title.y = align( (panel.y - title.baseLine()) / 2 );
add( title );
Badges.loadGlobal();
ScrollPane list = new BadgesList( true );
add( list );
list.setRect(
panel.x + panel.marginLeft(),
panel.y + panel.marginTop(),
panel.innerWidth(),
panel.innerHeight() );
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 );
}
}
};
}
示例8: Window
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
public Window( int width, int height, NinePatch chrome ) {
super();
blocker = new TouchArea( 0, 0, PixelScene.uiCamera.width, PixelScene.uiCamera.height ) {
@Override
protected void onClick( Touch touch ) {
if (!Window.this.chrome.overlapsScreenPoint(
(int)touch.current.x,
(int)touch.current.y )) {
onBackPressed();
}
}
};
blocker.camera = PixelScene.uiCamera;
add( blocker );
this.chrome = chrome;
this.width = width;
this.height = height;
shadow = new ShadowBox();
shadow.am = 0.5f;
shadow.camera = PixelScene.uiCamera.visible ?
PixelScene.uiCamera : Camera.main;
add( shadow );
chrome.x = -chrome.marginLeft();
chrome.y = -chrome.marginTop();
chrome.size(
width - chrome.x + chrome.marginRight(),
height - chrome.y + chrome.marginBottom() );
add( chrome );
camera = new Camera( 0, 0,
(int)chrome.width,
(int)chrome.height,
PixelScene.defaultZoom );
camera.x = (int)(Game.width - camera.width * camera.zoom) / 2;
camera.y = (int)(Game.height - camera.height * camera.zoom) / 2;
camera.scroll.set( chrome.x, chrome.y );
Camera.add( camera );
shadow.boxRect(
camera.x / camera.zoom,
camera.y / camera.zoom,
chrome.width(), chrome.height );
Keys.event.add( this );
}
示例9: create
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
@Override
public void create() {
super.create();
Music.INSTANCE.play( Assets.THEME, true );
Music.INSTANCE.volume( 1f );
uiCamera.visible = false;
int w = Camera.main.width;
int h = Camera.main.height;
Archs archs = new Archs();
archs.setSize( w, h );
add( archs );
int pw = Math.min( 160, w - 6 );
int ph = h - 30;
NinePatch panel = Chrome.get( Chrome.Type.WINDOW );
panel.size( pw, ph );
panel.x = (w - pw) / 2;
panel.y = (h - ph) / 2;
add( panel );
BitmapText title = PixelScene.createText( TXT_TITLE, 9 );
title.hardlight( Window.TITLE_COLOR );
title.measure();
title.x = align( (w - title.width()) / 2 );
title.y = align( (panel.y - title.baseLine()) / 2 );
add( title );
Badges.loadGlobal();
ScrollPane list = new BadgesList( true );
add( list );
list.setRect(
panel.x + panel.marginLeft(),
panel.y + panel.marginTop(),
panel.innerWidth(),
panel.innerHeight() );
ExitButton btnExit = new ExitButton();
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
add( btnExit );
fadeIn();
}
示例10: create
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
@Override
public void create() {
super.create();
Music.INSTANCE.play(Assets.THEME, true);
Music.INSTANCE.volume(1f);
uiCamera.visible = false;
int w = Camera.main.width;
int h = Camera.main.height;
Archs archs = new Archs();
archs.setSize(w, h);
add(archs);
int pw = Math.min(MAX_PANE_WIDTH, w - 6);
int ph = h - 30;
NinePatch panel = Chrome.get(Chrome.Type.WINDOW);
panel.size(pw, ph);
panel.x = (w - pw) / 2;
panel.y = (h - ph) / 2;
add(panel);
BitmapText title = PixelScene.createText(TXT_TITLE, 9);
title.hardlight(Window.TITLE_COLOR);
title.measure();
title.x = align((w - title.width()) / 2);
title.y = align((panel.y - title.baseLine()) / 2);
add(title);
Badges.loadGlobal();
ScrollPane list = new BadgesList(true);
add(list);
list.setRect(
panel.x + panel.marginLeft(),
panel.y + panel.marginTop(),
panel.innerWidth(),
panel.innerHeight());
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) {
PixelDungeon.switchNoFade(BadgesScene.class);
}
}
};
}
示例11: Window
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
public Window(int width, int height, NinePatch chrome) {
super();
blocker = new TouchArea(0, 0, PixelScene.uiCamera.width, PixelScene.uiCamera.height) {
@Override
protected void onClick(NoosaInputProcessor.Touch touch) {
if (!Window.this.chrome.overlapsScreenPoint(
(int) touch.current.x,
(int) touch.current.y)) {
onBackPressed();
}
}
};
blocker.camera = PixelScene.uiCamera;
add(blocker);
this.chrome = chrome;
this.width = width;
this.height = height;
shadow = new ShadowBox();
shadow.am = 0.5f;
shadow.camera = PixelScene.uiCamera.visible ?
PixelScene.uiCamera : Camera.main;
add(shadow);
chrome.x = -chrome.marginLeft();
chrome.y = -chrome.marginTop();
chrome.size(
width - chrome.x + chrome.marginRight(),
height - chrome.y + chrome.marginBottom());
add(chrome);
camera = new Camera(0, 0,
(int) chrome.width,
(int) chrome.height,
PixelScene.defaultZoom);
camera.x = (int) (Game.width - camera.width * camera.zoom) / 2;
camera.y = (int) (Game.height - camera.height * camera.zoom) / 2;
camera.scroll.set(chrome.x, chrome.y);
Camera.add(camera);
shadow.boxRect(
camera.x / camera.zoom,
camera.y / camera.zoom,
chrome.width(), chrome.height);
Game.instance.getInputProcessor().addKeyListener(this);
}
示例12: Window
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
public Window( int width, int height, int yOffset, NinePatch chrome ) {
super();
this.yOffset = yOffset;
blocker = new TouchArea( 0, 0, PixelScene.uiCamera.width, PixelScene.uiCamera.height ) {
@Override
protected void onClick( Touch touch ) {
if (Window.this.parent != null && !Window.this.chrome.overlapsScreenPoint(
(int)touch.current.x,
(int)touch.current.y )) {
onBackPressed();
}
}
};
blocker.camera = PixelScene.uiCamera;
add( blocker );
this.chrome = chrome;
this.width = width;
this.height = height;
shadow = new ShadowBox();
shadow.am = 0.5f;
shadow.camera = PixelScene.uiCamera.visible ?
PixelScene.uiCamera : Camera.main;
add( shadow );
chrome.x = -chrome.marginLeft();
chrome.y = -chrome.marginTop();
chrome.size(
width - chrome.x + chrome.marginRight(),
height - chrome.y + chrome.marginBottom() );
add( chrome );
camera = new Camera( 0, 0,
(int)chrome.width,
(int)chrome.height,
PixelScene.defaultZoom );
camera.x = (int)(Game.width - camera.width * camera.zoom) / 2;
camera.y = (int)(Game.height - camera.height * camera.zoom) / 2;
camera.y -= yOffset * camera.zoom;
camera.scroll.set( chrome.x, chrome.y );
Camera.add( camera );
shadow.boxRect(
camera.x / camera.zoom,
camera.y / camera.zoom,
chrome.width(), chrome.height );
Keys.event.add( this );
}
示例13: create
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
@Override
public void create() {
super.create();
Music.INSTANCE.play( Assets.THEME, true );
Music.INSTANCE.volume( 1f );
uiCamera.setVisible(false);
int w = Camera.main.width;
int h = Camera.main.height;
Archs archs = new Archs();
archs.setSize( w, h );
add( archs );
int pw = Math.min( 160, w - 6 );
int ph = h - 30;
NinePatch panel = Chrome.get( Chrome.Type.WINDOW );
panel.size( pw, ph );
panel.x = (w - pw) / 2;
panel.y = (h - ph) / 2;
add( panel );
Text title = PixelScene.createText( TXT_TITLE, GuiProperties.titleFontSize());
title.hardlight( Window.TITLE_COLOR );
title.measure();
title.x = align( (w - title.width()) / 2 );
title.y = align( (panel.y - title.baseLine()) / 2 );
add( title );
Badges.loadGlobal();
ScrollPane list = new BadgesList( true );
add( list );
list.setRect(
panel.x + panel.marginLeft(),
panel.y + panel.marginTop(),
panel.innerWidth(),
panel.innerHeight() );
ExitButton btnExit = new ExitButton();
btnExit.setPos( Camera.main.width - btnExit.width(), 0 );
add( btnExit );
fadeIn();
}
示例14: create
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
@Override
public void create() {
super.create();
Text title = createMultiline(TTL_Welcome, GuiProperties.bigTitleFontSize());
int w = Camera.main.width;
int h = Camera.main.height;
int pw = w - 10;
title.maxWidth(pw);
title.measure();
title.x = align((w - title.width()) / 2);
title.y = align(8);
add(title);
NinePatch panel = Chrome.get(Chrome.Type.WINDOW);
panel.x = (w - pw) / 2;
panel.y = title.y + title.height() + GAP * 2;
int ph = (int) (h - panel.y - 22);
panel.size(pw, ph);
add(panel);
ScrollPane list = new ScrollPane(new Component());
add(list);
list.setRect(panel.x + panel.marginLeft(), panel.y + panel.marginTop(), panel.innerWidth(),
panel.innerHeight());
list.scrollTo(0, 0);
Component content = list.content();
content.clear();
float yPos = 0;
Text text = createMultiline(Game.getVar(R.string.AllowStatisticsCollectionScene_Request), GuiProperties.regularFontSize());
text.maxWidth((int) panel.innerWidth());
text.measure();
content.add(text);
yPos += text.height() + GAP;
content.setSize(panel.innerWidth(), yPos);
RedButton allow = new RedButton(Game.getVar(R.string.AllowStatisticsCollectionScene_Allow)) {
@Override
protected void onClick() {
Preferences.INSTANCE.put(Preferences.KEY_COLLECT_STATS, 100);
Game.instance().initEventCollector();
Game.switchScene(TitleScene.class);
}
};
RedButton deny = new RedButton(Game.getVar(R.string.AllowStatisticsCollectionScene_Deny)) {
@Override
protected void onClick() {
Preferences.INSTANCE.put(Preferences.KEY_COLLECT_STATS, -100);
Game.instance().initEventCollector();
Game.switchScene(TitleScene.class);
}
};
allow.setRect((w - pw) / 2, h - 22, pw/2 - GAP, 18);
deny.setRect((w - pw) / 2 + pw/2 , h - 22, pw/2-GAP, 18);
add(allow);
add(deny);
Archs archs = new Archs();
archs.setSize(Camera.main.width, Camera.main.height);
addToBack(archs);
fadeIn();
}
示例15: Window
import com.watabou.noosa.NinePatch; //导入方法依赖的package包/类
public Window( int width, int height, int yOffset, NinePatch chrome ) {
super();
this.yOffset = yOffset;
blocker = new TouchArea( 0, 0, PixelScene.uiCamera.width, PixelScene.uiCamera.height ) {
@Override
protected void onClick( NoosaInputProcessor.Touch touch ) {
if (Window.this.parent != null && !Window.this.chrome.overlapsScreenPoint(
(int)touch.current.x,
(int)touch.current.y )) {
onBackPressed();
}
}
};
blocker.camera = PixelScene.uiCamera;
add( blocker );
this.chrome = chrome;
this.width = width;
this.height = height;
shadow = new ShadowBox();
shadow.am = 0.5f;
shadow.camera = PixelScene.uiCamera.visible ?
PixelScene.uiCamera : Camera.main;
add( shadow );
chrome.x = -chrome.marginLeft();
chrome.y = -chrome.marginTop();
chrome.size(
width - chrome.x + chrome.marginRight(),
height - chrome.y + chrome.marginBottom() );
add( chrome );
camera = new Camera( 0, 0,
(int)chrome.width,
(int)chrome.height,
PixelScene.defaultZoom );
camera.x = (int)(Game.width - camera.width * camera.zoom) / 2;
camera.y = (int)(Game.height - camera.height * camera.zoom) / 2;
camera.y -= yOffset * camera.zoom;
camera.scroll.set( chrome.x, chrome.y );
Camera.add( camera );
shadow.boxRect(
camera.x / camera.zoom,
camera.y / camera.zoom,
chrome.width(), chrome.height );
Game.instance.getInputProcessor().addKeyListener(this);
}