Back to project page ssniper-andengine.
The source code is released under:
Apache License
If you think the Android project ssniper-andengine listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.cladophora.ssniper.scene; // w w w. ja v a2 s . co m import com.cladophora.ssniper.BaseActivity; import com.cladophora.ssniper.R; import org.andengine.entity.scene.IOnSceneTouchListener; import org.andengine.entity.scene.Scene; import org.andengine.entity.scene.background.Background; import org.andengine.entity.text.Text; import org.andengine.input.touch.TouchEvent; import org.andengine.util.color.Color; public class InstructionScene extends Scene implements IOnSceneTouchListener { BaseActivity activity; public InstructionScene() { setBackground(new Background(Color.WHITE)); activity = BaseActivity.getSharedInstance(); String instructions = activity.getString(R.string.instructionstext0) + "\n" + activity.getString(R.string.instructionstext1) + "\n" + activity.getString(R.string.instructionstext2); final Text instructionText = new Text(0, 0, BaseActivity.mNotoSansFont, instructions, activity.getVertexBufferObjectManager()); instructionText.setColor(Color.BLACK); if (instructionText.getWidth() > BaseActivity.CAMERA_WIDTH) { final float oversizeRatio = instructionText.getWidth()/BaseActivity.CAMERA_WIDTH; instructionText.setScaleCenter(0,0); instructionText.setScale(1.0f / (oversizeRatio * 1.1f)); } final float x0 = (BaseActivity.CAMERA_WIDTH / 2) - (instructionText.getWidthScaled() / 2); final float y0 = (BaseActivity.CAMERA_HEIGHT / 2) - (instructionText.getHeightScaled() / 2); instructionText.setPosition(x0, y0); instructionText.detachSelf(); attachChild(instructionText); setOnSceneTouchListener(this); } @Override public boolean onSceneTouchEvent(Scene arg0, TouchEvent arg1) { arg0.setChildScene(new WeaponInfoScene()); return false; } }