closebutton.lua 707 B

123456789101112131415161718192021222324252627
  1. -- CLOSE BUTTON
  2. goo.close = class('goo close button', goo.object)
  3. goo.close.image = {}
  4. function goo.close:initialize( parent )
  5. super.initialize(self,parent)
  6. self.w = self.image.button:getWidth()
  7. self.h = self.image.button:getHeight()
  8. end
  9. function goo.close:setSkin()
  10. goo.close.image.button = love.graphics.newImage(goo.skin..'closebutton.png')
  11. end
  12. function goo.close:enterHover()
  13. self.color = self.style.colorHover
  14. end
  15. function goo.close:exitHover()
  16. self.color = self.style.color
  17. end
  18. function goo.close:draw()
  19. self:setColor( self.color )
  20. love.graphics.draw(self.image.button,0,0)
  21. end
  22. function goo.close:mousepressed(x,y,button)
  23. if button == 'l' then self.parent:destroy() end
  24. end
  25. return goo.close