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

ebiten: add a new API to return the logical screen size (= the result of Layout) #2986

Open
11 tasks done
mcarpenter622 opened this issue May 8, 2024 · 5 comments
Open
11 tasks done

Comments

@mcarpenter622
Copy link

mcarpenter622 commented May 8, 2024

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • OpenBSD
  • Android
  • iOS
  • Nintendo Switch
  • PlayStation 5
  • Xbox
  • Web Browsers

What feature would you like to be added?

I would like a new function or enhancement to GetScreenSize that gives the proper size of the viewable area regardless of if it is maximized or not.

It would be ideal of this new function worked in all environments.

It feels clunky to have to write code like this to get the actual viewable area:

ww, wh := ebiten.WindowSize()
    if ebiten.IsFullscreen() {
        ww, wh = ebiten.ScreenSizeInFullscreen()
    }

(I know this is a little outdated and should use Monitor().Size() )

Why is this needed?

To simplify the development experience.

@hajimehoshi
Copy link
Owner

GetWindowSize alternative that takes into account if the window is maximized

Maximized window and fullsceening are different things. Do you mean you want to get a monitor size at WindowSize when fullscreening?

@mcarpenter622
Copy link
Author

I meant FullScreen mode. I would like a function to get the viewable size that ebitengine is drawing on, regardless of window state. Essentially, I'm trying to write code to center something on the screen and I have to use that snippet above to make it work properly whether the game is in FullScreen mode or not. Ideally this new function would work for mobile devices too.

@hajimehoshi
Copy link
Owner

You can keep the arguments of Layout function and use it in Update.

Ideally this new function would work for mobile devices too.

Mobiles don't have a window.

@mcarpenter622
Copy link
Author

True, but the engine has those values to send to layout so why not expose them in an easy to access way?

@hajimehoshi
Copy link
Owner

Good point. I hesitated to add a new global function that are available only when the game is running. Let me think.

@hajimehoshi hajimehoshi added this to the v2.8.0 milestone May 8, 2024
@hajimehoshi hajimehoshi changed the title GetWindowSize alternative that takes into account if the window is maximized ebiten: add a new API to return the logical screen size (= the result of Layout) May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment