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

Pygame 2.0.0dev6: display surface has size (1,1) #1475

Closed
fladd opened this issue Nov 1, 2019 · 8 comments
Closed

Pygame 2.0.0dev6: display surface has size (1,1) #1475

fladd opened this issue Nov 1, 2019 · 8 comments
Labels
critical display pygame.display
Milestone

Comments

@fladd
Copy link
Contributor

fladd commented Nov 1, 2019

On MacOS with Pygame 2, this

import pygame
pygame.init()
print(pygame.__version__)
screen = pygame.display.set_mode((400, 300), pygame.DOUBLEBUF | pygame.OPENGL)
print(screen.get_size())

will result in

2.0.0.dev6
(1, 1)

while in Pygame 1.9, it used to be

1.9.6
(400, 300)
@robertpfeiffer
Copy link
Contributor

I'm not sure if relying on the content of the fake display surface is a good idea. Do any of your games rely on this behaviour? In the future we will provide a better API for this, but if there are games that rely on the size of the fake display surface being the window size, we could re-create the old behaviour.

@fladd
Copy link
Contributor Author

fladd commented Nov 1, 2019

Well, we do, but we can rewrite our code.

Please be aware that also pygame.display.get_surface().get_size() and (pygame.display.Info().current_w/(pygame.display.Info().current_h will not return the actual size anymore in Pygame 2.

Only pygame.display.get_window_size() does return the correct size it seems.

@humanbeast7
Copy link

@robertpfeiffer
well, the previous API was very convenient
beside that, using the fake display surface "get_size()"
might be called in a function that can be applied to any surface,
therefore, the new API will make every function like that
to use a special case for the display surface.
as an example, think of a function that checks collision with surface borders

@illume illume added the critical label Nov 1, 2019
@illume illume added this to the 2.0 milestone Nov 1, 2019
@illume illume added the display pygame.display label Nov 1, 2019
@robertpfeiffer
Copy link
Contributor

robertpfeiffer commented Nov 1, 2019

@fladd yeah.

pygame.display.Info() should actually be changed.
pygame.display.get_window_size() gives you the physical size

@fladd
Copy link
Contributor Author

fladd commented Nov 1, 2019

I just think that the fact that the display surface is a "fake" surface, while technically correct, is not something that concerns the user. For the user, conceptually the display has a surface they can blit on, and that surface, conceptually, is the size of the display/window.

@robertpfeiffer
Copy link
Contributor

I understand where you're coming from, but no.

I'll fix this, but in general, the return value of pygame.display.set_mode(spam, pygame.OPENGL) is a fake surface, and should not be treated like a surface, and you should not blit to or from it. You do not blit to the screen with pygame.OPENGL. You use OpenGL instead of blitting. That's the whole point.

Likewise, when you do pygame.display.set_mode(spam, bacon | pygame.SCALED), then your surface size won't necessarily be the size of the window.

I'd fix the behaviour (for backwards compat) but also change the docs that we make no guarantee about the type or behaviour of the return value when using pygame.OPENGL.

While I'm at it, I could also write a new is_fullscreen API for #1343 and deprecate the FULLSCREEN flag on surfaces in the docs.

@illume
Copy link
Member

illume commented Nov 4, 2019

@fladd thanks for the issue report. It's fixed in #1482

Quite a few OPENGL using apps depend on this behaviour. So this behaviour is not going away.

@illume illume closed this as completed Nov 4, 2019
robertpfeiffer pushed a commit that referenced this issue Nov 4, 2019
@fladd
Copy link
Contributor Author

fladd commented Nov 4, 2019

@fladd thanks for the issue report. It's fixed in #1482

Quite a few OPENGL using apps depend on this behaviour. So this behaviour is not going away.

Glad to hear this. Thanks for fixing!

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

No branches or pull requests

4 participants