0

I'm writing a libGDX application, using the Lwjgl3Launcher. Everything works nicely, there's just one problem:

I'm trying to create a borderless fullscreen window like this:

    fun main(args: Array<String>) {
        val displayMode = Lwjgl3ApplicationConfiguration.getDisplayMode()
        Lwjgl3Application(Orbitrucker("assets/native", displayMode), Lwjgl3ApplicationConfiguration().apply {
            setTitle("Orbitrucker")
            // TODO: There's mouse cursor offset when a borderless window has screen size!
            setWindowedMode(1920, 1080)
            setResizable(false)
            setDecorated(false)
            setAutoIconify(true)

        })
    }

Where the screen resolution is actually 1920x1080, everything looks fine. I.e. I get my application on the entire screen, with nothing else there (taskbar not visible). However, the mouse behaves as though the taskbar was still visible, and the window was sitting on top of it. I.e. all the mouse Y coordinates are offset by the height of the Taskbar.

Surprisingly, I'm not really finding any information about this issue when googling, though I can't possibly be the first running into this. Maybe the solution is so simple it's not worth mentioning, but I haven't found it yet.

If the resolution is smaller than the entire screen, the mouse position is fine. If I don't set decorated to false, the position is fine (but then the taskbar is visible, so that's not what I want). With decorated set to false it all looks just like I want it, but apparently for the purpose of the mouse the taskbar is still there...

UncleBob
  • 1,233
  • 3
  • 15
  • 33

1 Answers1

0

Try setWindowedMode(1920, 1080) at the very end. Or specifically after setDecorated(false)

https://github.com/libgdx/libgdx/issues/6646

londonBadger
  • 611
  • 2
  • 5
  • 5
  • No, unfortunately that doesn't change the behaviour. – UncleBob Jun 21 '23 at 18:54
  • are you doing this mouseInWorld3D.x = Gdx.input.getX(); mouseInWorld3D.y = Gdx.input.getY(); cam.unproject(mouseInWorld3D); you need to unproject (btw I would still do setDecorated first) – londonBadger Jun 22 '23 at 10:18
  • Uhm, no, I don't think I'm doing that. Where exactly would I need to do that? – UncleBob Jun 23 '23 at 21:49
  • have a look here you need access to the camera even if its a 2d scene https://stackoverflow.com/questions/16381031/get-cursor-position-in-libgdx (btw are you the real Uncle Bob ?) – londonBadger Jun 23 '23 at 22:52