Page 1 of 1

vbox correction problem

Posted: Tue Jun 08, 2021 1:15 am
by Psion
So i am trying to teach myself coding by taking others code and implementing it in my project.
I took code to count days\time and copied it in my project. It worked fine but looked much worse.
It has blue lines when i hover mouse and dark lines when i'm not. Also they in the middle of the screen and not moving even after i change xalign
Can you tell me why it so and how can i fix it? Or where can i read about it?

Code: Select all

screen dayinfo:
    zorder 4
    if dn > 24:
        $ dn = 0
    if dn > 0 and dn < 5:
        $ daytime = _("MORNING")
        $ daytimejump = 5
    elif dn > 4 and dn < 10:
        $ daytime = _("AFTERNOON")
        $ daytimejump = 10
    elif dn > 9 and dn < 16:
        $ daytime = _("EVENING")
        $ daytimejump = 16
    elif dn > 16:
        $ daytime = _("NIGHT")
    $ dn_show = dn + 7
    if dn_show > 23:
        $ dn_show = dn - 17
    vbox:
        xalign 0.01
        yalign 0.01
        hbox:
            textbutton _("DAY"):
                text_color "#eddbc3"
                text_size 40
                style style.choice_button
                text_hover_outlines [(3, "#cc0000", 0, 0)]
                text_idle_outlines [(3, "#111111", 0, 0)]
                text_font "font/foo_regular.ttf"
                action If (block_day_button, SetVariable("dn", 0), Jump("start"))
            null width 2
            text str(daynum):
                size 40
                outlines [(3, "#222222", 0, 0)]
                font "font/foo_regular.ttf"

        null height -10
        textbutton str(daytime):
            xalign 0.1

            text_size 25
            style style.choice_button
            text_hover_outlines [(3, "#cc0000", 0, 0)]
            text_idle_outlines [(3, "#111111", 0, 0)]
            text_font "font/foo_regular.ttf"
            action If (block_day_button,None,(If(dn < 16, SetVariable("dn", daytimejump), Jump(start)), None))
        null height -10
        textbutton "[dn_show]:00":
            xalign 0.1

            text_size 25
            style style.choice_button
            text_hover_outlines [(3, "#cc0000", 0, 0)]
            text_idle_outlines [(3, "#111111", 0, 0)]
            text_font "font/foo_regular.ttf"
            action If (block_day_button,None,(If (dn<20, SetVariable("dn", dn + 1), Jump(start)), None))

Re: vbox correction problem

Posted: Thu Jun 10, 2021 9:23 am
by zmook
The lines `style style.choice_button` are your problem. That tell's renpy to use the choice_button style for those textbuttons, and choice_button is defined by default in gui.rpy to be centered on the screen with a long horizontal background bar. It's the default style used by choices from the menu statement.

The game you took this code from had redefined the style, somewhere.

Re: vbox correction problem

Posted: Thu Jun 10, 2021 2:31 pm
by Psion
I suspected it has something to do with style stuff...
So i found this code:

Code: Select all

define gui.choice_button_width = None
define gui.choice_button_height = None
define gui.choice_button_tile = False
define gui.choice_button_borders = Borders(0, 0, 0, 0)
define gui.choice_button_text_font = "font/Oswald-SemiBold.ttf"
define gui.choice_button_text_size = 50
define gui.choice_button_text_xalign = 0.5
define gui.choice_button_text_idle_color = "#ffffff"
define gui.choice_button_text_hover_color = "#ffffff"
define gui.choice_button_text_idle_outlines = [(4, "#111111", 0, 0)]
define gui.choice_button_text_hover_outlines = [(4, "#d94c3a", 0, 0)]
adding it fixed most of problems. Now i know where to dig, thank you very much. :)
There still some borders and blue collour though :\