Closed altruios closed 2 years ago
found it - I think. it was in values... but it also gets set in RUN for the home screen which doesn't use those values.
going to see If I can get that more holistic.
related pull request. however I think there should be a holistic way to tell what the monitor resolution actually is from python: but I can't seem to find a good consistent (platform independent) way of doing that (without adding in something like pysimplegui, or another module).
I read about this issue, the pygame.FULLSCREEN needs fs_size to be exactly the dimensions of your monitor. Best way would be to use a module to detect the monitor dimensions. From what i can gather from https://stackoverflow.com/questions/3129322/how-do-i-get-monitor-resolution-in-python,
screeninfo module might work with Linux too
I think I fixed it, try it out when you can
alas: just tried the latest pull: issue is... better: but still get this error:
anim/glitch/0010.png
Traceback (most recent call last):
File "2dshooter/RUN.py", line 579, in <module>
pygame.transform.scale(screen, fs_size, full_screen)
ValueError: Destination surface not the given width or height.
I say better because now there felt like there was less load time (when I had the exact right resolution - it worked great)...
printing out the vars just before the crash we get this:
screen
<Surface(854x480x32 SW)>
fs_size
(1080, 1920)
full_screen
<Surface(3840x2160x32 SW)>
Traceback (most recent call last):
File "2dshooter/RUN.py", line 587, in <module>
pygame.transform.scale(screen, fs_size, full_screen)
ValueError: Destination surface not the given width or height.
the surface size is the correct dimension, however the fs_size variable still seems to set itself as 1920x1080?
looking closer at it now.
ah: found the issue: it was going to the first monitor in the list of get_monitors... however it needs to go to the monitor with .is_primary property set to true. making pull request for fix.
I thought that 1080x1920 was a weird res, is your monitor flipped?
aye: to the side for coding - it's the first one in the list - but my primary was set to the second input on my graphics card.
question: do you have two monitors - does launching vscode for you in one of the monitors and the game in the other work for you? for me it seems that the python instance needs to also be running in the same window as the game window?
No I only have my shitty school laptop. But that's really weird, does the window always start in the same monitor you have your VSCode in?
initially -yeah: so maybe it's a timing issue in the order of things init-ing. it flashes on the monitor it python is running in, then it starts in my main window, then it crashes. if i have python in my main window - it doesn't crash.
yeah I think it tries to start the game in whatever window the IDE is in, and the fullscreen scale cant be done in that spesific monitor so it crashes. I wonder if theres a way to start the game always in the main monitor
so here is the error I found.
there's some recap: I have a 4k monitor, and I noticed this in the code.
game would not start (I hear some music and a black screen, then it crashes)- it would give this error at start:
when I changed the fs_size var to be:
which is my resolution, the loading screen starts up. everything looks fine. the latest error (the top one of this post) happens when I hit start game on single or multiplayer after I made that change.
It's also hard for me to debug - because when I run the debugger in vscode - whatever screen the terminal is displayed in is the one pygame (not the monitor pygame is in ) seems to want to measure and get the dimensions of. (so I can't seem to have vscode open on the side and pygame on the center monitor without producing a
at some point - because of some mismatch of measurement.
I'll try another DE and maybe it's just an I3 thing, but I think it's a 4k/1080p or a (single/dual monitor ?) thing.