LibGDX Box2DLights throws error on render - java

I am trying to get a Box2D PointLight to render on the screen, but upon rendering, it throws an exception. I have revised the API and the Box2D User Manual, as well as watched videos on the topic, but have yet to find a solution to my problem. Here is my code and the error.
package com.mygdx.test;
import box2dLight.PointLight;
import box2dLight.RayHandler;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.World;
public class Test extends ApplicationAdapter {
/** the camera **/
OrthographicCamera camera;
RayHandler rayHandler;
World world;
#Override
public void create() {
camera = new OrthographicCamera(48, 32);
camera.update();
world = new World(new Vector2(0, -10), true);
rayHandler = new RayHandler(world);
new PointLight(rayHandler, 32);
}
#Override
public void render() {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
world.step(Gdx.graphics.getDeltaTime(), 8, 3);
rayHandler.setCombinedMatrix(camera.combined);
rayHandler.updateAndRender();
}
And the error:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoSuchMethodError: com.badlogic.gdx.graphics.glutils.FrameBuffer.getColorBufferTexture()Lcom/badlogic/gdx/graphics/Texture;
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:127)
Caused by: java.lang.NoSuchMethodError: com.badlogic.gdx.graphics.glutils.FrameBuffer.getColorBufferTexture()Lcom/badlogic/gdx/graphics/Texture;
at box2dLight.LightMap.gaussianBlur(LightMap.java:76)
at box2dLight.LightMap.render(LightMap.java:37)
at box2dLight.RayHandler.render(RayHandler.java:328)
at box2dLight.RayHandler.updateAndRender(RayHandler.java:262)
at com.mygdx.test.Test.render(Test.java:33)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:215)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)

I had the same issue with a newly generated libgdx project, however updating the box2dlights version from 1.3 to 1.4 solved this error for me.

Have you tried using this method?
new PointLight(rayHandler, RAYS_NUM, new Color(1,1,1,1), lightDistance, x, y);
I have also noticed, you should do
world.step();
at the end of the render() method. Probably wont fix the problem, but i just noticed

Related

Unable to find the right JVM options

