Centering text and the text 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
mr_bungle700
Newbie
Posts: 2
Joined: Sat Jul 14, 2007 6:01 am
Contact:

Centering text and the text window

#1 Post by mr_bungle700 »

Hey everyone, first time poster. I just started working with Ren'Py and I have a couple of simple things I'd like to do in my game that I haven't been able to figure out how to manage. I know these are pretty basic problems, but I've been searching around and I haven't been able to find the answers so I figure I'll ask here.

So...

1) How do I reposition the text window? I'd like to place the window in the middle of the screen if that's possible. I'm going to be emphasizing the "novel" part of "visual novel," so I want the text to be front and center most of the time.

2) How do I center text within the text window? I'm using the "centered" command for certain titles, but I'd like to be able to put text in the center of the text window in some instances.

Raikiri
Regular
Posts: 58
Joined: Mon Jan 29, 2007 10:32 am
Location: Sweden
Contact:

Re: Centering text and the text window

#2 Post by Raikiri »

First off, welcome to the forums!

Now, for your first question... I know this can be done in some way, but I've never bothered to learn how... But if you want to give your game more of a "Novel" feel, wouldn't it be easier to just use NVL mode? You can find examples of how this is done in the demo that comes with Ren'Py; click on "Advanced Features" when you get to the topic menu, and then on "NVL Mode".

You could also visit the relevant reference page, http://www.renpy.org/wiki/renpy/doc/reference/NVL_Mode.

As for the second one, I personally don't know of any way to do this, save for using "\n" to insert newlines manually. If you had a textbox with a height of, say five lines of text, you could use something like

Code: Select all

centered "\n\nTEXT"
to make sure that TEXT would be centered vertically as well as horizontally.

Of course, if your textbox is only four lines tall (as is the standard AFAIK) you'll have to live with TEXT being on the 2nd or 3rd line rather than the center, which would've been line 2,5...

I hope this helps in some small amount, at least. If not, you can wait until the more experienced users come along - my own knowledge of Ren'Py is rudimentary at best.
Lucifer status:
It Will Be Done When It's Done™

User avatar
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

Re: Centering text and the text window

#3 Post by DaFool »

Perhaps using Subtitles might be useful? Subtitles use auto-text-centering. You can run through the Ren'Py demo and change the y positioning (i.e. get O3-style centered text and what not). O3 (Ori Ochi Onoe) has the text 'front and center' as you described... and with that look, its best to leave the actual 'textbox' out of it, so subtitles it should be, I guess. You can disable use of SFonts and use your own font if you like for that. I'm recommending Subtitles because imagining a centered ADV-style textbox with centered text on it does not really seem like good aesthetics to me.

mr_bungle700
Newbie
Posts: 2
Joined: Sat Jul 14, 2007 6:01 am
Contact:

Re: Centering text and the text window

#4 Post by mr_bungle700 »

Thanks for the quick replies!

@Raikiri: Ah yes, NVL mode! I went through the demo a while ago and had forgotten all about that until you mentioned it. I was thinking of having the textbox only occupy the center third of the screen, but NVL mode will work fine for what I want to do.

@DaFool: The only time I'd be centering the text within the textbox would be to introduce new chapters of the story, but I think you're right about it not necessarily looking very good. Your suggestion of using subtitles instead is an excellent one. I'll give that and NVL mode a try and see how I like using them.

Enerccio
Miko-Class Veteran
Posts: 616
Joined: Thu Oct 26, 2006 4:23 pm
Projects: My Teacher; Songs of Araiah; Something new; Possible Cross Bomber?
Location: Slovakia, Kosice
Contact:

Re: Centering text and the text window

#5 Post by Enerccio »

Well you can try this:

Code: Select all

    show expression Text("Chapter 1", size=40, yalign=0.5, xalign=0.5) as text with dissolve
    $ renpy.pause(7.0, hard=True) 
    hide text with dissolve
which will position text in middle of screen (yalign=0.5, xalign=0.5) :wink:
Image
http://www.bishojo.tk is technically ONLINE!
Songs of Araiah promo: http://www.youtube.com/watch?v=CalchucuoDU

Post Reply

Who is online

Users browsing this forum: Google [Bot], henne, Ocelot