Questions tagged «libgdx»

9
运行新的LibGDX项目时出现“找不到文件”
我尝试学习LibGDX,并在新的格式化的Mac OS X Maverick上安装了此处列出的所有软件以及新的Eclipse 4.3。 重启后一切顺利,我下载并执行gdx-setup.jar,填写表单,然后导入Eclipse。 当我尝试运行桌面时,没有错误,没有警告。(右键单击桌面项目,运行方式-> Java应用程序)。 我得到这个错误 Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: badlogic.jpg at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:140) at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare(FileTextureData.java:64) at com.badlogic.gdx.graphics.Texture.load(Texture.java:130) at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:121) at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:100) at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:92) at com.diesel.bugs.DieselBugs.create(DieselBugs.java:21) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114) Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: badlogic.jpg (Local) at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:134) at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:218) at …
115 java  libgdx 

7
libGDX中如何处理不同的宽高比?
我使用libGDX实现了一些屏幕,这些屏幕显然将使用ScreenlibGDX框架提供的类。但是,这些屏幕的实现仅适用于预定义的屏幕尺寸。例如,如果子图形用于640 x 480尺寸的屏幕(长宽比为4:3),则它在其他屏幕尺寸上将无法正常工作,因为子图形会与屏幕边界相称并且不会缩放到屏幕尺寸完全没有 而且,如果libGDX将提供简单的缩放比例,那么我所面临的问题仍然存在,因为这将导致游戏屏幕的宽高比发生变化。 在研究互联网之后,我遇到了讨论相同问题的博客/论坛。我已经实现了,到目前为止,它运行良好。但我想确认这是否是实现此目标的最佳选择,还是有更好的选择。下面的代码显示了我如何处理此合法问题。 论坛链接:http : //www.java-gaming.org/index.php? topic=25685.new public class SplashScreen implements Screen { // Aspect Ratio maintenance private static final int VIRTUAL_WIDTH = 640; private static final int VIRTUAL_HEIGHT = 480; private static final float ASPECT_RATIO = (float) VIRTUAL_WIDTH / (float) VIRTUAL_HEIGHT; private Camera camera; private Rectangle viewport; …

13
无法解决:IntelliJ Idea中带有gradle的com.google.android.gms:play-services
我正在尝试在IntelliJ Idea中将Google Play服务添加到我的libGDX项目中。我在这里遵循了安装指南:https : //developers.google.com/android/guides/setup 看起来很简单。我只是在相应部分的build.gradle中添加了这些行,所以现在看起来像: project(":android") { apply plugin: "android" apply plugin: 'com.android.application' configurations { natives } dependencies { compile project(":core") compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86" natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64" compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion" natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a" natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86" compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a" natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a" …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.