这是indexloc提供的服务,不要输入任何密码
Skip to content

[rcore] On retina display (HighDPI), screen size is not reported as expected #5059

@objarni

Description

@objarni
  • 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

Issue description

Starting my work-in-progress zig+raylib (built from source) game on a Mac M1 builtin display causes window size to differ from framebuffer size (rather, the framebuffer is not the same size as window as expected). This makes the 2D graphics end up off-center of the window/screen.

Note: starting the game on an external monitor works - text is centered. I have googled and read some, and think this may be related to glfw/retina 'weirdness'.

Environment

Platform: Macbook Air M1
O/S: macOS Sequoia V15.5
OpenGL version:
INFO: GL: OpenGL device information:
INFO: > Vendor: Apple
INFO: > Renderer: Apple M1
INFO: > Version: 4.1 Metal - 89.4
INFO: > GLSL: 4.10

Issue Screenshot

The text here is supposed to be centered

Image

Code Example

Just clone the repo and write "zig build run" to try it out? It will download the raylib commit specified in build.zig.zon (basically latest as of writing this), and build raylib.

https://github.com/objarni/DogFight2025

It is built with zig 0.14.1 which is available in brew via "brew install zig".

The window initialisation is in src/dogfight2025.zig.

Of course I can provide you with a minimal version to prove this, I just think this is easier for all of us! Please tell me if I'm wrong...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions