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?
PUSH and URUTORA libraries together
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
PUSH and URUTORA libraries together
- Attachments
-
- example.love
- (9.26 KiB) Downloaded 149 times
Re: PUSH and URUTORA libraries together
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:
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
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
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
Re: PUSH and URUTORA libraries together
EDIT: never mind.
- Gunroar:Cannon()
- Party member
- Posts: 1141
- Joined: Thu Dec 10, 2020 1:57 am
Re: PUSH and URUTORA libraries together
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)
Who is online
Users browsing this forum: Google [Bot] and 4 guests