本文整理汇总了Java中org.andengine.entity.sprite.TiledSprite类的典型用法代码示例。如果您正苦于以下问题:Java TiledSprite类的具体用法?Java TiledSprite怎么用?Java TiledSprite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TiledSprite类属于org.andengine.entity.sprite包,在下文中一共展示了TiledSprite类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showWordCollection
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
private void showWordCollection() {
final WordsStop stop = this;
this.overlay.clearFocus();
final WordBuilderHUD hud = new WordBuilderHUD(this.tour.game, this.tour.game.getCurrentLevel(), this.wordTile) {
@Override
protected void collectWord(final TiledSprite wordSprite, final WordBuilder builder) {
super.collectWord(wordSprite, builder);
next();
}
@Override
public void putChar(Letter letter) {
// Don't allow spelling
return;
}
@Override
public void finish() {
overlay.clearManagedHUD();
}
};
this.overlay.setSpotlight(TourOverlay.SPOTLIGHT_NONE);
this.overlay.setManagedHUD(hud);
this.overlay.showMessage(this.getMessage(MSG_COLLECTION), TourOverlay.MessageBox.Top);
}
示例2: onUpdateColor
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
@Override
public void onUpdateColor(final TiledSprite pTiledSprite) {
final float[] bufferData = this.mBufferData;
final float packedColor = pTiledSprite.getColor().getABGRPackedFloat();
final int tileCount = pTiledSprite.getTileCount();
int bufferDataOffset = 0;
for (int i = 0; i < tileCount; i++) {
bufferData[bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
bufferData[bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
bufferData[bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
bufferData[bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
bufferData[bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
bufferData[bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
bufferDataOffset += TiledSprite.TILEDSPRITE_SIZE;
}
this.setDirtyOnHardware();
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:22,代码来源:HighPerformanceTiledSpriteVertexBufferObject.java
示例3: onUpdateColor
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
@Override
public void onUpdateColor(final TiledSprite pTiledSprite) {
final FloatBuffer bufferData = this.mFloatBuffer;
final float packedColor = pTiledSprite.getColor().getABGRPackedFloat();
final int tileCount = pTiledSprite.getTileCount();
int bufferDataOffset = 0;
for (int i = 0; i < tileCount; i++) {
bufferData.put(bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX, packedColor);
bufferData.put(bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX, packedColor);
bufferData.put(bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX, packedColor);
bufferData.put(bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX, packedColor);
bufferData.put(bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX, packedColor);
bufferData.put(bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX, packedColor);
bufferDataOffset += TiledSprite.TILEDSPRITE_SIZE;
}
this.setDirtyOnHardware();
}
示例4: onUpdateColor
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
@Override
public void onUpdateColor(final TiledSprite pTiledSprite) {
final float[] bufferData = this.mBufferData;
final float packedColor = pTiledSprite.getColor().getABGRPackedFloat();
final int tileCount = pTiledSprite.getTileCount();
int bufferDataOffset = 0;
for(int i = 0; i < tileCount; i++) {
bufferData[bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
bufferData[bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
bufferData[bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
bufferData[bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
bufferData[bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
bufferData[bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
bufferDataOffset += TiledSprite.TILEDSPRITE_SIZE;
}
this.setDirtyOnHardware();
}
示例5: onUpdateColor
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
@Override
public void onUpdateColor(final TiledSprite pTiledSprite) {
final FloatBuffer bufferData = this.mFloatBuffer;
final float packedColor = pTiledSprite.getColor().getABGRPackedFloat();
final int tileCount = pTiledSprite.getTileCount();
int bufferDataOffset = 0;
for(int i = 0; i < tileCount; i++) {
bufferData.put(bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX, packedColor);
bufferData.put(bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX, packedColor);
bufferData.put(bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX, packedColor);
bufferData.put(bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX, packedColor);
bufferData.put(bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX, packedColor);
bufferData.put(bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX, packedColor);
bufferDataOffset += TiledSprite.TILEDSPRITE_SIZE;
}
this.setDirtyOnHardware();
}
示例6: createActor
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
private void createActor() {
dandelion = new TiledSprite(200, 400, res.dandelionRegion, vbom);
dandelion.setZIndex(999);
dandelion.registerUpdateHandler(new IUpdateHandler() {
@Override
public void onUpdate(float pSecondsElapsed) {
if (dandelionBody.getLinearVelocity().y > -0.01) {
dandelion.setCurrentTileIndex(0);
} else {
dandelion.setCurrentTileIndex(1);
}
}
@Override
public void reset() { }
});
dandelionBody = PhysicsFactory.createCircleBody(
physics, dandelion, BodyType.DynamicBody, Constants.DANDELION_FIXTURE);
dandelionBody.setFixedRotation(true);
dandelionBody.setUserData(Constants.BODY_ACTOR);
physics.registerPhysicsConnector(new PhysicsConnector(dandelion, dandelionBody));
attachChild(dandelion);
}
示例7: initTalk
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
private void initTalk(int scenarioNo, int seqNo) {
TalkLogic talkLogic = new TalkLogic();
// 会話内容取得
List<PlayerTalkDto> talks = talkLogic.getTalkDtoList(getBaseScene(), scenarioNo, seqNo);
// 顔リスト作成
SparseArray<TiledSprite> actorFaces = talkLogic.getTalkFaceSparse(getBaseScene(), talks);
// 会話レイヤー作成
TalkLayer talkLayer = new TalkLayer(getBaseScene());
talkLayer.initTalk(actorFaces, talks);
talkLayer.hide();
talkLayer.setZIndex(LayerZIndexType.TALK_LAYER.getValue());
talkLayer.setTag(CommonTag.TALK_LAYER_TAG.getValue());
getBaseScene().attachChild(talkLayer);
// 会話表示
talkLayer.nextTalk();
}
示例8: getTalkFaceSparse
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
public SparseArray<TiledSprite> getTalkFaceSparse(KeyListenScene pBaseScene, List<PlayerTalkDto> talks) {
pBaseScene.getBaseActivity().openDB();
MActorDao mActorDao = new MActorDao();
// 顔画像作成
SparseArray<TiledSprite> actorFaces = new SparseArray<TiledSprite>();
int count = talks.size();
for (int i = 0; i < count; i++) {
PlayerTalkDto playerTalkDto = talks.get(i);
MActorEntity mActorEntity = mActorDao.selectById(pBaseScene.getBaseActivity().getDB(), playerTalkDto.getPlayerId());
playerTalkDto.setName(mActorEntity.getActorName());
if (actorFaces.indexOfKey(mActorEntity.getActorId()) >= 0 ) {
continue;
}
String faceName = ActorSpriteUtil.getFaceFileName(mActorEntity.getImageResId());
TiledSprite faceSprite = SRPGSpriteUtil.getResourceFaceSprite(pBaseScene,
mActorEntity.getActorId(), faceName);
actorFaces.put(mActorEntity.getActorId(), faceSprite);
}
pBaseScene.getBaseActivity().closeDB();
return actorFaces;
}
示例9: initTalk
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
public void initTalk(SparseArray<TiledSprite> faces, List<PlayerTalkDto> talks) {
// 初期化
this.talkIndex = 0;
this.textMaxLength = 0;
// 会話する顔を登録
this.faces = faces;
// 会話内容を登録
this.talks = talks;
// 設定された会話内容を元に最大テキストサイズで初期化してTextを用意する
textMaxLength = getMaxLength(talks);
talkText = new Text(16, 16, font,
getSizeToStr("-", textMaxLength),
new TextOptions(HorizontalAlign.LEFT),
baseScene.getBaseActivity().getVertexBufferObjectManager());
talkText.setAutoWrap(AutoWrap.WORDS);
nameText = new Text(16, 16, font,
getSizeToStr("-", textMaxLength),
new TextOptions(HorizontalAlign.LEFT),
baseScene.getBaseActivity().getVertexBufferObjectManager());
nameText.setColor(Color.GREEN);
nextTalk();
}
示例10: collectWord
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
protected void collectWord(final TiledSprite wordSprite, final WordBuilder builder) {
game.playBlockSound(buildWord.sound);
Inventory.getInstance().add(builder.item_name.get());
game.session.addExperience(buildWord.points);
int builderIndex = this.buildQueue.indexOf(builder);
Debug.d("Removing queue item at " + builderIndex);
for (int i = builderIndex+1; i >= 0 && i < this.buildQueue.size(); i++) {
Debug.d("Moving queue item at "+i);
WordBuilder nextInQueue = this.buildQueue.get(i);
TiledSprite nextSprite = this.queueSpriteMap.get(nextInQueue);
nextSprite.registerEntityModifier(new MoveXModifier(0.5f, nextSprite.getX(), nextSprite.getX()-64));
Text nextProgress = this.queueProgressMap.get(nextInQueue);
nextProgress.registerEntityModifier(new MoveXModifier(0.5f, nextProgress.getX(), nextProgress.getX()-64));
}
this.queueSpriteMap.remove(builder);
wordSprite.registerEntityModifier(new ParallelEntityModifier(
new MoveYModifier(0.5f, wordSprite.getY(), wordSprite.getY() + 128),
new FadeOutModifier(0.5f)
));
this.unregisterTouchArea(this.queueTouchAreaMap.get(builder));
this.queueTouchAreaMap.remove(builder);
this.buildQueue.remove(builder);
tile.checkAttention();
builder.delete(PhoeniciaContext.context);
}
示例11: onUpdateVertices
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
@Override
public void onUpdateVertices(final TiledSprite pTiledSprite) {
final float[] bufferData = this.mBufferData;
final float width = pTiledSprite.getWidth(); // TODO Optimize with field access?
final float height = pTiledSprite.getHeight(); // TODO Optimize with field access?
final int tileCount = pTiledSprite.getTileCount();
int bufferDataOffset = 0;
for (int i = 0; i < tileCount; i++) {
bufferData[bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = 0;
bufferData[bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = 0;
bufferData[bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = 0;
bufferData[bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = height;
bufferData[bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = width;
bufferData[bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = 0;
bufferData[bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = width;
bufferData[bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = 0;
bufferData[bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = 0;
bufferData[bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = height;
bufferData[bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = width;
bufferData[bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = height;
bufferDataOffset += TiledSprite.TILEDSPRITE_SIZE;
}
this.setDirtyOnHardware();
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:34,代码来源:HighPerformanceTiledSpriteVertexBufferObject.java
示例12: onUpdateVertices
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
@Override
public void onUpdateVertices(final TiledSprite pTiledSprite) {
final FloatBuffer bufferData = this.mFloatBuffer;
final float width = pTiledSprite.getWidth(); // TODO Optimize with field access?
final float height = pTiledSprite.getHeight(); // TODO Optimize with field access?
final int tileCount = pTiledSprite.getTileCount();
int bufferDataOffset = 0;
for (int i = 0; i < tileCount; i++) {
bufferData.put(bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X, 0);
bufferData.put(bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y, 0);
bufferData.put(bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X, 0);
bufferData.put(bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y, height);
bufferData.put(bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X, width);
bufferData.put(bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y, 0);
bufferData.put(bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X, width);
bufferData.put(bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y, 0);
bufferData.put(bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X, 0);
bufferData.put(bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y, height);
bufferData.put(bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X, width);
bufferData.put(bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y, height);
bufferDataOffset += TiledSprite.TILEDSPRITE_SIZE;
}
this.setDirtyOnHardware();
}
示例13: onUpdateVertices
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
@Override
public void onUpdateVertices(final TiledSprite pTiledSprite) {
final float[] bufferData = this.mBufferData;
final float x = 0;
final float y = 0;
final float x2 = pTiledSprite.getWidth(); // TODO Optimize with field access?
final float y2 = pTiledSprite.getHeight(); // TODO Optimize with field access?
final int tileCount = pTiledSprite.getTileCount();
int bufferDataOffset = 0;
for(int i = 0; i < tileCount; i++) {
bufferData[bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x;
bufferData[bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y;
bufferData[bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x;
bufferData[bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y2;
bufferData[bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x2;
bufferData[bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y;
bufferData[bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x2;
bufferData[bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y;
bufferData[bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x;
bufferData[bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y2;
bufferData[bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x2;
bufferData[bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y2;
bufferDataOffset += TiledSprite.TILEDSPRITE_SIZE;
}
this.setDirtyOnHardware();
}
示例14: onUpdateVertices
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
@Override
public void onUpdateVertices(final TiledSprite pTiledSprite) {
final FloatBuffer bufferData = this.mFloatBuffer;
final float x = 0;
final float y = 0;
final float x2 = pTiledSprite.getWidth(); // TODO Optimize with field access?
final float y2 = pTiledSprite.getHeight(); // TODO Optimize with field access?
final int tileCount = pTiledSprite.getTileCount();
int bufferDataOffset = 0;
for(int i = 0; i < tileCount; i++) {
bufferData.put(bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X, x);
bufferData.put(bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y, y);
bufferData.put(bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X, x);
bufferData.put(bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y, y2);
bufferData.put(bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X, x2);
bufferData.put(bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y, y);
bufferData.put(bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X, x2);
bufferData.put(bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y, y);
bufferData.put(bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X, x);
bufferData.put(bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y, y2);
bufferData.put(bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X, x2);
bufferData.put(bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y, y2);
bufferDataOffset += TiledSprite.TILEDSPRITE_SIZE;
}
this.setDirtyOnHardware();
}
示例15: init
import org.andengine.entity.sprite.TiledSprite; //导入依赖的package包/类
@Override
public void init(SaveDataDto saveDataDto) {
Sprite backImg = getBaseScene().getResourceSprite(saveDataDto.getBackImgFilePath());
backImg.setSize(getBaseScene().getWindowWidth(), getBaseScene().getWindowHeight());
getBaseScene().attachChild(backImg);
// 会話内容取得
TalkLogic talkLogic = new TalkLogic();
List<PlayerTalkDto> talks = talkLogic.getTalkDtoList(getBaseScene(),
saveDataDto.getScenarioNo(),
saveDataDto.getSeqNo());
// 顔画像作成
SparseArray<TiledSprite> actorFaces = talkLogic.getTalkFaceSparse(getBaseScene(), talks);
// 会話レイヤー作成
TalkLayer talkLayer = new TalkLayer(getBaseScene());
talkLayer.initTalk(actorFaces, talks);
talkLayer.hide();
talkLayer.setZIndex(LayerZIndexType.TALK_LAYER.getValue());
talkLayer.setTag(CommonTag.TALK_LAYER_TAG.getValue());
getBaseScene().attachChild(talkLayer);
// まずは章開始カットイン
if (saveDataDto.getSeqNo().intValue() == 1) {
ScenarioStartCutInTouchLayer scenarioStartCutInTouchLayer =
new ScenarioStartCutInTouchLayer(getBaseScene(), saveDataDto);
getBaseScene().attachChild(scenarioStartCutInTouchLayer);
scenarioStartCutInTouchLayer.showTouchLayer();
} else {
talkLayer.nextTalk();
}
}