Alright, first and foremost, I am new to Java, but not to programming.
For a personnal project I decided that I should use Slick2D, a graphics library in java, and I am running into one problem I haven't been able to fix for now.
Considering the following:
I use Netbeans
I'm currently on linux
From what I understand, slick2d uses lwgjl. I have followed the instructions on the following page:
Setting up Slick2D for netbeans
My problem I think is giving my JVM the right options.
Currently the ones I set are:
-Djava.library.path=/home/karel/Téléchargements/slick/native/unix
Here is the current error output I get:
run:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl64 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.lwjgl.Sys$1.run(Sys.java:72)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:87)
at org.lwjgl.Sys.<clinit>(Sys.java:117)
at org.lwjgl.opengl.Display.<clinit>(Display.java:135)
at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
at java.security.AccessController.doPrivileged(Native Method)
at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
at jcoinche.client.JcoincheClient.main(JcoincheClient.java:29)
/home/karel/.cache/netbeans/8.1/executor-snippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)
My code is as follow (well, the part that needs a library, and doesn't work - it's all tutorial material, by the way. Nothing I made myself):
package jcoinche.client;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.Scanner;
import static jcoinche.client.Game.gamename;
import static jcoinche.client.Game.xSize;
import static jcoinche.client.Game.ySize;
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.SlickException;
public class JcoincheClient
{
public static void main(String[] args)
{
Socket socket;
AppGameContainer appgc;
try
{
appgc = new AppGameContainer(new Game(gamename));
appgc.setDisplayMode(xSize, ySize, false);
appgc.setTargetFrameRate(60);
appgc.start();
}
catch(SlickException e)
{
e.printStackTrace();
}
}
Game.java:
package jcoinche.client;
import org.newdawn.slick.*;
import org.newdawn.slick.state.*;
public class Game extends StateBasedGame
{
public static final String gamename = "MyGameName";
public static final int play = 0;
public static final int xSize = 400;
public static final int ySize = 300;
public Game(String gamename){
super(gamename);
this.addState(new Play());
}
public void initStatesList(GameContainer gc) throws SlickException{
this.getState(play).init(gc, this);
this.enterState(play);
}
}
Play.java:
package jcoinche.client;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
public class Play extends BasicGameState
{
public Play()
{
}
public void init(GameContainer gc, StateBasedGame sbg)
throws SlickException
{
}
public void render(GameContainer gc, StateBasedGame sbg, Graphics g)
throws SlickException
{
}
public void update(GameContainer gc, StateBasedGame sbg, int delta)
throws SlickException
{
}
public int getID()
{
return 0;
}
}
The error is telling you of the absence of a file named 'lwjgl64'. You are getting an UnsatisfiedLinkError, which according to the Java Documentation, is:
Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native.
Now, are you using Slick2D alone? Or do you have LWJGL and Slick2D? Slick2D is not standalone; you need LWJGL to run it. I suggest getting LWJGL from their site, and add it's native folder to the classpath.
From the Slick2D docs, they write this:
-Djava.library.path=<lwjgl-X.X path>/native/<linux|macosx|solaris|windows>
Source
There are a few answers on stack that may help you solve this issue as it is clear from the error that it is caused by a linking error to LWJGL64. One post with a number of solutions here offers a number of solutions, though targeted at the eclipse IDE specifically the general solution applies:
To quote from here #Ben Jackson
LWJGL needs the native components for your particular platform to be
in java.library.path. These are in the subdirectory native in the
LWJGL distribution and end in .so on Linux, OSX and Solaris and .dll
for windows.
Other potential examples solving the error:
Setting up natives
Alright, this is a bit embarassing, but I understood what my problem was and it was a simple misunderstanding of the link I gave (instructions on how to install and use slick2D on netbeans):
In fact, my problem was that, because of the lwgjl.jar and other similar files in the slick2D folder, I thought lwgjl was, in the end, included in the slick folder.
As such, for the last step, I gave to my JVM a path directing it to the slick library folder, while it was, this time, asking for lwgjl files, causing the errors shown above.
I changed that path to the lwgjl/native/linux folder, and everything is now working perfectly.
Thanks for your answers, they helped greatly.

libgdx not initialized yet

I have been coding my libgdx application (for desktop only) for a while and after deciding to cleanup the code part by part iv'e gotten into a problem i cant seem to solve myself..
exception:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.UnsatisfiedLinkError: com.badlogic.gdx.physics.box2d.PolygonShape.newPolygonShape()J
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:131)
Caused by: java.lang.UnsatisfiedLinkError: com.badlogic.gdx.physics.box2d.PolygonShape.newPolygonShape()J
at com.badlogic.gdx.physics.box2d.PolygonShape.newPolygonShape(Native Method)
at com.badlogic.gdx.physics.box2d.PolygonShape.<init>(PolygonShape.java:29)
at com.mygdx.game.handler.BodyEditorLoader.<init>(BodyEditorLoader.java:41)
at com.mygdx.game.util.GameUtils.init(GameUtils.java:23)
at com.mygdx.game.DungeonLife.create(DungeonLife.java:168)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:147)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:124)
after googling for a while i figured my error is as mentioned in this thread
as in
Another problem might be that you instantiate a SpriteBatch (or something else which internally uses a SpriteBatch) too early (looked a bit like this in the stacktrace).
but as the answer mentions
Instead, create such things in the create/show methods of your game.
I cant seem to understand when libgdx is initialized and ready for use, and where to place my GameUtils.init() method to assure libgdx is initialized
My code is as follows: (i have taken out e-relevant methods)
Application Class
package com.mygdx.game;
import box2dLight.RayHandler;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.maps.MapProperties;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.*;
import com.mygdx.game.entity.MobEntity;
import com.mygdx.game.entity.PhysicalEntity;
import com.mygdx.game.entity.Player;
import com.mygdx.game.entity.Weapon;
import com.mygdx.game.handler.*;
import com.mygdx.game.util.CollisionConstants;
import com.mygdx.game.util.GameUtils;
import com.mygdx.game.util.TileObjectUtil;
import com.mygdx.game.util.WorldConstants;
import com.mygdx.game.valtype.WeaponDefinition;
public class DungeonLife extends ApplicationAdapter implements WorldConstants {
OrthographicCamera camera;
float width , height;
Texture texture;
TextureRegion[] enttex;
//TEMP
MobEntity demo;
Player thePlayer;
PlayerInputProcessor playerInputProcessor;
ScreenUI ui;
int mapWidth , mapHeight;
//========================================
GameMap gameMap;
//========================================
#Override
public void create () {
texture = new Texture("maps/img/tileset_entity.png");
enttex = new TextureRegion[(int) ((texture.getWidth()*texture.getHeight()) / (BLOCK*BLOCK))];
enttex[0] = new TextureRegion(texture , 0 , 0 , (int)BLOCK , (int)BLOCK);
enttex[1] = new TextureRegion(texture , (int)BLOCK , 0 , (int)BLOCK , (int)BLOCK);
width = Gdx.graphics.getWidth()/5;
height = Gdx.graphics.getHeight()/5;
camera = new OrthographicCamera(width,height);
camera.position.set(width / 2, height / 2, 0);
camera.update();
GameUtils.init(); // <------this guy
//init();
} ...
GameUtils
package com.mygdx.game.util;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.World;
import com.mygdx.game.entity.PhysicalEntity;
import com.mygdx.game.handler.*;
import java.util.PriorityQueue;
public class GameUtils {
public static void init(){
weapon_bodyEditorLoader = new BodyEditorLoader(Gdx.files.internal("textures/weapons/dungeonlife_weapons.json"));
resourceManager = new ResourceManager();
resourceManager.addRes("friendlyhealth" , new Texture("textures/ui/friendlyhealth.png"));
resourceManager.addRes("enemyhealth" , new Texture("textures/ui/enemyhealth.png"));
tmxMapLoader = new TmxMapLoader();
gameContactListender = new GameContactListender();
}
//GLOBAL
public static BodyEditorLoader weapon_bodyEditorLoader;
public static GameContactListender gameContactListender;
public static ResourceManager resourceManager;
public static TmxMapLoader tmxMapLoader;
//CURRENTS ============================
public static GameMap CURRENT_GAMEMAP;
}
Desktop launcher (the usual)
package com.mygdx.game.desktop;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.mygdx.game.DungeonLife;
import com.mygdx.game.util.GameUtils;
public class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.useGL30 = false;
config.width=640;
config.height=360;
DungeonLife dungeonLife = new DungeonLife();
new LwjglApplication(dungeonLife, config);
}
}
Help is much appriciated! :D
As I've already wrote in the other linked answer, make sure that your project is correctly set up. Box2D is an extension and needs its own native libraries to be able to run.
It seems that it's a specific problem with the Box2D natives which are not loaded yet. They are not loaded automatically when LibGDX is initializing, but you have to trigger that yourself (see wiki).
The code you've posted looks correct, but before you can use anything Box2D related, you have to call Box2D.init(). Alternatively, creating a World object does the same, but isn't the nicest way to do it.

