小编Vis*_*ngh的帖子

在libgdx游戏中添加"评价我的应用程序"按钮

我想在我的游戏中添加一个按钮,该按钮将在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)

android libgdx

14
推荐指数
1
解决办法
7769
查看次数

视频驱动程序不支持OpenGL

当我使用这段代码时:

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.

任何帮助?

java libgdx

8
推荐指数
2
解决办法
9790
查看次数

如何在Libgdx中跟踪多个触摸事件?

我正在使用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)

java multi-touch libgdx

7
推荐指数
1
解决办法
1万
查看次数

为什么游戏在libgdx中运行缓慢?

我在Libgdx制作赛车游戏.我的游戏apk大小是9.92 mb,我使用的是四个纹理包装,总大小是9.92 Mb.我的游戏在桌面上运行,但它在Android设备上运行速度非常慢.它背后的原因是什么?

libgdx

3
推荐指数
2
解决办法
1万
查看次数

如何减少libgdx中所有资产的加载时间

我正在用libgdx做一个游戏.我使用AssetManager类来加载资产.当我开始我的游戏时,它需要更多的时间在Android设备上加载资源并在那时显示黑屏.我如何解决这个问题.

libgdx

1
推荐指数
1
解决办法
1669
查看次数

标签 统计

libgdx ×5

java ×2

android ×1

multi-touch ×1