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?
Window Resize - In Game.
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.
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.
Re: Window Resize - In Game.
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.
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.
Re: Window Resize - In Game.
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.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.
Re: Window Resize - In Game.
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).
Re: Window Resize - In Game.
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.
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.
Who is online
Users browsing this forum: Bing [Bot], DewyNebula