Tic-80: Add mousep()

Created on 22 Feb 2018  路  2Comments  路  Source: nesbox/TIC-80

I wish a mousep() function like keyp() and btnp()

API discussion

Most helpful comment

I think nesbox is trying to keep the api as clean as possible. There are a few simple ways to do this yourself though. mouse() also returns x and y coords so mousep would have to return just the click?

function TIC()
    mouse_x, mouse_y, mouse_pressed = mouse()

    --game loop here

    last_pressed = mouse_pressed
end

function mousep()
    return mouse_pressed and not last_pressed
end

All 2 comments

I think nesbox is trying to keep the api as clean as possible. There are a few simple ways to do this yourself though. mouse() also returns x and y coords so mousep would have to return just the click?

function TIC()
    mouse_x, mouse_y, mouse_pressed = mouse()

    --game loop here

    last_pressed = mouse_pressed
end

function mousep()
    return mouse_pressed and not last_pressed
end

wontfix, sorry

Was this page helpful?
0 / 5 - 0 ratings