Simple Jzy3d application gives runtime exception - No implemented exception

I attempted to do a hello world application on jzy3d plotting library. I took the example from the website and when I run it I got the following error:
Exception in thread "main" java.lang.RuntimeException: No implemented
exception
Can anyone tell me what this means?
Here is the code for your reference:
import org.jzy3d.chart.Chart;
import org.jzy3d.chart.ChartLauncher;
import org.jzy3d.colors.Color;
import org.jzy3d.colors.ColorMapper;
import org.jzy3d.colors.colormaps.ColorMapRainbow;
import org.jzy3d.maths.Range;
import org.jzy3d.plot3d.builder.Builder;
import org.jzy3d.plot3d.builder.Mapper;
import org.jzy3d.plot3d.builder.concrete.OrthonormalGrid;
import org.jzy3d.plot3d.primitives.Shape;
import org.jzy3d.plot3d.rendering.canvas.Quality;
public class HelloWorld {
public static void main(String[] args) {
// Define a function to plot
Mapper mapper = new Mapper() {
public double f(double x, double y) {
return 10 * Math.sin(x / 10) * Math.cos(y / 20) * x;
}
};
// Define range and precision for the function to plot
Range range = new Range(-150, 150);
int steps = 50;
// Create a surface drawing that function
Shape surface = Builder.buildOrthonormal(new OrthonormalGrid(range, steps, range, steps), mapper);
surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax(), new Color(1, 1, 1, .5f)));
surface.setFaceDisplayed(true);
surface.setWireframeDisplayed(false);
surface.setWireframeColor(Color.BLACK);
// Create a chart and add the surface
Chart chart = new Chart(Quality.Advanced);
chart.getScene().getGraph().add(surface);
ChartLauncher.openChart(chart);
}
}
Error:
Exception in thread "main" java.lang.RuntimeException: No implemented
exception at
org.jzy3d.chart.factories.ChartComponentFactory.newFrame(ChartComponentFactory.java:148)
at org.jzy3d.chart.ChartLauncher.frame(ChartLauncher.java:82) at
org.jzy3d.chart.ChartLauncher.openChart(ChartLauncher.java:39) at
org.jzy3d.chart.ChartLauncher.openChart(ChartLauncher.java:33) at
org.jzy3d.chart.ChartLauncher.openChart(ChartLauncher.java:17) at
helloworld.HelloWorld.main(HelloWorld.java:77)
maybe this is a bug of the library itself, I had the same issue using jzy3d 0.9.1. Waiting for a new release, I solved the problem switching to the previous version jzy3d 0.9 that you can download from http://jzy3d.org/download-0.9.php . That worked for me, I hope it will work for you as well.
Best Regards

