我试图通过将主菜单按钮设置为相同的大小来使用户界面更具吸引力。
所以“播放”按钮比“退出”按钮大一点,我尝试过:
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/myfont.ttf"));
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.size = 22;
mButtonSpacefont = generator.generateFont(parameter);
generator.dispose();
// Table for Buttons
Table table=new Table();
table.setSize(800, 480);
// Button Skin
Skin skin = new Skin();
TextureAtlas buttonAtlas = new TextureAtlas(Gdx.files.internal("gfx/buttons.pack"));
skin.addRegions(buttonAtlas);
// BUTTON PLAY
TextButtonStyle textButtonStyle = new TextButtonStyle();
textButtonStyle.font = mButtonSpacefont;
textButtonStyle.up = skin.getDrawable("button_top");
textButtonStyle.down = skin.getDrawable("button_bottom");
final TextButton buttonPlay = new TextButton("Play", textButtonStyle);
table.add(buttonPlay);
table.row();
// BUTTON QUIT
final TextButton buttonQuit = new TextButton("Quit", textButtonStyle);
buttonQuit.setWidth(buttonPlay.getWidth());// make …
Run Code Online (Sandbox Code Playgroud) 我最近libGDX
使用创建了一个项目vis-runtime version 0.3.4
。由于构建时间较长且需要单独的runtime-gwt 项目,GWT 支持在 vis-runtime 的 0.3.3 版本中被删除。
也许 TeaVM 可以用作 Web 后端,所以我正在寻找 TeaVM 与 vis-runtime 库的集成?
看一下这个项目(libgdx 与 teaVM 的集成),它使用 Maven 作为构建系统而不是 Gradle。
任何帮助将不胜感激。
我不知道为什么,但我的 libgdx 对两层不透明。你可能会在设计师和我的游戏中看到。这些草被添加到不同的图层中。在设计器中它是透明的,而在我的游戏中它在那里显示灰色部分。为什么?:-/
我已经在 create() 中添加了这个
TiledMap map = new TmxMapLoader().load("stage.tmx");
OrthoCachedTiledMapRenderer maprender = new OrthoCachedTiledMapRenderer(map);
Run Code Online (Sandbox Code Playgroud)
这在 render() 中
maprender.render();
Run Code Online (Sandbox Code Playgroud) 抱歉我的问题,我知道这是一个愚蠢的问题。我想开始游戏开发,我应该从哪里开始?我应该从 libGDX、Love2D 还是 Monogame 开始。我知道如何使用这种语言(JAVA、LUA 和 C#)进行编程。我只是想从那些比我更有经验的人那里获得意见。请帮助我。谢谢
可能只对libGDX技能负责.
MyGame.java:
public void create() { // gets called after constructor
Resources.setInstance(new Resources());
}
Run Code Online (Sandbox Code Playgroud)
Resources.java
public static void setInstance(Resources res) {
if (instance != null) {
instance = res;
}
else throw new IllegalStateException(
"instance cant be null");
}
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪:
Exception in thread "LWJGL Application" java.lang.IllegalStateException: instance cant be null
at com.mutant.td.Resources.setInstance(Resources.java:22)
at com.mutant.td.SpeciesWarGame.create(SpeciesWarGame.java:41)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:143)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Run Code Online (Sandbox Code Playgroud)
我真的不知道发生了什么.
我开始使用libGDX,我想在我的游戏中使用AdMob.
如果有人已经参与其中,请给我一些方法让这件事在游戏中发生?
我无缘无故地收到 NullPointerException 异常。请不要将我重定向到另一个帖子。我都看过了。我正在用 LibGDX 制作游戏。
这是错误
Exception in thread "LWJGL Application" java.lang.NullPointerException
at net.hasanbilal.pr.entities.Entity.getWeight(Entity.java:88)
at net.hasanbilal.pr.entities.Entity.update(Entity.java:25)
at net.hasanbilal.pr.entities.Porter.update(Porter.java:34)
at net.hasanbilal.pr.world.GMap.update(GMap.java:28)
at net.hasanbilal.pr.world.TiledGMap.update(TiledGMap.java:40)
at net.hasanbilal.pr.PrisonRevelations.render(PrisonRevelations.java:59)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:215)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Run Code Online (Sandbox Code Playgroud)
我将向每个班级展示错误点。
这是实体类。
package net.hasanbilal.pr.entities;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector2;
import net.hasanbilal.pr.world.GMap;
public abstract class Entity {
protected Vector2 pos;
protected EntityType t;
protected float velocityY = 0;
protected GMap m;
protected boolean grounded = false;
public void create (EntitySnapshot snapshot, EntityType type, GMap map) {
this.pos = new Vector2(snapshot.getX(),snapshot.getY());
this.t = t;
this.m …
Run Code Online (Sandbox Code Playgroud) libgdx ×7
java ×3
android ×1
game-engine ×1
gwt ×1
love2d ×1
monogame ×1
teavm ×1
vis-runtime ×1