Line drawing doesn't work properly

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
SusanTheCat
Miko-Class Veteran
Posts: 952
Joined: Mon Dec 13, 2010 9:30 am
Location: New Brunswick, Canada
Contact:

Line drawing doesn't work properly

#1 Post by SusanTheCat » Tue Feb 02, 2016 6:11 pm

If you try to draw a line using canvas.line going from right to left, it gets drawn in the wrong place. Very consistently in the wrong place.

Code: Select all

dot1 = (100,100) #left dot
dot2 = (200,100) #right dot

canvas.line(colour,dot2,dot1,width = 2) # right to left: won't work
canvas.line(colour,dot1,dot2,width = 2) # left to right: will work
So I made a work around:

Code: Select all

def correctedline(in_canvas,in_colour,in_point1,in_point2,in_width):
    if (in_point1[0] < in_point2[0]):
        point1 = in_point1
        point2 = in_point2
    else:
        point1 = in_point2
        point2 = in_point1
        
    in_canvas.line(in_colour,point1,point2,width = in_width)
" It's not at all important to get it right the first time. It's vitally important to get it right the last time. "
— Andrew Hunt and David Thomas

User avatar
PyTom
Ren'Py Creator
Posts: 15423
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: Line drawing doesn't work properly

#2 Post by PyTom » Wed Feb 03, 2016 1:56 am

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: No registered users