Tiled game libGDX - couldn't load file (Exception in thread "LWJGL Application")

I am following a java tiled game tutorial using libGDX and I met the following errors :
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: gaming creation/herbe16.png
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:142)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:133)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:112)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:108)
at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:119)
at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:104)
at com.poussins.screens.Play.show(Play.java:35)
at com.badlogic.gdx.Game.setScreen(Game.java:62)
at com.poussins.Poussins.create(Poussins.java:11)
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: gaming creation/herbe16.png (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:133)
at com.badlogic.gdx.files.FileHandle.length(FileHandle.java:563)
at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:218)
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:137)
... 12 more
here is the code i'm using in the Play class :
package com.poussins.screens;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
public class Play implements Screen{
private TiledMap map;
private OrthogonalTiledMapRenderer renderer;
private OrthographicCamera camera;
#Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
renderer.setView(camera);
renderer.render();
}
#Override
public void resize(int width, int height) {
camera.viewportWidth = width;
camera.viewportHeight = height;
camera.update();
}
#Override
public void show() {
map = new TmxMapLoader().load("maps/map-Herbe-Goudron.tmx");
renderer = new OrthogonalTiledMapRenderer(map);
camera = new OrthographicCamera();
}
#Override
public void hide() {
dispose();
}
#Override
public void pause() {
// TODO Auto-generated method stub
}
#Override
public void resume() {
// TODO Auto-generated method stub
}
#Override
public void dispose() {
map.dispose();
renderer.dispose();
}
}
In order to put the .tmx map into the Eclipse project, I just made a Copy (from the folder where the .tmx map is) and a paste in the Eclipse project named "Poussins-Desktop / assets / maps". I used the same actions (copy paste) to give the .png tiles to the same Eclipse project named "Poussins-Desktop / assets / maps" (can see it in the screenshots).
In the code, I am not sure with this following line :
map = new TmxMapLoader().load("maps/map-Herbe-Goudron.tmx");
because I don't know if the path to the .tmx is good, but it seem to respect what was said in the tutorial ...
In fact, in the error, it is saying that the file herbe16.png cannot be loaded. but this file is a tile from the whole .tmx map.
I am working on UBUNTU 13.10 system, Eclipse 3.8.1
I hope someone will help me and I thank you in advance for paying attention to my problem.
Okay, I don't know if this will help you..
I was just declaring the path for my files not minding caps letters (I'm using windows7).
Now, when I tested the code as a java application on my desktop it was going smoothly but when I tried launching it on an emulator or an android device it would crash.
Turns out that the emulator and device both need the exact path with capital letters.
This may have already been solved or the OP may have given up on it, but I came across this error too on the same tutorial. I solved the issue in my case. It may be possible that the OP was using a .png of a different bit depth (as was in my case). The .png that caused the error was 64 bit depth (you can check by right clicking on the .png -> PROPERTIES -> DETAILS). Using a .png of a bit depth of 32 allowed the loading to work perfectly fine. I used photoshop to create my .png tileset, and when creating the new file, set it to 8 bit (next to the color mode).

GdxRuntimeException: File not found

I'm following this tutorial on libgdx and I've hit a bit of a snag. I just finished the 'loading the assets' section. When I tried to run it, instead of getting the rain sound and a pink background, like the tutorial claims, I get errors up the wazoo. Here's my Drop.java:
package com.badlogic.drop;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.Texture;
public class Drop implements ApplicationListener {
Texture dropImage;
Texture bucketImage;
Sound dropSound;
Music rainMusic;
#Override
public void create() {
// load the images for the droplet and the bucket, 64x64 pixels each
dropImage = new Texture(Gdx.files.internal("droplet.png"));
bucketImage = new Texture(Gdx.files.internal("bucket.png"));
// load the drop sound effect and the rain background "music"
dropSound = Gdx.audio.newSound(Gdx.files.internal("drop.wav"));
rainMusic = Gdx.audio.newMusic(Gdx.files.internal("rain.mp3"));
// start the playback of the background music immediately
rainMusic.setLooping(true);
rainMusic.play();
}
#Override
public void dispose() {
}
#Override
public void render() {
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
}
#Override
public void resize(int width, int height) {
}
#Override
public void pause() {
}
#Override
public void resume() {
}
}
and here are my errors. (Ones I think are important are bolded)
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: droplet.PNG
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: droplet.PNG
at com.badlogic.gdx.graphics.Pixmap.(Pixmap.java:140)
at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare(FileTextureData.java:64)
at com.badlogic.gdx.graphics.Texture.load(Texture.java:175)
at com.badlogic.gdx.graphics.Texture.create(Texture.java:159)
at com.badlogic.gdx.graphics.Texture.(Texture.java:133)
at com.badlogic.gdx.graphics.Texture.(Texture.java:122)
at com.badlogic.drop.Drop.create(Drop.java:21)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:127)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:110)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: droplet.PNG (Internal)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:127)
at com.badlogic.gdx.files.FileHandle.length(FileHandle.java:580)
at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:215)
at com.badlogic.gdx.graphics.Pixmap.(Pixmap.java:137)
... 8 more
The weird thing is, I have all of the pngs and music files in my assets/data folders. They're all there, but the code isn't seeing them. Any idea what's causing this?
when you are using
Gdx.files.internal <- This only gets you to the assets folder. You have to direct it into any sub-directories you are wanting files from also.
and your files are in assets/data use
Gdx.files.internal("data/droplet.png")
Be sure to change all your other references also to the correct location.

Categories