/ld27

To get this branch, use:
bzr branch http://9ix.org/bzr/ld27

« back to all changes in this revision

Viewing changes to zoetrope/core/group.lua

  • Committer: Josh C
  • Date: 2014-07-03 14:43:25 UTC
  • Revision ID: josh@9ix.org-20140703144325-799ow43au3uimguy
zoetrope scaling patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
        -- sprites at their normal position, set both x and y to 1.
51
51
        translateScale = { x = 1, y = 1 },
52
52
 
 
53
  -- an actual love.graphics.translate call
 
54
  realTranslate = { x = 0, y = 0 },
 
55
 
53
56
        -- Property: scale
54
57
        -- Zooms in or out all drawing operations in the group, centering them with
55
58
        -- respect to the <origin> property.
534
537
        --              x - x offset in pixels
535
538
        --              y - y offset in pixels
536
539
 
537
 
        draw = function (self, x, y)
 
540
        draw = function (self, x, y, yield)
538
541
                if not self.visible then return end
539
542
                x = x or self.translate.x
540
543
                y = y or self.translate.y
543
546
                local scrollY = y * self.translateScale.y
544
547
                local appWidth = the.app.width
545
548
                local appHeight = the.app.height
546
 
                local scaled = self.scale ~= 1 or self.distort.x ~= 1 or self.distort.y ~= 1
 
549
                local scaled = self.scale ~= 1 or self.distort.x ~= 1 or self.distort.y ~= 1 or self.realTranslate.x ~= 0 or self.realTranslate.y ~= 0
547
550
 
548
551
                if self.effect then
549
552
                        if self.effectType == 'screen' then
560
563
                        local scaleY = self.scale * self.distort.y
561
564
 
562
565
                        love.graphics.push()
 
566
 
 
567
      love.graphics.translate(self.realTranslate.x, self.realTranslate.y)
 
568
 
563
569
                        love.graphics.translate(self.origin.x, self.origin.y)
564
570
                        love.graphics.scale(scaleX, scaleY)
565
571
                        love.graphics.translate(- self.origin.x, - self.origin.y)
583
589
                        end
584
590
                end
585
591
 
 
592
    if yield then yield(self, x, y) end
 
593
 
586
594
                if scaled then
587
595
                        love.graphics.pop()
588
596
                end