lovebrew / lovepotion

LÖVE for Nintendo Homebrew
https://lovebrew.org
Other
574 stars 45 forks source link

[Bug]: transformPoint and inverseTransformPoint not working #238

Open STBrian opened 4 months ago

STBrian commented 4 months ago

Software Version

3.0.1

What Happened?

love.graphics.inverseTransformPoint and love.graphics.transformPoint do not work as expected. After performing the transformations using (in my case) love.graphics.translate, using the previous 2 functions results in both returning (0, 0) in any case.

What was Expected?

Functions should return coordinates with current transformations applied

Code to Reproduce

-- This should draw a rectangle at screen position 100, 100 even after setting a coordinates translation

function love.load(args)
    cameraX = 0
    cameraVel = 100
end

function love.update(dt)
    cameraX = cameraX - (cameraVel * dt)
end

function love.gamepadpressed(joystick, button)
    if button == "start" then
        love.event.quit()
    end
end

function love.draw(screen)
    love.graphics.push()
    love.graphics.origin()
    love.graphics.translate(cameraX, 0)
    if screen ~= "bottom" then
        local x, y
        x, y = love.graphics.inverseTransformPoint(100, 100)
        love.graphics.rectangle("fill", x, y, 100, 50)
    end
    love.graphics.pop()
end

Console

Nintendo 3DS

Firmware Version(s)

11.17.0-50U

Custom Firmware Version

13.1.2

Execution Method

Homebrew Menu

Code of Conduct