Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The upper side is cropped when the window is too big #1163

Closed
mortenson opened this issue May 21, 2020 · 7 comments
Closed

The upper side is cropped when the window is too big #1163

mortenson opened this issue May 21, 2020 · 7 comments

Comments

@mortenson
Copy link
Sponsor

mortenson commented May 21, 2020

I made an Ebiten game recently and decided that the normal resolution (800x600) was too small for the majority of users, so I decided to call ebiten.SetScreenScale(1.5) in the game loop to scale it up by default (https://github.com/mortenson/trianglovers/blob/master/main.go#L376).

Some Windows users have reported that the cursor is slightly offset by default, but when they enter full screen mode (by pressing "f"), or set the scale back to "1" (by pressing "s"), the cursor works as expected. I think this only happens when the scale makes the window larger than the computer's native resolution.

On my machine, I was able to replicate this by making the screen scale much higher (3). When that happened, the window looks like this:

Screenshot from 2020-05-21 07-56-16

You can see the "Normal mode" button hovering, but my cursor (not shown) is actually hovering over "Sam" below.

Any idea what's going on here?

@hajimehoshi
Copy link
Owner

Hi,

The issue is, when the window was bigger than the monitor screen, the rendering was shifted (the upper side was cropped) and cursor position seemed not to match with the screen. Is that correct?

@hajimehoshi
Copy link
Owner

I could not reproduce this on macOS. I'll try Windows or Linux later.

BTW, thank you for using Ebiten!

@hajimehoshi hajimehoshi added this to the v1.12.0 milestone May 21, 2020
@hajimehoshi
Copy link
Owner

Confirmed.

@mortenson
Copy link
Sponsor Author

Thank you for taking a look! I'm only able to replicate on Windows for what it's worth.

@hajimehoshi
Copy link
Owner

The issue is, when the window was bigger than the monitor screen, the rendering was shifted (the upper side was cropped) and cursor position seemed not to match with the screen. Is that correct?

@mortenson Is my understanding correct?

@hajimehoshi hajimehoshi changed the title Can SetScreenScale affect accurate cursor detection? The upper side is cropped when the window is too big May 22, 2020
@hajimehoshi
Copy link
Owner

You can use this fix by specifying the latest Ebiten (7b960a2df4e42cf58464fcad4cd4c4f5903ccb5d) at go.mod.

I don't plan to back-port this fix to 1.11 so far, but if you think this fix is urgent, I'm fine with back-porting. What do you think?

@mortenson
Copy link
Sponsor Author

Your understanding was correct. 👍

It's not urgent 😄 My game jam game is already submitted so I'm in no rush.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants