Raylib-J icon indicating copy to clipboard operation
Raylib-J copied to clipboard

rlj.core.GetMouseWheelMove() throws NullPointerException

Open bramtechs opened this issue 1 year ago • 0 comments

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):

  • OS: Windows 10

bramtechs avatar Sep 28 '24 17:09 bramtechs