Window Resize - In Game.

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Silverluv
Newbie
Posts: 6
Joined: Tue Jul 11, 2017 12:39 pm
Contact:

Window Resize - In Game.

#1 Post by Silverluv »

Why hello, it''s been a while since I've been here but I have another question regarding the UI of Renpy.
I wonder if there is a code to allow players to resize a window ---in game.
Meaning for example making the dialogue box smaller or bigger by dragging it by it's corners like you would do with any other window on your computer.
Is there a way to do this?

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Window Resize - In Game.

#2 Post by kivik »

It depends on how good you are with python I think, you'd probably need to have mouse over events on a certain area of your in game window and then using the mouse cursor position to resize the screen when mouse1 is down. I don't think it's that easy to do, but I'd think it's doable for the more experienced developers (I'm not one of them).

I think unless you're quite experienced with coding, and this feature can really pay off, that you don't waste time on this - especially if you're trying to do this to the character dialogue boxes, which are supposed to advance by click to continue.

User avatar
Silverluv
Newbie
Posts: 6
Joined: Tue Jul 11, 2017 12:39 pm
Contact:

Re: Window Resize - In Game.

#3 Post by Silverluv »

kivik wrote: Mon May 14, 2018 2:33 pm It depends on how good you are with python I think, you'd probably need to have mouse over events on a certain area of your in game window and then using the mouse cursor position to resize the screen when mouse1 is down. I don't think it's that easy to do, but I'd think it's doable for the more experienced developers (I'm not one of them).

I think unless you're quite experienced with coding, and this feature can really pay off, that you don't waste time on this - especially if you're trying to do this to the character dialogue boxes, which are supposed to advance by click to continue.
Thats's true. :) Well I thought i'd be nice to know because the dialogue window isn't the only window I would like to resize. My game thus far is in a nvl mode so, the text is always on screen for the player to scroll back to a read again when needed. So, this window, that being the nvl window, I wanted to be resizable. But what is this "mouse1 is down" thing you are talking about? :O. I just am curious to know how I would do this in Renpy.

User avatar
kostek00
Regular
Posts: 131
Joined: Wed Mar 28, 2018 5:54 pm
Contact:

Re: Window Resize - In Game.

#4 Post by kostek00 »

If I recall correctly "mouse1" is name in ren'py for left mouse button. So by "mouse1 is down" he means when left mouse button is pressed but not released. I don't know if creating options where you have options to scale specific elements with sliders isn't easier but that will force to constantly go to options, use slider, than exit options (could always use some transparent background to see gui underneath).

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Window Resize - In Game.

#5 Post by kivik »

I'm going to be honest, I don't think resizing windows is something you should pursue. Like I said, it's at the level that requires someone quite familiar with programming (experienced developer) and at least familiar enough with Renpy's features and terminologies to do. If you don't know understand all the terminologies I mentioned above, I don't think you'll be able to do it.

For reference, I can't confidently say that I can even do it myself - though I have a vague idea of where to start with it, and I have programming background (albeit not python).


With that in mind, my suggestion is to consider why you need your windows resizing? Is it such a fundamental part of your game's experience? Is it something that can be navigated around with better UI design?

If you still think it's absolutely necessary to the experience, you should look up:

- Renpy's screen language: https://www.renpy.org/doc/html/screens.html
- Renpy's style properties: https://www.renpy.org/doc/html/style_properties.html

Once you feel you've got a good grasp of how the two things work together, you can perhaps look at adding buttons that adjusts the width and height of your screens by using variables for them, and setting the variables using screen actions: https://www.renpy.org/doc/html/screen_actions.html


It's not an ideal solution. But it's a start. If you insist on doing resizing with mouse drag, here are some pointers:
- getting the mouse coordinate: https://www.renpy.org/doc/html/other.ht ... _mouse_pos
- mouse area for a screen: https://www.renpy.org/doc/html/screens. ... -mousearea - you can use this to toggle resize being used or not, and to change the mouse cursor, indicating that player can resize window
- changing mouse cursor: https://www.renpy.org/doc/html/config.h ... nfig.mouse
- hooking keys to actions (mouse clicks are still keys): https://www.renpy.org/doc/html/screens.html#key

All your adjustable screen's size and position should be based on variables, so you need to calculate the new x,y position (if resizes on the left and up direction) and the x,y sizes based on the mouse coordinate.

I don't even know what would happen if you hook all these up together, as I don't know if the screen would be redrawn straight the way as you drag or wait till you let go of the mouse before the screen is refreshed. Hopefully the former as I wouldn't have to clue how to even approach fixing it if it's the latter.

Like I said, it's for the experienced devs.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], DewyNebula