Page 14 of 17

Re: Gspöt - retained GUI lib

Posted: Sun Feb 24, 2019 5:34 am
by Karasuro
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.

Re: Gspöt - retained GUI lib

Posted: Sun Feb 24, 2019 11:56 am
by pgimeno
Thanks. I forgot, you also need to override cameraGUI.getmouse() like this:

Code: Select all

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

Re: Gspöt - retained GUI lib

Posted: Sun Feb 24, 2019 4:57 pm
by Karasuro
That worked! Thanks for the help.

Re: Gspöt - retained GUI lib

Posted: Mon Feb 25, 2019 3:16 pm
by pgimeno
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.

Re: Gspöt - retained GUI lib

Posted: Tue Feb 26, 2019 5:42 pm
by Karasuro
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!

Re: Gspöt - retained GUI lib

Posted: Sat May 18, 2019 12:46 pm
by Santvarg
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?

Re: Gspöt - retained GUI lib

Posted: Thu May 30, 2019 10:34 am
by pgimeno
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

Re: Gspöt - retained GUI lib

Posted: Thu May 30, 2019 2:54 pm
by pgimeno
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

Re: Gspöt - retained GUI lib

Posted: Thu May 30, 2019 9:37 pm
by Santvarg
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

Re: Gspöt - retained GUI lib

Posted: Fri Jun 07, 2019 3:13 pm
by Jack Dandy
Quick question: Is there a way to change an IMAGE'S color values?