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
- #draw ⇒ Object
- #screen_height ⇒ Object
- #screen_width ⇒ Object
- #screen_x ⇒ Object
- #screen_y ⇒ Object
- #setup_trait(options) ⇒ Object
Instance Method Details
#draw ⇒ Object
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_height ⇒ Object
43 44 45 |
# File 'lib/chingu/traits/retrofy.rb', line 43 def screen_height (@image.heigt * self.factor).to_i end |
#screen_width ⇒ Object
39 40 41 |
# File 'lib/chingu/traits/retrofy.rb', line 39 def screen_width (@image.width * self.factor).to_i end |
#screen_x ⇒ Object
47 48 49 |
# File 'lib/chingu/traits/retrofy.rb', line 47 def screen_x (@x * self.factor).to_i end |
#screen_y ⇒ Object
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() @retrofy_options = {:debug => false}.merge() super end |