CreedVI / Raylib-J

Handmade Java binding for Raylib
zlib License
97 stars 16 forks source link

rlj.core.GetMouseWheelMove() throws NullPointerException #70

Open bramtechs opened 2 months ago

bramtechs commented 2 months ago

Describe the bug Calling GetMouseWheelMove() throws a NullPointerException

To Reproduce Steps to reproduce the behavior:

  1. Run example code (on Windows 10)
  2. See error
    Exception in thread "main" java.lang.NullPointerException: Cannot read field "x" because "this.input.mouse.currentWheelMove" is null
    at com.raylib.java.core.rCore.GetMouseWheelMove(rCore.java:2316)
    at org.example.BasicWindow.main(BasicWindow.java:19)

Expected behavior Mouse wheel value should be returned.

Code

public class BasicWindow {
    public static void main(String[] args) {

        final int SCREEN_WIDTH = 800;
        final int SCREEN_HEIGHT = 450;
        Raylib rlj = new Raylib();
        rlj.core.InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "Raylib-J [core] example -- basic window");
        rlj.core.SetTargetFPS(60);

        while (!rlj.core.WindowShouldClose()) {
            rlj.core.BeginDrawing();
            rlj.core.ClearBackground(Color.RAYWHITE);

            float move = rlj.core.GetMouseWheelMove();
            rlj.text.DrawText("mouse wheel move: %f".formatted(move), 190, 200, 20, Color.LIGHTGRAY);

            rlj.core.EndDrawing();
        }
    }
}

Desktop (please complete the following information):