严重: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.NullPointerException: Cannot invoke "com.jme3.cursors.plugins.CursorLoader.load(com.jme3.asset.AssetInfo)" because "this.cursorLoader" is null
at RTSCamera.mouse.mouseCur.initialize(mouseCur.java:44)
at com.jme3.app.state.BaseAppState.initialize(BaseAppState.java:129)
at com.jme3.app.state.AppStateManager.initializePending(AppStateManager.java:332)
at com.jme3.app.state.AppStateManager.update(AppStateManager.java:362)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:258)
at com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:628)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:717)
at java.base/java.lang.Thread.run(Thread.java:833)
I don’t think there’s anything wrong with my file path.
I read the above link to understand how jme loads these files, and I’m pretty sure I’m missing something, but I don’t really know what I’m doing wrong right now.
I’ve changed the code a bit but there’s still something wrong with it.
严重: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.nio.BufferOverflowException
at java.base/java.nio.IntBuffer.put(IntBuffer.java:1007)
at com.jme3.cursors.plugins.CursorLoader$CursorImageData.<init>(CursorLoader.java:639)
at com.jme3.cursors.plugins.CursorLoader.loadCursor(CursorLoader.java:228)
at com.jme3.cursors.plugins.CursorLoader.load(CursorLoader.java:90)
at com.jme3.cursors.plugins.CursorLoader.load(CursorLoader.java:56)
at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:272)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:388)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:402)
at RTSCamera.mouse.mouseCur.initialize(mouseCur.java:43)
at com.jme3.app.state.BaseAppState.initialize(BaseAppState.java:129)
at com.jme3.app.state.AppStateManager.initializePending(AppStateManager.java:332)
at com.jme3.app.state.AppStateManager.update(AppStateManager.java:362)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:258)
at com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:628)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:717)
at java.base/java.lang.Thread.run(Thread.java:833)
/**
* Sets the cursor's image(s) data. Each image data should be consecutively
* stored in the {@link IntBuffer} if more tha one image is contained in the
* cursor.
* @param imagesData the cursor's image(s) data. Each image data should be consecutively
* stored in the {@link IntBuffer} if more than one image is contained in the
* cursor.
*/
public void setImagesData(IntBuffer imagesData) {
this.imagesData = imagesData;
}
I still don’t particularly understand this part, do I need to convert the PNG image to Intbuffer first ?