Skewing Text (solved)

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
SinnyROM
Regular
Posts: 166
Joined: Mon Jul 08, 2013 12:25 am
Projects: Blue Birth
Organization: Cosmic Static Games
Contact:

Skewing Text (solved)

#1 Post by SinnyROM » Sun Mar 30, 2014 1:30 pm

Hello, I would like to know if there is a good way to transform text, such as skewing. I attached a mockup I made of the effect I want: for the digits to line up with the surface of the watch.

The following is code for my screen so far, with time_h and time_m being hour and minute variables respectively.

Code: Select all

screen time_display:
    zorder 10
    window:
        background "ui/watch.png"
        xpos 1050 ypos 700 xmargin 75 ymargin 75
        hbox:
            xalign 0.0 yalign 0.0
            text "[time_h]:[time_m]" size 64 color "#ffcc00" font "ui/fonts/Let's go Digital Regular.ttf"
Is this possible with Ren'Py/Python? Would I need to convert the text to a displayable, and if so how would I go about doing that?
Any suggestions are appreciated.
Attachments
watch_mockup.png
Watch mockup, desired effect
watch_mockup.png (48.52 KiB) Viewed 1071 times
Last edited by SinnyROM on Sun Mar 30, 2014 6:57 pm, edited 1 time in total.

User avatar
PyTom
Ren'Py Creator
Posts: 15893
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: Skewing Text

#2 Post by PyTom » Sun Mar 30, 2014 3:28 pm

We don't support this yet. We support scaling, rotation, and translation, but we don't support arbitrary skewing. You should see if you can get buy with just those three operations - I think you might be close.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Skewing Text

#3 Post by Asceai » Sun Mar 30, 2014 3:35 pm

You'd probably be best off just creating images for each (pre-skewed)) digit and drawing then in the correct positions, rather than trying to do this with text.

User avatar
SinnyROM
Regular
Posts: 166
Joined: Mon Jul 08, 2013 12:25 am
Projects: Blue Birth
Organization: Cosmic Static Games
Contact:

Re: Skewing Text

#4 Post by SinnyROM » Sun Mar 30, 2014 5:37 pm

Thanks guys. I think I'll just make do with the rotation. However, I'm now stuck on how to proceed. I've made a displayable in the following code with the properties rotate=45, but the angle remains the same:

Code: Select all

# Time
    $ time_h = "10"
    $ time_m = "55"
    $ time_h_m = Text("[time_h]:[time_m]", None, None, None, None, rotate=45)
In my screen code, it's mainly unchanged except for the text line changed to image:

Code: Select all

screen time_display:
    zorder 10
    window:
        background "ui/watch.png"
        xpos 1050 ypos 700 xmargin 75 ymargin 75
        hbox:
            xalign 0.0 yalign 0.0
            image time_h_m

User avatar
Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: Skewing Text

#5 Post by Asceai » Sun Mar 30, 2014 5:52 pm

$ time_h_m = At(Text("[time_h]:[time_m]", None, None, None, None), Transform(rotate=45))

User avatar
SinnyROM
Regular
Posts: 166
Joined: Mon Jul 08, 2013 12:25 am
Projects: Blue Birth
Organization: Cosmic Static Games
Contact:

Re: Skewing Text

#6 Post by SinnyROM » Sun Mar 30, 2014 6:48 pm

Asceai wrote:$ time_h_m = At(Text("[time_h]:[time_m]", None, None, None, None), Transform(rotate=45))
Ah, this did the trick. I'll have to look into initiating my variables more properly in the future. Thanks again!

Edit:
In case anyone is interested in how to transform text and with a style applied, here is my code for reference.

Code: Select all

# Time
    $ time_h = "10"
    $ time_m = "55"
    $ time_h_m_d = At( Text("[time_h]:[time_m]", None, None, None, None, style="time_display_style"), Transform(rotate=13, yzoom=1.5) )

Code: Select all

style time_display_style:
    size 64
    color "#ffcc00"
    font "ui/fonts/Let's go Digital Regular.ttf"
screen time_display:
    zorder 10
    window:
        background "ui/watch.png"
        xpos 1050 ypos 700 xmargin 75 ymargin 75
        hbox:
            xalign 0.0 yalign 0.0
            image time_h_m

User avatar
PyTom
Ren'Py Creator
Posts: 15893
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: Skewing Text (solved)

#7 Post by PyTom » Mon Mar 31, 2014 1:30 pm

Code: Select all

At(Text("[time_h]:[time_m]"), Transform(rotate=45)
Should work, too. You don't need to give it all those Nones.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: Ocelot