本文整理汇总了Java中org.andengine.engine.camera.hud.HUD类的典型用法代码示例。如果您正苦于以下问题:Java HUD类的具体用法?Java HUD怎么用?Java HUD使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HUD类属于org.andengine.engine.camera.hud包,在下文中一共展示了HUD类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createText
import org.andengine.engine.camera.hud.HUD; //导入依赖的package包/类
private void createText() {
HUD hud = new HUD();
res.camera.setHUD(hud);
infoText = new Text(Constants.CW / 2 , Constants.CH / 2 - 200, res.font, "12345678901234567890", vbom);
hud.attachChild(infoText);
scoreText = new Text(Constants.CW / 2 , Constants.CH / 2 + 200, res.font, "12345678901234567890", vbom);
hud.attachChild(scoreText);
Sprite banner = new Sprite(0, Constants.CH, res.bannerRegion, vbom) {
@Override
public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
float pTouchAreaLocalX, float pTouchAreaLocalY) {
if (pSceneTouchEvent.isActionDown()) {
res.activity.gotoPlayStore();
}
return true;
}
};
banner.setAnchorCenter(0, 1);
hud.registerTouchArea(banner);
hud.attachChild(banner);
}
示例2: createHUD
import org.andengine.engine.camera.hud.HUD; //导入依赖的package包/类
private void createHUD() {
mHUD = new HUD(); // create fixed HUD for static text display
mTimeText = new Text(0, 0, mResourcesManager.mFontSmall, Phrases.getPossibleCharacters(Phrases.FIELD_TIME), new TextOptions(HorizontalAlign.LEFT), mVertexManager); // prepare memory with all possible chars
mExclamation = new Text(0, 0, mResourcesManager.mFontBig, Phrases.getPossibleCharacters(Phrases.FIELD_EXCLAMATION), new TextOptions(HorizontalAlign.CENTER), mVertexManager); // prepare memory with all possible chars
mScoreText = new Text(0, 0, mResourcesManager.mFontSmall, Phrases.getPossibleCharacters(Phrases.FIELD_SCORE), new TextOptions(HorizontalAlign.RIGHT), mVertexManager); // prepare memory with all possible chars
mBottomText = new Text(0, 0, mResourcesManager.mFontSmall, Phrases.getPossibleCharacters(Phrases.FIELD_TAP_TO_LEAVE), new TextOptions(HorizontalAlign.CENTER), mVertexManager); // prepare memory with all possible chars
updateScore();
updateExclamation();
updateText(mBottomText, Phrases.mEmpty, GameScreen.CAMERA_WIDTH/2, GameScreen.CAMERA_HEIGHT/3, TEXT_HALIGN_CENTER, TEXT_VALIGN_TOP);
mHUD.attachChild(mTimeText);
mHUD.attachChild(mExclamation);
mHUD.attachChild(mScoreText);
mHUD.attachChild(mBottomText);
mCamera.setHUD(mHUD);
}
示例3: onAttached
import org.andengine.engine.camera.hud.HUD; //导入依赖的package包/类
/**
* Because clipping uses different coordinate transformation depending on whether the Scrollable
* is in a normal Scene or a HUD, we have to check where this Scrollable is being attached and
* set the isInHUD member appropriately.
*/
@Override
public void onAttached() {
IEntity node = this;
while (node.hasParent()) {
node = node.getParent();
if (node instanceof HUD || node instanceof CameraScene) {
this.isInHUD = true;
return;
}
}
}
示例4: createIntro
import org.andengine.engine.camera.hud.HUD; //导入依赖的package包/类
private void createIntro() {
mIntro = new HUD(); // create fixed HUD for tutorial display
mIntro_Text = new Text(0, 0, mResourcesManager.mFontSmall, Phrases.getPossibleCharacters(Phrases.FIELD_TAP_TO_START), new TextOptions(HorizontalAlign.CENTER), mVertexManager); // prepare memory with all possible chars
mIntro_Text.setColor(1.0f, 1.0f, 1.0f);
updateText(mIntro_Text, Phrases.mTapToStart, GameScreen.CAMERA_WIDTH/2, GameScreen.CAMERA_HEIGHT/3, TEXT_HALIGN_CENTER, TEXT_VALIGN_TOP);
mIntro.attachChild(mIntro_Text);
mCamera.setHUD(mIntro);
setOnSceneTouchListener(this);
}
示例5: getHUD
import org.andengine.engine.camera.hud.HUD; //导入依赖的package包/类
public HUD getHUD() {
return this.mHUD;
}
示例6: setHUD
import org.andengine.engine.camera.hud.HUD; //导入依赖的package包/类
public void setHUD(final HUD pHUD) {
this.mHUD = pHUD;
if (pHUD != null) {
pHUD.setCamera(this);
}
}
示例7: setHUD
import org.andengine.engine.camera.hud.HUD; //导入依赖的package包/类
public void setHUD(final HUD pHUD) {
this.mHUD = pHUD;
if(pHUD != null) {
pHUD.setCamera(this);
}
}
示例8: showLayer
import org.andengine.engine.camera.hud.HUD; //导入依赖的package包/类
public void showLayer(final ManagedLayer pLayer, final boolean pSuspendSceneDrawing, final
boolean pSuspendSceneUpdates, final boolean pSuspendSceneTouchEvents) {
// If the camera already has a HUD, we will use it.
if(mEngine.getCamera().hasHUD()){
mCameraHadHud = true;
} else {
// Otherwise, we will create one to use.
mCameraHadHud = false;
HUD placeholderHud = new HUD();
mEngine.getCamera().setHUD(placeholderHud);
}
// If the managed layer needs modal properties, set them.
if(pSuspendSceneDrawing || pSuspendSceneUpdates || pSuspendSceneTouchEvents) {
// Apply the managed layer directly to the Camera's HUD
mEngine.getCamera().getHUD().setChildScene(pLayer, pSuspendSceneDrawing,
pSuspendSceneUpdates, pSuspendSceneTouchEvents);
// Create the place-holder scene if it needs to be created.
if(mPlaceholderModalScene==null) {
mPlaceholderModalScene = new Scene();
mPlaceholderModalScene.setBackgroundEnabled(false);
}
// Apply the place-holder to the current scene.
mCurrentScene.setChildScene(mPlaceholderModalScene, pSuspendSceneDrawing,
pSuspendSceneUpdates, pSuspendSceneTouchEvents);
} else {
// If the managed layer does not need to be modal, simply set it to the HUD.
mEngine.getCamera().getHUD().setChildScene(pLayer);
}
// Set the camera for the managed layer so that it binds to the camera if the camera is
// moved/scaled/rotated.
pLayer.setCamera(mEngine.getCamera());
// Scale the layer according to screen size.
pLayer.setScale(ResourceManager.getInstance().cameraScaleFactorX,
ResourceManager.getInstance().cameraScaleFactorY);
// Let the layer know that it is being shown.
pLayer.onShowManagedLayer();
// Reflect that a layer is shown.
isLayerShown = true;
// Set the current layer to pLayer.
currentLayer = pLayer;
}