Module: Chingu::Traits::Retrofy

Defined in:
lib/chingu/traits/retrofy.rb

Overview

A chingu trait providing easier handling of the “retrofy” effect (non-blurry zoom) Aims to help out when using zoom-factor to create a retrofeeling with big pixels. Provides screen_x and screen_y which takes the zoom into account Also provides new code for draw() which uses screen_x / screen_y instead of x / y

Instance Method Summary collapse

Instance Method Details

#drawObject



55
56
57
# File 'lib/chingu/traits/retrofy.rb', line 55

def draw
  @image.draw_rot(self.screen_x, self.screen_y, @zorder, @angle, @center_x, @center_y, @factor_x, @factor_y, @color, @mode)
end

#screen_heightObject



43
44
45
# File 'lib/chingu/traits/retrofy.rb', line 43

def screen_height
  (@image.heigt * self.factor).to_i
end

#screen_widthObject



39
40
41
# File 'lib/chingu/traits/retrofy.rb', line 39

def screen_width
  (@image.width * self.factor).to_i
end

#screen_xObject



47
48
49
# File 'lib/chingu/traits/retrofy.rb', line 47

def screen_x
  (@x * self.factor).to_i
end

#screen_yObject



51
52
53
# File 'lib/chingu/traits/retrofy.rb', line 51

def screen_y
  (@y * self.factor).to_i
end

#setup_trait(options) ⇒ Object



33
34
35
36
37
# File 'lib/chingu/traits/retrofy.rb', line 33

def setup_trait(options)
  @retrofy_options = {:debug => false}.merge(options)        

  super
end