Arcs unimplemented? (geometry)

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
ApolloM
Newbie
Posts: 1
Joined: Fri May 08, 2020 8:37 pm
Contact:

Arcs unimplemented? (geometry)

#1 Post by ApolloM »

Hi all. I'm trying to create a pie chart. I started by following the Creator-Defined Displayables example and managed to get a circle drawn to the screen with a custom displayable using canvas.circle(...). Then I tried canvas.arc(...), but I get an exception that says error: Not Implemented. Is there no way to draw arcs right now?

Here's my code snippet:

Code: Select all

init python:

    import math

    class PieChart(renpy.Displayable):

        def __init__(self, **kwargs):
            super(PieChart, self).__init__(**kwargs)

        def render(self, width, height, st, at):
            render = renpy.Render(width, height)
            canvas = render.canvas()
            horizontal = width / 2
            vertical = height / 2
            radius = vertical
            if horizontal < vertical:
                radius = horizontal
            # canvas.circle("#FFFFFF", (horizontal, vertical), radius)
            canvas.arc("#FFFFFF", [radius, radius], 0.0, 1.0)
            return render
The linked documentation says "A canvas object has methods corresponding to the pygame.draw functions", and links to here, where there is an arc function.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Arcs unimplemented? (geometry)

#2 Post by Per K Grok »

ApolloM wrote: Fri May 08, 2020 8:41 pm Hi all. I'm trying to create a pie chart. I started by following the Creator-Defined Displayables example and managed to get a circle drawn to the screen with a custom displayable using canvas.circle(...). Then I tried canvas.arc(...), but I get an exception that says error: Not Implemented. Is there no way to draw arcs right now?

Here's my code snippet:

Code: Select all

init python:

    import math

    class PieChart(renpy.Displayable):

        def __init__(self, **kwargs):
            super(PieChart, self).__init__(**kwargs)

        def render(self, width, height, st, at):
            render = renpy.Render(width, height)
            canvas = render.canvas()
            horizontal = width / 2
            vertical = height / 2
            radius = vertical
            if horizontal < vertical:
                radius = horizontal
            # canvas.circle("#FFFFFF", (horizontal, vertical), radius)
            canvas.arc("#FFFFFF", [radius, radius], 0.0, 1.0)
            return render
The linked documentation says "A canvas object has methods corresponding to the pygame.draw functions", and links to here, where there is an arc function.
I have previously drawn lines in a ren'py game (for a ray gun effect). I then imported pygame and used pygame.draw.line on a surface. I now tested doing pygame.draw.arc in the same way, but I too got an 'not implemented' error.
pygame.draw.arc does however work when I do it outside ren'py with only pygame and python.

I don't know why it didn't work in ren'py.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], dragondatingsim, Google [Bot], Ocelot