PUSH and URUTORA libraries together

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Vynniel
Prole
Posts: 1
Joined: Tue Jan 26, 2021 1:55 pm

PUSH and URUTORA libraries together

Post by Vynniel »

I want to do a game that's basically GUI. My goal is something like Buriedbornes (a Android, iOS game).
I am currently using two libraries:
* push for resizing: https://github.com/Ulydev/push
* urgent for GUI: https://github.com/tavuntu/urutora

My problem is that as the push changes the location of objects (buttons, texts, panel, everything that is drawn in love.draw ()), the event of triggering a button for example does not happen.
But if I click in the right place (like x = 10), the button is triggered. But, the button is in another place as push changed it's location.

I tried to change the events where X and Y are sent to the urutora, like this (example):

function love.mousepressed (x, y, button)
local rx, ry = push: toGame (x, y)

u: pressed (rx, ry)
end

But no effects.

The example project is attached.

Any advice?
Attachments
example.love
(9.26 KiB) Downloaded 134 times
User avatar
GVovkiv
Party member
Posts: 668
Joined: Fri Jan 15, 2021 7:29 am

Re: PUSH and URUTORA libraries together

Post by GVovkiv »

because push change position where images draws, but not the actual position

you need keep it in mind
so if you want, for example, check button with cursor, than you can do something like this:

Code: Select all

    if xm >= (x * s) + xo and xm <= ((x + w) * s) + xo and ym >= (y * yo) and ym <= ((y + h) * s) + yo then
      return true
where:
xm and ym = cursor coordinates
s = game scale factor
xo and yo = offset of black bars
x and y = where x and y of zone which you want to check starts
w and h = width and height of zone which you want to check

so you can use x, y, width and height of your button
use x and y offset for black bars, so you need fetch it values
also you need fetch scale factor of PUSH

check PUSH documentation, maybe there explained how to get this values
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: PUSH and URUTORA libraries together

Post by pgimeno »

EDIT: never mind.
User avatar
Gunroar:Cannon()
Party member
Posts: 1088
Joined: Thu Dec 10, 2020 1:57 am

Re: PUSH and URUTORA libraries together

Post by Gunroar:Cannon() »

Vynniel wrote: Tue Jan 26, 2021 4:47 pm
function love.mousepressed (x, y, button)
local rx, ry = push: toGame (x, y)

u: pressed (rx, ry)
end
?
I think you have the right idea with push:toGame...check whether (from urutora) inside the lib, by :release(...) whether it calls love.mouse.getX()/getY() or something like that (because in tavuntu's old gooi lib he did that) :P
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
Post Reply

Who is online

Users browsing this forum: No registered users and 61 guests