/ld27

To get this branch, use:
bzr branch /bzr/ld27

« back to all changes in this revision

Viewing changes to zoetrope/sprites/fill.lua

  • Committer: Josh C
  • Date: 2014-07-03 14:41:57 UTC
  • Revision ID: josh@9ix.org-20140703144157-xydxt62xzcdq6bdk
cluke009 zoetrope + my spritebatch changes

Show diffs side-by-side

added added

removed removed

37
37
                local scaleY = self.scale * self.distort.y
38
38
 
39
39
                if scaleX ~= 1 or scaleY ~= 1 or self.rotation ~= 0 then
 
40
                        local origX = self.origin.x or (self.width / 2)
 
41
                        local origY = self.origin.y or (self.height / 2)
 
42
 
40
43
                        love.graphics.push()
41
 
                        love.graphics.translate(x + self.width / 2, y + self.height / 2)
 
44
                        love.graphics.translate(x + origX, y + origY)
42
45
                        love.graphics.scale(scaleX, scaleY)
43
46
                        love.graphics.rotate(self.rotation)
44
 
                        love.graphics.translate(- (x + self.width / 2), - (y + self.height / 2))
 
47
                        love.graphics.translate(- (x + origX), - (y + origY))
45
48
                end
46
49
                
47
50
                -- draw fill and border
78
81
        end,
79
82
 
80
83
        __tostring = function (self)
81
 
                local result = 'Fill (x: ' .. self.x .. ', y: ' .. self.y ..
82
 
                                           ', w: ' .. self.width .. ', h: ' .. self.height .. ', '
 
84
                local result = 'Fill (x: ' .. tostring(self.x) .. ', y: ' .. tostring(self.y) ..
 
85
                                           ', w: ' .. tostring(self.width) .. ', h: ' .. tostring(self.height) .. ', '
83
86
 
84
87
                if self.fill then
85
88
                        result = result .. 'fill {' .. table.concat(self.fill, ', ') .. '}, '