How to Draw a rectangle with rounded border

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
Benny
Newbie
Posts: 17
Joined: Sun Jul 30, 2017 11:10 am
Contact:

How to Draw a rectangle with rounded border

#1 Post by Benny »

Hi,

is it possible in renpy to draw a rectangle with rounded border?
I found this function to draw a solid image but there isn't any parameter for the corner:

Code: Select all

Frame(Solid("#E75282"), 0, 0)
Thanks
Benny

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How to Draw a rectangle with rounded border

#2 Post by kivik »

You'll have to create an image for this I'm afraid, follow the Frame() displayable's example to set your left, right, top, bottom parameters accordingly.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: How to Draw a rectangle with rounded border

#3 Post by Remix »

As kivik says, it will generally be best to actually design a stretchable/scalable frame background and use that...

So saying, during the development interim you could spoof it by using a DejaVuSans character (a font that ships with Ren'py by default)

Code: Select all

screen round_rect():

    frame:

        area (50,50,450,250)

        background Frame(
            Text( "\u25A2", #### <--- this is a small rounded rectangle character
                  color="#64A", 
                  font="DejaVuSans.ttf", 
                  size=72, 
                  outlines=[(2, "#FFF", 0, 0)]), 
            32, 32, 
            tile=True)

        text "Hi" pos (50,50)


label start:

    show screen round_rect
    "..."
Alternate code that might be usable:
\u25CF = black circle - you'd need to adjust the 32,32 to hit centre though.
Any character map viewer can yield more options
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], piinkpuddiin