Centered with NVL window

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
Samidarenina
Regular
Posts: 137
Joined: Sun Aug 01, 2010 1:21 pm
Contact:

Centered with NVL window

#1 Post by Samidarenina »

I've been trying to center Text on top of the nvl window, but so far I had no luck. Did anyone try doing that already?
I'd really appreciate if someone could show me to which degree I would need to modify "centered" to work in the desired way.

Thank you.

User avatar
PyTom
Ren'Py Creator
Posts: 16082
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Centered with NVL window

#2 Post by PyTom »

You probably want to do something like:

Code: Select all

define nvlcenter = Character(None, kind=nvl, what_text_align=0.5, what_xalign=0.5)
[code]
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Samidarenina
Regular
Posts: 137
Joined: Sun Aug 01, 2010 1:21 pm
Contact:

Re: Centered with NVL window

#3 Post by Samidarenina »

I've tried that already, but for some reason the text gets displayed as if it were a normal line, at the top of the window.

User avatar
PyTom
Ren'Py Creator
Posts: 16082
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Centered with NVL window

#4 Post by PyTom »

You may also want to add what_minwidth=700 or so to that - increase it until it looks right.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Samidarenina
Regular
Posts: 137
Joined: Sun Aug 01, 2010 1:21 pm
Contact:

Re: Centered with NVL window

#5 Post by Samidarenina »

what_minwidth=700 worked, but only partially. The text is now properly horizontally aligned, but vertically it's still on the first line.

chaos-dark-lord
Newbie
Posts: 8
Joined: Sun May 07, 2017 3:59 pm
Deviantart: chaos-dark-lord
Contact:

Re: Centered with NVL window

#6 Post by chaos-dark-lord »

This is an old post, yet Im still looking for the same answer. How do I center text vertically? specially in NVL mode?

I'd would like to be able to make NVL characters with custom height or for the text to be centered vertically. Not for the narrator or all NVL text, just for a character. But the text always starts at the top.

This is one of the texts I've tried:

Code: Select all

define na = Character(None, what_xalign=0.5, what_color="#E6E6E6", who_outlines=[ (1, "#000000")], what_text_align=0.5,  text_xpos=0.5,  text_ypos=0.5, what_minheight=200, kind=nvl)
neither text_ypos=0.5 or what_minheight=200 work for anything.

Or is there a way to make a normal ADV character that imitates the NVL mode?

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

Re: Centered with NVL window

#7 Post by papiersam »

That odd, actually. Using:

Code: Select all

define na = Character(None, what_yalign=0.5, kind=nvl)
(with or without other tags) gives me a slightly lower than top position. Can't figure out why it's not centering, where it's counterpart (xalign) works just fine. In the old gui, it's not even budging.

I haven't worked with RenPython for a while, but I'm thinking I've done this before and I'm just missing a letter or two.

chaos-dark-lord
Newbie
Posts: 8
Joined: Sun May 07, 2017 3:59 pm
Deviantart: chaos-dark-lord
Contact:

Re: Centered with NVL window

#8 Post by chaos-dark-lord »

I more or less make it work by defining the character like this (I discovered it can be used for a sort of tutorial : viewtopic.php?f=8&t=25130 ):

Code: Select all

init 9999 python:
    na = Character(None, kind = centered, what_color="#FFFFFF", what_outlines = [(2, "#003C78", 0, 0)], what_justify=True, window_left_padding=100, window_right_padding=100)
It does center the text, the problem is that I cant define the margins of the text. I used the

Code: Select all

, window_left_padding=100, window_right_padding=100
so that the text wouldnt be too long. But I think the 100 is taken as 1 because if I use anything less the text still goes too close to the edge of the window.

Basically, I still need :

1-A way to define the margins in X and Y
2-A way to define the width and height of the block of text of a centered character

User avatar
komehara
Regular
Posts: 36
Joined: Fri Jan 31, 2020 10:08 pm
Projects: Spirit Link
Tumblr: hsandt
Deviantart: hsandt
Github: hsandt
itch: komehara
Contact:

Re: Centered with NVL window

#9 Post by komehara »

I only needed X alignment, so I followed the first suggestion, but I had to remove `what_xalign=0.5` or it would add a fixed padding on the left. Not sure 0.5 of what dimension it corresponds to, but if you only set what_xalign=0.5 (keeping what_text_align=0.0) the offset from the left will be obvious.

When what_xalign=0.5, it also seems to cancel the effect of gui.nvl_text_xpos (changing its value didn't change the final position).

Final character code:

Code: Select all

define nvlcenter = Character(None, kind=nvl, what_text_align=0.5)
Before fix, with what_xalign=0.5:
After fix, without what_xalign=0.5:

Post Reply

Who is online

Users browsing this forum: No registered users