Flappy
Flappy copied to clipboard
I get an error when I try to flap
Exception in thread "Game" org.lwjgl.system.libffi.ClosureError: Callback failed because the closure instance has been garbage collected. at org.lwjgl.glfw.GLFW.glfwPollEvents(Native Method) at com.example.kieran.SpaceHopper2.Main.update(Main.java:113) at com.example.kieran.SpaceHopper2.Main.run(Main.java:92) at java.lang.Thread.run(Unknown Source)
It's because the Input class with the glfw callback needs to be stored somewhere so it doesn't get garbage collected, you should create a property with type Input in the Main class, instanciate it, and assign it to the callback. That way, the instance of Input will be stored on memory and won't be collected by the gc
@ochi12 is right. Do something like
private Input input = new Input();
And then use it in the glfwSetKeyCallback
:
glfwSetKeyCallback(window, input);
This should fix the problem
Muchas gracias me sirvió de mucha ayuda!!!
I'm getting an issue. I had some problems with his tutorial as a lot of things are updated. So I decided to download the full code and update what I could. I've done so and now the game starts. But no pipes are loaded and there's an error:
Could not find uniform variable 'ml_matrix'! 1281 Could not find uniform variable 'top'!
Being printed out over and over again.