jamesg31 / TowerGame

PyGame Tower ATC simulation.
GNU General Public License v3.0
6 stars 1 forks source link

Window Resizing #18

Closed AdamJCavanaugh closed 3 years ago

AdamJCavanaugh commented 3 years ago

initial window resizing; certain resolutions don't work well

closes #14

AdamJCavanaugh commented 3 years ago

And some examples of the current results. The 1st 2 are great. The 3rd is... okay... the 4th is an exaggerated example of where the problem occurs:

default larger extra-wide extra-tall

jamesg31 commented 3 years ago

Okay, this makes sense. I had a suspicion we would run into this issue. The problem is with the scale, it is determined by the top and bottom location. If you look in airport.hjson you see the top and bottom, that is what determines what will be on the top and the bottom. All the scale code cares about is that the top and bottom are the top and bottom of the screen, and everything else is to scale with it. We potentially also need to add a right, make a scale for left to right as well, and whichever is smallest? biggest? something like that gets used as the actual scale. Just a potential solution.

AdamJCavanaugh commented 3 years ago

Here's a different approach that actually scales the surface, rather than recreating it. This resolves the issues with different resolutions (although it adds skew, so squares become rectangles, depending on the exact resizing of the window), but means the aircraft continue to move on the old coords, rather than the new.

It's probably a less-perfect solution, but I wanted to push it while I thought about it more.

AdamJCavanaugh commented 3 years ago

How did you get the values for top/bottom/left in the airport.hjson so I can determine the right for trying your fix?

jamesg31 commented 3 years ago

How did you get the values for top/bottom/left in the airport.hjson so I can determine the right for trying your fix?

I kinda just picked values that made sense, unfortunately this will of course not work for the right side since if you pick wrong it will mess up the proportions. Maybe reverse the cood_to_pixel and get the location of the right side printed out for ya? If you look in the event handler for the print statements when you click it should already have the code you need to reverse the function since I did it already.

AdamJCavanaugh commented 3 years ago

I had some git issues at the end there, but I think I got them resolved correctly.

I think we should consider creating a new issue to create a generic class for both asdex and radar, then make sub-classes for these, since the init methods are identical, the cood_to_pixel could be made identical (perhaps), and the render differences could be made in the sub-classes... this would only be useful if we might make a 3rd (or more) view or do more view changes... thoughts?

jamesg31 commented 3 years ago

Yep definitely, I am always in support of more flexibility. Who knows what we might want to add down the line. If you want to get that issue and the cood movement issue you were talking about in discord open that would be great.