-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Please, before submitting a new issue verify and check:
- I tested it on latest raylib version from master branch
- I checked there is no similar issue already reported
- I checked the documentation on the wiki
- My code has no errors or misuse of raylib
Background
In May I posted a bug on another Issue #4908 (comment) but the OP doesn't own a Mac so couldn't repro the bug #4908 (comment)
Issue description
👋🏼 I updated Raylib back in May and my game doesn't work anymore.
Steps to reproduce:
git clone --recurse-submodules git@github.com:vegerot/snek.git
git switch --detach 0159ab6ce084e189baf8f91abe3f39ec58ec5a08
git submodule update --init
zig build play
- Take a break and play the game for a bit. It's fun!
This should work!

Now
cd raylib && git switch -d 5c954c1f
(this is the next commit!)zig build play
Expected: Should also work
Actual: it looks wrong. It's super zoomed in

I found two workarounds:
- Resize the window. If you resize the window, the game will fix itself and look correct
- In
snek.zig:682
, setraylib.FLAG_WINDOW_HIGHDPI
. This makes the first frame look right but breaks the scale when resizing!
My issue was introduced in 5c954c1 which seems related...
I tried setting HIGHDPI
but now I have the opposite problem! The game size is correct at first, but when resizing the window the game gets shrunk to exactly quarter the size of the window.
Steps to reproduce:
- Buy a Mac and set up developer tools
$ git clone --recurse-submodules ssh://git@github.com/vegerot/snek.git
$ git switch --detach 1697cf603654745ecc6ea21bf25f6aa20d732254
$ git submodule update
$ zig build play
-
Note that the game looks great.
2.5. Take a break and play the game for a bit. It's a lot of fun! -
Just slightly change the size of the window
-
Note that the game is now a quarter of the size.
I'm assuming my bug must either be in https://github.com/vegerot/snek/blob/0d8d298bc79a2ab5de6a7a76be4482c6d0abd362/snek.zig#L684 or https://github.com/vegerot/snek/blob/0d8d298bc79a2ab5de6a7a76be4482c6d0abd362/snek.zig#L533 but I don't know what the bug is.
What does this mean?
Fundamentally, you should be drawing things according to the window size and not the render size
Sorry, I don't know what that means. Does it mean I'm doing something more fundamentally wrong with how I calculate the options.gameSize
?
I think this is a bug in Raylib. Can you confirm? The regression in my game is either from 4bed374 or 5c954c1
NOTE: Also, I reverted the raylib upgrade after getting the bug reports, so make sure to checkout vegerot/snek@1697cf6 (and run git submodule update --init
) before reproducing 🙂
Environment
macOS 15.7, M3