Window Frame/Text Alignment issue

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
corny
Regular
Posts: 41
Joined: Sun Sep 18, 2011 1:08 pm
Contact:

Window Frame/Text Alignment issue

#1 Post by corny »

SO. I'm making a game where the dialogue is presented in chat bubbles closer to the top of the screen rather than at the bottom. I'm having problems with just about every aspect of this in the new GUI, when I'd had it working perfectly in the legacy gui. This is how it was looking in the old version. (Cropped just so it doesn't flag the 800 px limitation. It's supposed to be yaligned at .2)
Image

The code for that in options:

Code: Select all

    style.window.background = Frame("images/textbox.png", 12, 12)

    ## Margin is space surrounding the window, where the background
    ## is not drawn.

    style.window.left_margin = 350
    style.window.right_margin = 350
    style.window.top_margin = 400
    style.window.bottom_margin = 400

    ## Padding is space inside the window, where the background is
    ## drawn.

    style.window.left_padding = 30
    style.window.right_padding = 30
    style.window.top_padding = 20
    style.window.bottom_padding = 30

    ## This is the minimum height of the window, including the margins
    ## and padding.

    style.window.yminimum = 300
And I'm also using this to have a version that flips to the other side when the character on the right is speaking, which had been working perfectly fine.

Code: Select all

define pr = Character('ping_latency*', color ="#3A9FE5", size = 15, window_background=Frame("images/textboxr.png", 30, 20, 20, 20))
Now. My issue since switching into the new GUI is that the window doesn't go where I want it to go, and the window doesn't stretch for the dialogue at all. I put in the exact same padding and margin numbers, and for some reason it does this.

Image

And here's the code.

Code: Select all

style window:
    xalign 0.5
    yalign .2
    xfill True

    background Frame("images/textbox.png", 12, 12)
    xmargin 350
    top_margin 400
    bottom_margin 499
    xpadding 30
    top_padding 20
    bottom_padding 30
And the code for the dialogue, because for some reason that's all separate now and was definitely affecting things as I messed around trying to get it to work.

Code: Select all

## The height of the textbox containing dialogue.
define gui.textbox_height = 500
define gui.textbox_width = 100

## The placement of the textbox vertically on the screen. 0.0 is the top, 0.5 is
## center, and 1.0 is the bottom.
define gui.textbox_yalign = 0.0


## The placement of the speaking character's name, relative to the textbox.
## These can be a whole number of pixels from the left or top, or 0.5 to center.
define gui.name_xpos = 0
define gui.name_ypos = 0

## The horizontal alignment of the character's name. This can be 0.0 for left-
## aligned, 0.5 for centered, and 1.0 for right-aligned.
define gui.name_xalign = 0.0

## The width, height, and borders of the box containing the character's name, or
## None to automatically size it.
define gui.namebox_width = None
define gui.namebox_height = None

## The borders of the box containing the character's name, in left, top, right,
## bottom order.
define gui.namebox_borders = Borders(5, 5, 5, 5)

## If True, the background of the namebox will be tiled, if False, the
## background if the namebox will be scaled.
define gui.namebox_tile = False


## The placement of dialogue relative to the textbox. These can be a whole
## number of pixels relative to the left or top side of the textbox, or 0.5 to
## center.
define gui.dialogue_xpos = 5
define gui.dialogue_ypos = 30

## The maximum width of dialogue text, in pixels.
define gui.dialogue_width = 755

## The horizontal alignment of the dialogue text. This can be 0.0 for left-
## aligned, 0.5 for centered, and 1.0 for right-aligned.
define gui.dialogue_text_xalign = 0.0
I have the same character based Frame code in there too, but it hasn't seemed to affect anything when I take it away, so I don't think that has anything to do with it.

Once the issue of the textbox expanding for the dialogue is fixed, I'm wondering if there's a way to make it expand downward instead of upward, because then it'd expand right off the screen...

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Window Frame/Text Alignment issue

#2 Post by trooper6 »

Hey all!
I'm working on recreating my game using the new gui because the legacy gui doesn't play well with layered images.
And I'm having this same problem.

In the legacy gui I had a textbox that expanded with text and that I was able to place where I wanted it to be. My old textbox was like so:

Code: Select all

    #########################################
    ## These settings let you customize the window containing the
    ## dialogue and narration, by replacing it with an image.

    ## The background of the window. In a Frame, the two numbers
    ## are the size of the left/right and top/bottom borders,
    ## respectively.

    style.window.background = Frame("images/GUI/00Intertitle2_64x71.png", 64, 71)

    ## Margin is space surrounding the window, where the background
    ## is not drawn.

    style.window.left_margin = 20
    style.window.right_margin = 244
    style.window.top_margin = 20
    style.window.bottom_margin = 20

    ## Padding is space inside the window, where the background is
    ## drawn.

    style.window.left_padding = 20
    style.window.right_padding = 20
    style.window.top_padding = 20
    style.window.bottom_padding = 20

    ## This is the minimum height of the window, including the margins
    ## and padding.

    style.window.yminimum = 200
I've moved over to the new gui...and typed in this:

Code: Select all

## Dialogue ####################################################################
##
## These variables control how dialogue is displayed on the screen one line at a
## time.

## The height of the textbox containing dialogue.
define gui.textbox_height = 260


## The placement of the textbox vertically on the screen. 0.0 is the top, 0.5 is
## center, and 1.0 is the bottom.
define gui.textbox_yalign = 0.95

#My Additions
define gui.textbox_borders = Borders(64, 71, 64, 71, 20, 20, 20, 20)
define gui.textbox_margin = (20, 20, 244, 20)
define gui.textbox_yminimum = 200
So putting that in there...doesn't actually do anything. The textbox isn't stretching they way I imagined a frame with borders would do. Is that functionality no longer a thing in the new GUI?

Anyone have any input on this conundrum?
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Window Frame/Text Alignment issue

#3 Post by trooper6 »

Hey all, in case anyone is wondering, I solved the issue after finding this post: viewtopic.php?p=457477#p457477
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Kocker, UltraRik