libtcod / python-tcod

A high-performance Python port of libtcod. Includes the libtcodpy module for backwards compatibility with older projects.
BSD 2-Clause "Simplified" License
410 stars 36 forks source link

Mouse.cx/cy wrong in fullscreen mode #85

Closed mgedmin closed 4 years ago

mgedmin commented 5 years ago

I'm following along the TCOD tutorial, and I noticed that mouse event coordinates are wrong in fullscreen mode.

In non-fullsceen mode, mouse.cx, mouse.cy range from (0, 0) to (79, 49), as expected, but as soon as I call tcod.console_set_fullscreen(True), mouse.cx, mouse.cy get values between (-56, -29) to (135, 78).

I'm on Ubuntu 19.04. I've pip installed tcod and got version 11.3.0. My screen is 1920x1080.

EDIT: I'm using a Wayland session, in case that matters.

HexDecimal commented 5 years ago

The old renderers try to switch to exclusive fullscreen mode which often causes all kinds of problems. Any chance you can post a screenshot of your monitor when in fullscreen mode?

Also check if the SDL2 renderer has these issues (add renderer=tcod.RENDERER_SDL2 to tcod.console_init_root.) That should have more consistent results across platforms.

mgedmin commented 5 years ago

Here's a screenshot of the fullscreen mode: Ekrano nuotrauka iš 2019-09-15 21-30-03

Adding renderer=tcod.RENDERER_SDL2 fixes the problem.

HexDecimal commented 5 years ago

Is that a screenshot of tcod.RENDERER_SDL or tcod.RENDERER_SDL2?

mgedmin commented 5 years ago

The screenshot was made without specifying a renderer, so whatever was the default?

Is there a way to check at runtime?

mgedmin commented 5 years ago

tcod.sys_get_renderer() returns 2 on my system if I don't set the renderer explicitly.

(Setting the renderer to SDL2 makes it return 3.)

HexDecimal commented 5 years ago

Thanks. The default renderer is currently SDL.

It will probably be a while before this is fixed, and the fix will likely be just changing the default renderer to SDL2.

HexDecimal commented 4 years ago

The old renderers have been removed, so this is no longer an issue.