我想在我的游戏中添加一个按钮,该按钮将在Play商店中打开我的应用程序的URL.下面是我到目前为止所得到的,但当我点击率按钮时,它不会打开相应的URL.
我的费率代码是:
if(Gdx.input.justTouched()){
guiCam.unproject(touchPoint.set(Gdx.input.getX(),Gdx.input.getY(), 0));
if(OverlapTester.pointInRectangle(rateButtonBound, touchPoint.x, touchPoint.y)){
try {
Process p = Runtime.getRuntime().exec("cmd /c start https://play.google.com/store/apps/details?id=com.shagunstudios.racinggame");
}
catch (IOException e1) {
System.out.println(e1);
}
if(Settings.soundEnabled)
Assets.click_sound.play(1.0f);
return;
}
}
Run Code Online (Sandbox Code Playgroud) 当我使用这段代码时:
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
public class Main {
public static void main(String[] args) {
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.title = "MtxJungleGameMenu";
cfg.useGL20 = false;
cfg.width = 800;
cfg.height = 480;
new LwjglApplication(new MainStarter(), cfg);
}
}
Run Code Online (Sandbox Code Playgroud)
我得到这样的例外:
线程"LWJGL Application"中的异常com.badlogic.gdx.utils.GdxRuntimeException:com.badlogic.gdx.utils.GdxRuntimeException:视频驱动程序不支持OpenGL.
任何帮助?
我正在使用Libgdx制作赛车游戏.我想触摸屏幕的右半边以加快速度,同时在不移除先前的触摸点的情况下再次触摸屏幕左侧的另一个触发点.我无法检测到以后的触摸点.
我已经搜索并获取Gdx.input.isTouched(int index)方法,但无法确定如何使用它.我的屏幕触摸代码是:
if(Gdx.input.isTouched(0) && world.heroCar.state != HeroCar.HERO_STATE_HIT){
guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));
if (OverlapTester.pointInRectangle(rightScreenBounds, touchPoint.x, touchPoint.y)) {
world.heroCar.state = HeroCar.HERO_STATE_FASTRUN;
world.heroCar.velocity.y = HeroCar.HERO_STATE_FASTRUN_VELOCITY;
}
} else {
world.heroCar.velocity.y = HeroCar.HERO_RUN_VELOCITY;
}
if (Gdx.input.isTouched(1)) {
guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));
if (OverlapTester.pointInRectangle(leftScreenBounds, touchPoint.x, touchPoint.y)) {
world.shot();
}
}
Run Code Online (Sandbox Code Playgroud) 我在Libgdx制作赛车游戏.我的游戏apk大小是9.92 mb,我使用的是四个纹理包装,总大小是9.92 Mb.我的游戏在桌面上运行,但它在Android设备上运行速度非常慢.它背后的原因是什么?
我正在用libgdx做一个游戏.我使用AssetManager类来加载资产.当我开始我的游戏时,它需要更多的时间在Android设备上加载资源并在那时显示黑屏.我如何解决这个问题.