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

Change window size (action Preference) #5482

Closed
Neyunse opened this issue Apr 27, 2024 · 9 comments
Closed

Change window size (action Preference) #5482

Neyunse opened this issue Apr 27, 2024 · 9 comments

Comments

@Neyunse
Copy link
Contributor

Neyunse commented Apr 27, 2024

Suppose we want to offer players the option to change the window size. Currently, we have "Preference("display", value)". However, if we want to allow them to choose a specific size, such as "1280x720", we could do it this way: "Preference("display", 0.666666666667)". However, calculating "0.666666666667" can be tedious if you don't know the formula for doing so.

Therefore, I think it would be interesting to add a functionality to use predefined sizes. For example:

textbutton "1280x720" action Preference("display", w_size=(1280,720))

Or:

vbox:
    textbutton "Default size" action Preference("window", None)  # (gui.init).
    textbutton "1280x720" action Preference("window", 1280, 720)
    textbutton "1024x768" action Preference("window", 1024, 768)
@Gouvernathor
Copy link
Member

Given the "letterbox" behavior when width and height are off the indended ratio, I don't think there is a need for setting both sizes independently.
You can pass 1280/config.screen_width to end up with a window of 1280 pixels wide. If you want to automate the process, you can define a wrapper function that does that operation for you.
I don't think there is a need for having renpy do it for you, and having more documented feature is just impeding maintainability for nothing.

@Neyunse
Copy link
Contributor Author

Neyunse commented Apr 27, 2024

Given the "letterbox" behavior when width and height are off the indended ratio, I don't think there is a need for setting both sizes independently. You can pass 1280/config.screen_width to end up with a window of 1280 pixels wide. If you want to automate the process, you can define a wrapper function that does that operation for you. I don't think there is a need for having renpy do it for you, and having more documented feature is just impeding maintainability for nothing.

I was tryed with 1024x768 and I get a totally different size.

(16:9) -> (4:3)

image

Default Size (1080)

image

Expectated size (1024x768)

image

I get (???x???)

image

@Gouvernathor
Copy link
Member

The ratio is expected to remain the same, did you mix up the two screenshots ?

@Neyunse
Copy link
Contributor Author

Neyunse commented Apr 29, 2024

The ratio is expected to remain the same, did you mix up the two screenshots ?

No, the window size is different. The last image is using 1080p 16:9, not 4:3

The middle image is 4:3 and the bottom image was scaled to 1080p 16:9, which is incorrect as it should be the expected size I show in the second image. which should be 4:3 (1024x768)

@Gouvernathor
Copy link
Member

Gouvernathor commented Apr 29, 2024

Given that your original size is 16:9, why would you expect it to become 4:3 under any circumstance ?
Making your game window 4:3, if it were possible programmatically, should give you black bars at the top and bottom of the screen, and not what you have as the second image.

@Neyunse
Copy link
Contributor Author

Neyunse commented Apr 29, 2024

Given that your original size is 16:9, why would you expect it to become 4:3 under any circumstance ? Making your game window 4:3, if it were possible programmatically, should give you black bars at the top and bottom of the screen, and not what you have as the second image.

Basically for a classic style, assuming that some player wants to play in a square window. Something like: "Oh! an option to play in a classic retro style", and regarding the other, I made a small script and variable to achieve it. But it's not perfect, it has problems if there are more than two monitors and one of them is bigger (for example, it can take the size of the second monitor when switching to "Modern" mode and the window looks huge on the main monitor, so the scaling only works on the main monitor, although it will probably also fail in some rare cases with a single monitor.).

image

2024-04-29-00-45-21.mp4

@Gouvernathor
Copy link
Member

Gouvernathor commented Apr 29, 2024

That's not something Ren'py is made to support. There's supposed to be one single ratio for a given game, and even with the same ratio there is supposed to be a single resolution Ren'py placement operates in : even if you resize the window, the in-game coordinates of all corners will remain the same.
Basically doing that would just ruin any absolute coordinate in either vertical or horizontal direction. I don't think that's ever going to be supported.
Also, config variables are not supposed to be changed at runtime.

@Neyunse
Copy link
Contributor Author

Neyunse commented Apr 29, 2024

That's not something Ren'py is made to support. There's supposed to be one single ratio for a given game, and even with the same ratio there is supposed to be a single resolution Ren'py placement operates in : even if you resize the window, the in-game coordinates of all corners will remain the same.
Basically doing that would just ruin any absolute coordinate in either vertical or horizontal direction. I don't think that's ever going to be supported.
Also, config variables are not supposed to be changed at runtime.

I understand what you are saying, but let's think about the monitors that do not support that "fixed ratio" this proposal goes beyond what I am trying to achieve, monitors that have a ratio greater than 16:9 can cause the game to look bad. Scaling beyond 1080p can cause malfunctions due to large (or even smaller) monitors. Setting only one size like 1080p and only working in 16:9, I don't think it's fair if we see the new monitors that come out every day.

That's why I left this issue, I think it would be good for a future update or for someone who has the same question. On the renpy forum I saw several attempts to achieve this.

@renpytom
Copy link
Member

The one thing I've considered, but never really put on the top of my list, is allowing the game to become wider or taller than the default. So the interface in the center would stay the same, but if the window was wider you'd see more of a background.

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

No branches or pull requests

3 participants