本文整理汇总了Java中com.watabou.noosa.TouchArea类的典型用法代码示例。如果您正苦于以下问题:Java TouchArea类的具体用法?Java TouchArea怎么用?Java TouchArea使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TouchArea类属于com.watabou.noosa包,在下文中一共展示了TouchArea类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WndStory
import com.watabou.noosa.TouchArea; //导入依赖的package包/类
public WndStory(String text) {
super(0, 0, Chrome.get(Chrome.Type.SCROLL));
tf = PixelScene.renderMultiline(text, 7);
tf.maxWidth(ShatteredPixelDungeon.landscape() ?
WIDTH_L - MARGIN * 2 :
WIDTH_P - MARGIN * 2);
tf.invert();
tf.setPos(MARGIN, 0);
add(tf);
add(new TouchArea(chrome) {
@Override
protected void onClick(Touch touch) {
hide();
}
});
resize((int) (tf.width() + MARGIN * 2),
(int) Math.min(tf.height(), 180));
}
示例2: WndStory
import com.watabou.noosa.TouchArea; //导入依赖的package包/类
public WndStory( String text ) {
super( 0, 0, Chrome.get( Chrome.Type.SCROLL ) );
tf = PixelScene.renderMultiline( text, 7 );
tf.maxWidth(UNISTPixelDungeon.landscape() ?
WIDTH_L - MARGIN * 2:
WIDTH_P - MARGIN *2);
tf.invert();
tf.setPos(MARGIN, 0);
add( tf );
add( new TouchArea( chrome ) {
@Override
protected void onClick( Touch touch ) {
hide();
}
} );
resize( (int)(tf.width() + MARGIN * 2), (int)Math.min( tf.height(), 180 ) );
}
示例3: WndStory
import com.watabou.noosa.TouchArea; //导入依赖的package包/类
public WndStory( String text ) {
super( 0, 0, Chrome.get( Chrome.Type.SCROLL ) );
tf = PixelScene.createMultiline( text, 7 );
tf.maxWidth = WIDTH - MARGIN * 2;
tf.measure();
tf.ra = bgR;
tf.ga = bgG;
tf.ba = bgB;
tf.rm = -bgR;
tf.gm = -bgG;
tf.bm = -bgB;
tf.x = MARGIN;
add( tf );
add( new TouchArea( chrome ) {
@Override
protected void onClick( NoosaInputProcessor.Touch touch ) {
hide();
}
} );
resize( (int)(tf.width() + MARGIN * 2), (int)Math.min( tf.height(), 180 ) );
}
示例4: WndStory
import com.watabou.noosa.TouchArea; //导入依赖的package包/类
public WndStory( String text ) {
super( 0, 0, Chrome.get( Chrome.Type.SCROLL ) );
tf = PixelScene.createMultiline( text, 7 );
tf.maxWidth = WIDTH - MARGIN * 2;
tf.measure();
tf.ra = bgR;
tf.ga = bgG;
tf.ba = bgB;
tf.rm = -bgR;
tf.gm = -bgG;
tf.bm = -bgB;
tf.x = MARGIN;
add( tf );
add( new TouchArea( chrome ) {
@Override
protected void onClick( Touch touch ) {
hide();
}
} );
resize( (int)(tf.width() + MARGIN * 2), (int)Math.min( tf.height(), 180 ) );
}
示例5: WndStory
import com.watabou.noosa.TouchArea; //导入依赖的package包/类
public WndStory( String text ) {
super( 0, 0, Chrome.get( Chrome.Type.SCROLL ) );
tf = PixelScene.createMultiline( text, 7 );
tf.maxWidth = ShatteredPixelDungeon.landscape() ?
WIDTH_L - MARGIN * 2:
WIDTH_P - MARGIN *2;
tf.measure();
tf.ra = bgR;
tf.ga = bgG;
tf.ba = bgB;
tf.rm = -bgR;
tf.gm = -bgG;
tf.bm = -bgB;
tf.x = MARGIN;
add( tf );
add( new TouchArea( chrome ) {
@Override
protected void onClick( Touch touch ) {
hide();
}
} );
resize( (int)(tf.width() + MARGIN * 2), (int)Math.min( tf.height(), 180 ) );
}
示例6: WndStory
import com.watabou.noosa.TouchArea; //导入依赖的package包/类
public WndStory( String text ) {
super( 0, 0, Chrome.get( Chrome.Type.SCROLL ) );
tf = PixelScene.renderMultiline( text, 6 );
tf.maxWidth(ShatteredPixelDungeon.landscape() ?
WIDTH_L - MARGIN * 2:
WIDTH_P - MARGIN *2);
tf.invert();
tf.setPos(MARGIN, 0);
add( tf );
add( new TouchArea( chrome ) {
@Override
protected void onClick( Touch touch ) {
hide();
}
} );
resize( (int)(tf.width() + MARGIN * 2), (int)Math.min( tf.height(), 180 ) );
}
示例7: createTouchEmail
import com.watabou.noosa.TouchArea; //导入依赖的package包/类
private Text createTouchEmail(final String address, Text text2)
{
Text text = createText(address, text2);
text.hardlight( Window.TITLE_COLOR );
TouchArea area = new TouchArea( text ) {
@Override
protected void onClick( Touch touch ) {
Intent intent = new Intent( Intent.ACTION_SEND);
intent.setType("message/rfc822");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{address} );
intent.putExtra(Intent.EXTRA_SUBJECT, Game.getVar(R.string.app_name) );
Game.instance().startActivity( Intent.createChooser(intent, SND) );
}
};
add(area);
return text;
}
示例8: createTouchLink
import com.watabou.noosa.TouchArea; //导入依赖的package包/类
private Text createTouchLink(final String address, Text visit)
{
Text text = createText(address, visit);
text.hardlight( Window.TITLE_COLOR );
TouchArea area = new TouchArea( text ) {
@Override
protected void onClick( Touch touch ) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(address));
Game.instance().startActivity( Intent.createChooser(intent, OUR_SITE) );
}
};
add(area);
return text;
}
示例9: WndStory
import com.watabou.noosa.TouchArea; //导入依赖的package包/类
public WndStory( String text ) {
super( 0, 0, Chrome.get( Chrome.Type.SCROLL ) );
tf = PixelScene.renderMultiline( text, 6 );
tf.maxWidth(ShatteredPixelDungeon.landscape() ?
WIDTH_L - MARGIN * 2:
WIDTH_P - MARGIN *2);
tf.invert();
tf.setPos(MARGIN, 0);
add( tf );
add( new TouchArea( chrome ) {
@Override
protected void onClick( NoosaInputProcessor.Touch touch ) {
hide();
}
} );
resize( (int)(tf.width() + MARGIN * 2), (int)Math.min( tf.height(), 180 ) );
}
示例10: createChildren
import com.watabou.noosa.TouchArea; //导入依赖的package包/类
@Override
protected void createChildren() {
panel = Chrome.get(Chrome.Type.TOAST_TR);
add( panel );
//updateMessage = new BitmapText("Checking Updates", PixelScene.font1x);
updateMessage = PixelScene.createText("Checking Updates", 9);
add(updateMessage);
touchUpdate = new TouchArea( panel ){
@Override
protected void onClick( NoosaInputProcessor.Touch touch ) {
if (updateAvailable) {
parent.add(new WndUpdate() );
Sample.INSTANCE.play( Assets.SND_CLICK );
}
}
};
add(touchUpdate);
updateMessage();
}
示例11: createChildren
import com.watabou.noosa.TouchArea; //导入依赖的package包/类
@Override
protected void createChildren() {
hotArea = new TouchArea<T>( 0, 0, 0, 0 ) {
@Override
protected void onTouchDown(NoosaInputProcessor.Touch touch) {
pressed = true;
pressTime = 0;
processed = false;
Button.this.onTouchDown();
};
@Override
protected void onTouchUp(NoosaInputProcessor.Touch touch) {
pressed = false;
Button.this.onTouchUp();
};
@Override
protected void onClick( NoosaInputProcessor.Touch touch ) {
if (!processed) {
if (NoosaInputProcessor.modifier && onLongClick()) {
// Do nothing
} else {
Button.this.onClick();
}
}
};
@Override
public boolean onKeyDown(NoosaInputProcessor.Key<T> key) {
return Button.this.onKeyDown(key);
}
@Override
public boolean onKeyUp(NoosaInputProcessor.Key<T> key) {
return Button.this.onKeyUp(key);
}
};
add( hotArea );
}
示例12: Window
import com.watabou.noosa.TouchArea; //导入依赖的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 );
}
示例13: createChildren
import com.watabou.noosa.TouchArea; //导入依赖的package包/类
@Override
protected void createChildren() {
hotArea = new TouchArea<T>( 0, 0, 0, 0 ) {
@Override
protected void onTouchDown(NoosaInputProcessor.Touch touch) {
pressed = true;
pressTime = 0;
processed = false;
Button.this.onTouchDown();
};
@Override
protected void onTouchUp(NoosaInputProcessor.Touch touch) {
pressed = false;
Button.this.onTouchUp();
};
@Override
protected void onClick( NoosaInputProcessor.Touch touch ) {
if (!processed) {
if (NoosaInputProcessor.modifier && onLongClick()) {
// Do nothing
} else {
Button.this.onClick();
}
}
};
@Override
public boolean onKeyDown(NoosaInputProcessor.Key<T> key) {
return Button.this.onKeyDown(key);
}
@Override
public boolean onKeyUp(NoosaInputProcessor.Key<T> key) {
return Button.this.onKeyUp(key);
}
};
add(hotArea);
}
示例14: ChangesWindow
import com.watabou.noosa.TouchArea; //导入依赖的package包/类
public ChangesWindow( Image icon, String title, String message ) {
super( icon, title, message);
add( new TouchArea( chrome ) {
@Override
protected void onClick( Touchscreen.Touch touch ) {
hide();
}
} );
}
示例15: Window
import com.watabou.noosa.TouchArea; //导入依赖的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 );
}