image.lua 638 B

12345678910111213141516171819202122232425262728
  1. -- IMAGE OBJECT
  2. goo.image = class('goo image', goo.object)
  3. function goo.image:initialize( parent )
  4. super.initialize(self,parent)
  5. self.image = nil
  6. self.rotation = 0
  7. end
  8. function goo.image:updateBounds(x,y)
  9. end
  10. function goo.image:setImage( image )
  11. self.image = image
  12. end
  13. function goo.image:getImage()
  14. return self.image
  15. end
  16. function goo.image:loadImage( imagename )
  17. self.image = love.graphics.newImage( imagename )
  18. end
  19. function goo.image:draw( x, y )
  20. if self.image then
  21. self:setColor( self.style.imageTint )
  22. love.graphics.draw( self.image, x, y, self.rotation )
  23. end
  24. end
  25. goo.image:getterSetter( 'rotation', 0 )
  26. return goo.image