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.
-
Kia
- Eileen-Class Veteran
- Posts: 1008
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
-
Contact:
#1
Post
by Kia » Tue Aug 02, 2022 11:58 am
I was messing with viewport and found a behavior that doesn't make sense to me.
Code: Select all
screen vptest:
modal True
vbox spacing 10:
viewport:
yfill False
frame background "#fff4" xfill True:
fixed fit_first True xalign .5:
frame xsize 800:
text "inside a viewport."
text "Some name":
substitute False
xalign 0.0 xanchor 1.0 xoffset -30
fixed:
frame background "#fff4" xfill True:
fixed fit_first True xalign .5:
frame xsize 800:
text "inside something else."
text "this is":
substitute False
xalign 0.0 xanchor 1.0 xoffset -30
label start:
call screen vptest
"ssdsd"
return
The viewport seems to cut around it's children even multiple levels down. Anything offsetted outside the child area is not rendered. I assume it's related to the `child_size` mentioned in the docs, but `child_size(None,None)` doesn't seem to have any effect.
-
Kia
- Eileen-Class Veteran
- Posts: 1008
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
-
Contact:
#2
Post
by Kia » Wed Aug 10, 2022 7:35 am
Anybody has any ideas of why this happens and how to circumvent it?
-
m_from_space
- Veteran
- Posts: 302
- Joined: Sun Feb 21, 2021 3:36 am
-
Contact:
#3
Post
by m_from_space » Wed Aug 10, 2022 7:54 am
I'm not sure what exactly you are talking about to be honest.
Are you referring to your text "Some name" not showing up inside the viewport? The reason is, that you are positioning it outside of the screen (first you set xalign 0.0, which means xpos and xanchor to 0.0, then you set xanchor back to 1.0 and that means the right side of the text is going to align with the left side of the screen, pushing it outside. the xoffset only moves it further away). Just remove the xanchor 1.0 if you want to see it.
Maybe I am not understanding, what you are expecting here.
-
Kia
- Eileen-Class Veteran
- Posts: 1008
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
-
Contact:
#4
Post
by Kia » Wed Aug 10, 2022 11:00 am
If you change the offset to a small number on the positive like 10, you'll notice that the text isn't outside of the screen, it's on the same place as the first example, but being cut off because it's just outside of the fixed container.
The only difference between the two is: one is indirectly inside a viewport.
-
m_from_space
- Veteran
- Posts: 302
- Joined: Sun Feb 21, 2021 3:36 am
-
Contact:
#5
Post
by m_from_space » Wed Aug 10, 2022 2:23 pm
Okay now I get you. The following screen makes your point much clearer. It only seems to cut top and left though.
Code: Select all
screen vptest:
modal True
vbox spacing 10:
viewport:
area (100, 100, 600, 400)
text "viewport" xpos 0 ypos 0
frame:
background "#ffa9"
fixed:
frame:
background "#aff9"
area (50, 50, 200, 50)
text "frame1_textA_textA_textA_textA" xoffset -20 yoffset -10
text "frame1_textB_textB_textB_textB" xoffset -20 ypos 35
frame:
area (300, 150, 200, 50)
background "#afa9"
text "frame2_textA" xoffset -20 yoffset -10
text "frame2_textB" xpos 160 ypos 35
text "viewport_text" xpos 250 ypos 250
-
Kia
- Eileen-Class Veteran
- Posts: 1008
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
-
Contact:
#6
Post
by Kia » Wed Aug 10, 2022 3:48 pm
Nice find, it never crossed my mind to test the other sides.
-
m_from_space
- Veteran
- Posts: 302
- Joined: Sun Feb 21, 2021 3:36 am
-
Contact:
#7
Post
by m_from_space » Thu Aug 11, 2022 3:06 am
I'm still unsure if this is really a valid bug or just bad programming. When you create frame, your intention should be to put stuff inside that frame and not put it outside of it. Because if you want stuff outside of that frame, why create a frame in the first place?
-
Kia
- Eileen-Class Veteran
- Posts: 1008
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
-
Contact:
#8
Post
by Kia » Thu Aug 11, 2022 5:42 am
There are several good reasons to arrange elements the way I've done. The one in this case is: It makes positioning elements much easier. You can't really do something like this in any other reasonable way:
Code: Select all
frame:
align .5,.5 xysize 800,600 background "#523"
text "something " xanchor 1.0 xoffset -10
Imagine the frame's size is not a set size and changes depending on the content, and the text would change in size. All other tricks that might be able to mimic the look would go out of the window.
-
Kia
- Eileen-Class Veteran
- Posts: 1008
- Joined: Fri Aug 01, 2014 7:49 am
- Deviantart: KiaAzad
- Discord: Kia#6810
-
Contact:
#10
Post
by Kia » Thu Aug 11, 2022 11:50 am
m_from_space wrote: ↑Thu Aug 11, 2022 7:49 am
Well, you should probably create a bug report
will do, just wanted to confirm that it's really a bug before doing so.
m_from_space wrote: ↑Thu Aug 11, 2022 7:49 am
Congratz on 1000 posts by the way!
Thank you ^^
Users browsing this forum: Bing [Bot], Google [Bot]