import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.input.GestureDetector.GestureListener;
import com.badlogic.gdx.math.FloatCounter;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.PerformanceCounter;
import com.badlogic.gdx.utils.SharedLibraryLoader;
/** @author xoppa */
public class BulletTest implements ApplicationListener, InputProcessor, GestureListener {
// 首先说运行速度,或者说是执行速度,
// 在这方面运行速度快慢为:StringBuilder > StringBuffer > String
// 在线程安全上,StringBuilder是线程不安全的,而StringBuffer是线程安全的
// String:适用于少量的字符串操作的情况
// StringBuilder:适用于单线程下在字符缓冲区进行大量操作的情况
// StringBuffer:适用多线程下在字符缓冲区进行大量操作的情况
public StringBuilder performance = new StringBuilder();
public String instructions = "Tap to shoot\nLong press to toggle debug mode\nSwipe for next test\nCtrl+drag to rotate\nScroll to zoom";
/**
* The PerformanceCounter keeps track of the time and load (percentage of total time) a
* specific task takes. Call start() just before starting the task and stop() right after.
* You can do this multiple times if required. Every render or update call tick() to update
* the values. The time FloatCounter provides access to the minimum, maximum, average,
* total and current time the task takes. Likewise for the load value,
* which is the percentage of the total time.
*
* 还是得看源码啊。。。
*/
public PerformanceCounter performanceCounter = new PerformanceCounter(this.getClass().getSimpleName());
public FloatCounter fpsCounter = new FloatCounter(5);//FloatCounter(5)意思是五个数为一组,然后取其中的平均值?
public PerspectiveCamera camera;
@Override
public boolean keyDown (int keycode) {
return false;
}
@Override
public boolean keyTyped (char character) {
return false;
}
@Override
public boolean keyUp (int keycode) {
return false;
}
@Override
public boolean touchDown (int screenX, int screenY, int pointer, int button) {
return false;
}
@Override
public boolean touchUp (int screenX, int screenY, int pointer, int button) {
return false;
}
@Override
public boolean touchDragged (int screenX, int screenY, int pointer) {
return false;
}
@Override
public boolean mouseMoved (int screenX, int screenY) {
return false;
}
@Override
public boolean scrolled (int amount) {
return false;
}
@Override
public void create () {
}
@Override
public void resize (int width, int height) {
}
@Override
public void render () {
}
@Override
public void pause () {
}
@Override
public void resume () {
}
@Override
public void dispose () {
}
@Override
public boolean touchDown (float x, float y, int pointer, int button) {
return false;
}
@Override
public boolean tap (float x, float y, int count, int button) {
return false;
}
@Override
public boolean longPress (float x, float y) {
return false;
}
@Override
public boolean fling (float velocityX, float velocityY, int button) {
return false;
}
@Override
public boolean pan (float x, float y, float deltaX, float deltaY) {
return false;
}
@Override
public boolean panStop (float x, float y, int pointer, int button) {
return false;
}
@Override
public boolean zoom (float initialDistance, float distance) {
return false;
}
@Override
public boolean pinch (Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2) {
return false;
}
@Override
public void pinchStop () {
}
}
[LIBGDX学习]LibGDX代码详解(二十七)Bullet
最新推荐文章于 2021-03-16 23:15:37 发布