/ld27

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

« back to all changes in this revision

Viewing changes to zoetrope/sprites/text.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

166
166
                if self.flipY then scaleY = scaleY * -1 end
167
167
 
168
168
                if scaleX ~= 1 or scaleY ~= 1 or self.rotation ~= 0 then
 
169
                        local origX = self.origin.x or (self.width / 2)
 
170
                        local origY = self.origin.y or (self.height / 2)
 
171
 
169
172
                        love.graphics.push()
170
 
                        love.graphics.translate(x + self.width / 2, y + self.height / 2)
 
173
                        love.graphics.translate(x + origX, y + origY)
171
174
                        love.graphics.scale(scaleX, scaleY)
172
175
                        love.graphics.rotate(self.rotation)
173
 
                        love.graphics.translate(- (x + self.width / 2), - (y + self.height / 2))
 
176
                        love.graphics.translate(- (x + origX), - (y + origY))
174
177
                end
175
178
 
176
179
                -- set color if needed
199
202
        end,
200
203
 
201
204
        __tostring = function (self)
202
 
                local result = 'Text (x: ' .. self.x .. ', y: ' .. self.y ..
203
 
                                           ', w: ' .. self.width .. ', h: ' .. self.height .. ', '
 
205
                local result = 'Text (x: ' .. tostring(self.x) .. ', y: ' .. tostring(self.y) ..
 
206
                                           ', w: ' .. tostring(self.width) .. ', h: ' .. tostring(self.height) .. ', '
204
207
 
205
208
                result = result .. 'font ' .. dump(self.font) .. ', ' .. string.len(self.text) .. ' chars, '
206
209