Gspöt - retained GUI lib

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Karasuro
Prole
Posts: 16
Joined: Wed Aug 21, 2013 5:32 am

Re: Gspöt - retained GUI lib

Post by Karasuro » Sun Feb 24, 2019 5:34 am

I'm still having an issue of the cameraGui not registering clicks, so! I'm gonna attach a little archive here. There's a readme within the .love to help you find the files I'm working with.
Attachments
PROJECT DEV BUILD_022419.love
(1.47 MiB) Downloaded 154 times

User avatar
pgimeno
Party member
Posts: 1686
Joined: Sun Oct 18, 2015 2:58 pm

Re: Gspöt - retained GUI lib

Post by pgimeno » Sun Feb 24, 2019 11:56 am

Thanks. I forgot, you also need to override cameraGUI.getmouse() like this:

Code: Select all

function cameraGUI.getmouse(this)
    return camera.view:mousePosition()
end

User avatar
Karasuro
Prole
Posts: 16
Joined: Wed Aug 21, 2013 5:32 am

Re: Gspöt - retained GUI lib

Post by Karasuro » Sun Feb 24, 2019 4:57 pm

That worked! Thanks for the help.

User avatar
pgimeno
Party member
Posts: 1686
Joined: Sun Oct 18, 2015 2:58 pm

Re: Gspöt - retained GUI lib

Post by pgimeno » Mon Feb 25, 2019 3:16 pm

Karasuro wrote:
Sun Feb 24, 2019 4:57 pm
That worked! Thanks for the help.
Thank you too for your question. Thanks to it, I noticed that I should have used this.getmouse() instead of love.mouse.getPosition() in the wheel event, and pushed a fix. Please update if you plan to allow wheel events in the GUI that moves with the camera.

User avatar
Karasuro
Prole
Posts: 16
Joined: Wed Aug 21, 2013 5:32 am

Re: Gspöt - retained GUI lib

Post by Karasuro » Tue Feb 26, 2019 5:42 pm

pgimeno wrote:
Mon Feb 25, 2019 3:16 pm
Thank you too for your question. Thanks to it, I noticed that I should have used this.getmouse() instead of love.mouse.getPosition() in the wheel event, and pushed a fix. Please update if you plan to allow wheel events in the GUI that moves with the camera.
Will do! The project I'm working on is for mobile platform so I'll have to experiment with pinch zooming. If I notice any issues doing that, I'll be back!

Santvarg
Prole
Posts: 7
Joined: Sat May 18, 2019 12:42 pm

Re: Gspöt - retained GUI lib

Post by Santvarg » Sat May 18, 2019 12:46 pm

I'm having a similar problem with Camera, but I'm not using a library for my camera, i'm just using

Code: Select all

function camera:set()
  love.graphics.push()
  love.graphics.rotate(-self.rotation)
  love.graphics.scale(1 / self.scaleX, 1 / self.scaleY)
  love.graphics.translate(-self.x, -self.y)
end
function camera:unset()
  love.graphics.pop()
end
Just like that, I have my draw function within this to have it attached to the world, and out of it to not move at all from the user's standpoint
Aside from rewriting a bunch of code to fit a library, is there a way i can solve this problem?

User avatar
pgimeno
Party member
Posts: 1686
Joined: Sun Oct 18, 2015 2:58 pm

Re: Gspöt - retained GUI lib

Post by pgimeno » Thu May 30, 2019 10:34 am

I can't tell without the code, but it's probably enough to redefine GUI.getmouse() like this:

Code: Select all

function GUI.getmouse(this)
  love.graphics.push()
  love.graphics.origin()
  camera:set()
  local x, y = love.graphics.inverseTransformPoint(love.mouse.getPosition())
  camera:unset()
  love.graphics.pop()
  return x, y
end

User avatar
pgimeno
Party member
Posts: 1686
Joined: Sun Oct 18, 2015 2:58 pm

Re: Gspöt - retained GUI lib

Post by pgimeno » Thu May 30, 2019 2:54 pm

Hm, that's probably not enough. Try also this:

Code: Select all

function love.mousepressed(x, y, button)
  x, y = GUI.getmouse()
  GUI:mousepress(x, y, button)
end

Santvarg
Prole
Posts: 7
Joined: Sat May 18, 2019 12:42 pm

Re: Gspöt - retained GUI lib

Post by Santvarg » Thu May 30, 2019 9:37 pm

Oh! i didnt know i can redefine the built in functions, never thought about that lol
I can get you a pastebin of everything as of now but it's a bit messy and not annotated xD

I'll try that when I can get back to it

User avatar
Jack Dandy
Prole
Posts: 47
Joined: Mon Sep 08, 2014 4:26 pm

Re: Gspöt - retained GUI lib

Post by Jack Dandy » Fri Jun 07, 2019 3:13 pm

Quick question: Is there a way to change an IMAGE'S color values?

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 6 guests