简体   繁体   English

错误:包 com.badlogic.gdx.backends.lwjgl 不存在

[英]error: package com.badlogic.gdx.backends.lwjgl does not exist

i trying to get display dimensions with using LwjglApplicationConfiguration.getDesktopDisplayMode();我尝试使用LwjglApplicationConfiguration.getDesktopDisplayMode();获取显示尺寸LwjglApplicationConfiguration.getDesktopDisplayMode(); method.方法。 I can use it from DesktopLauncher, but i need use in a class named MainMenuScreen, which extends ApplicationAdapter.我可以从 DesktopLauncher 使用它,但我需要在名为 MainMenuScreen 的类中使用它,它扩展了 ApplicationAdapter。 I imported com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;我导入了com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; , but i still get same error. ,但我仍然遇到同样的错误。

I put project structure from here, if it helps.如果有帮助,我将项目结构放在此处。

在此处输入图片说明

I still have no way to import LwjglApplicationConfiguration package to MainMenuScreen, but i solved the why i need LwjglApplcationConfiguration package, i need it for scale textures by screen width and height in MainMenuScreen i can only get these informations from LwjglApplcationConfiguration package.我仍然无法将 LwjglApplicationConfiguration 包导入 MainMenuScreen,但我解决了为什么我需要 LwjglApplcationConfiguration 包的原因,我需要它在 MainMenuScreen 中按屏幕宽度和高度缩放纹理我只能从 LwjglApplcationConfiguration 包中获取这些信息。 In the DesktopLauncher, we have this code for show MainMenuScreen.在 DesktopLauncher 中,我们有这个用于显示 MainMenuScreen 的代码。

new LwjglApplication(new MainMenuScreen(), config);

Then i wrote a simple constructor to MainMenuScreen as:然后我向 MainMenuScreen 写了一个简单的构造函数:

public class MainMenuScreen extends ApplicationAdapter
{
  //some methods and attributes in here.
  private float ScreenHeight;
  private float ScreenWidth;

 public MainMenuScreen(float height, float width)
 {
    ScreenHeight = height;
    ScreenWidth = width;
    System.out.println("I got the datas! Height:" + ScreenHeight + ", width: " + ScreenWidth);
 }
}

Of course, i should have change the MainMenuScreen() calling in LwjglApplication() at the begining as:当然,我应该在开始时将 LwjglApplication() 中的 MainMenuScreen() 调用更改为:

new LwjglApplication(new MainMenuScreen(config.height, config.width), config);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “错误:(3,24)java:包com.badlogic.gdx不存在”,如何解决此问题? - “Error:(3, 24) java: package com.badlogic.gdx does not exist”, How to fix this? gdx-pay: &quot;包 com.badlogic.gdx.pay 不存在&quot; - gdx-pay: "package com.badlogic.gdx.pay does not exist" java.lang.UnsatisfiedLinkError:找不到本机方法:com.badlogic.gdx.backends.android.AndroidGL20.glGenTexture :() - java.lang.UnsatisfiedLinkError: Native method not found: com.badlogic.gdx.backends.android.AndroidGL20.glGenTexture:() NoClassDefFoundError:com / badlogic / gdx / LifecycleListener - NoClassDefFoundError: com/badlogic/gdx/LifecycleListener 线程“LWJGL 应用程序”中的异常 com.badlogic.gdx.utils.GdxRuntimeException: java.lang.ExceptionInInitializerError - Exception in thread “LWJGL Application” com.badlogic.gdx.utils.GdxRuntimeException: java.lang.ExceptionInInitializerError 线程“LWJGL 应用程序”中的异常 com.badlogic.gdx.utils.GdxRuntimeException:无法加载文件:mario.png - Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: mario.png com.badlogic.gdx.utils.GdxRuntimeException:无法加载文件:-错误 - com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: - Error libGDX GWT编译错误似乎与com.badlogic.gdx.utils.AtomicQueue有关<T> - libGDX GWT compile error that appears to be related to com.badlogic.gdx.utils.AtomicQueue<T> LIBGDX Getting this error com.badlogic.gdx.utils.SerializationException: Error reading file: ui/uiskin.json ON ANDROID ONLY - LIBGDX Getting this error com.badlogic.gdx.utils.SerializationException: Error reading file: ui/uiskin.json ON ANDROID ONLY 为什么“没有com.badlogic.gdx.scenes.scene2d.ui.ScrollPane $ ScrollPaneStyle注册名称:默认”错误即将到来以及如何解决? - Why “No com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle registered with name: default” error is coming and how to fix it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM