## Gspöt - retained GUI lib

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

### Re: Gspöt - retained GUI lib

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

pgimeno
Party member
Posts: 2033
Joined: Sun Oct 18, 2015 2:58 pm

### Re: Gspöt - retained GUI lib

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

Code: Select all

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


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

### Re: Gspöt - retained GUI lib

That worked! Thanks for the help.

pgimeno
Party member
Posts: 2033
Joined: Sun Oct 18, 2015 2:58 pm

### Re: Gspöt - retained GUI lib

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.

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

### Re: Gspöt - retained GUI lib

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

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?

pgimeno
Party member
Posts: 2033
Joined: Sun Oct 18, 2015 2:58 pm

### Re: Gspöt - retained GUI lib

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


pgimeno
Party member
Posts: 2033
Joined: Sun Oct 18, 2015 2:58 pm

### Re: Gspöt - retained GUI lib

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

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

Jack Dandy
Prole
Posts: 49
Joined: Mon Sep 08, 2014 4:26 pm

### Re: Gspöt - retained GUI lib

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

### Who is online

Users browsing this forum: No registered users and 12 guests