-1
\$\begingroup\$

I'm making a game in java/libgdx. when I run the code in the desktop launcher it gives me a bunch of errors. All the errors are from the badlogic default package.

My code:

package com.wyvern.paperplane.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.wyvern.paperplane.PaperPlane;

public class DesktopLauncher {
    public static void main (String[] args) {
      LwjglApplicationConfiguration cfg = new       
      LwjglApplicationConfiguration();
      cfg.title = "my game";
      cfg.useGL30 = true;
      cfg.width = 720;
      cfg.height = 1280;
      new LwjglApplication(new PaperPlane(), cfg);
    } 
}

I don't understand why it gives me all the default badlogic errors when I only use my own package.

Here are some of the errors, note that i don't use any of the com.badlogic:

at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:92)

at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:88)

at com.wyvern.paperplane.PaperPlane.create(PaperPlane.java:16)

at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:143)

at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: badlogic.jpg (Internal)

at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136)

at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:222)

at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:137)
\$\endgroup\$
5
  • \$\begingroup\$ File not found: badlogic.jpg says a lot I think \$\endgroup\$
    – dimitris93
    Commented Aug 13, 2015 at 0:06
  • \$\begingroup\$ problem is: i dont want to use that. it shouldn't even be there \$\endgroup\$
    – 2hTu2
    Commented Aug 13, 2015 at 0:16
  • \$\begingroup\$ You are trying to load it in your code, this is why you get this error. \$\endgroup\$
    – dimitris93
    Commented Aug 13, 2015 at 0:40
  • \$\begingroup\$ But I don't want to load it in my code, and I can't find where it loads in the code \$\endgroup\$
    – 2hTu2
    Commented Aug 13, 2015 at 0:42
  • \$\begingroup\$ Inside new PaperPlane() \$\endgroup\$
    – dimitris93
    Commented Aug 13, 2015 at 1:21

2 Answers 2

-1
\$\begingroup\$

Please go through this tutorial, published by libgdx,

https://github.com/libgdx/libgdx/wiki/A-simple-game

In above tutorial, in "Loading the assets" section, you can change/remove the image (badlogic's by default image) as per your requirement.

\$\endgroup\$
0
\$\begingroup\$

You need to to point your working directory to the assets folder.

Snippet from https://github.com/libgdx/libgdx/wiki/Manual-project-setup

The Android project has a subfolder named assets, which is created automatically. Files available to the Android application must be placed here. This is problematic, because these same files must be available to the desktop application. Rather than maintain two copies of all the files, the desktop project should be configured to find the assets in the Android project:

In the Properties for the core project: click the Source tab, click Link Source, Browse, select the "assets" folder from your Android project and click OK. Specify "assets" for the folder name and click Finish then OK. Note: If your desktop and Android projects are in the same parent folder, you can use "PARENT-1-PROJECT_LOC/gamename-android/assets" for the location of the linked assets folder, where "gamename-android" is the name of your Android project. This is better than a hard-coded path if you plan on sharing your projects with others.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged .