Class: Gosu::Image
- Inherits:
-
Object
- Object
- Gosu::Image
- Includes:
- Chingu::NamedResource
- Defined in:
- lib/chingu/assets.rb,
lib/chingu/gosu_ext/image.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#retrofy ⇒ Object
Retrofy should be called just after the image is loaded.
-
#transparent_pixel?(x, y) ⇒ Boolean
Returns true if the pixel at x, y is 100% transperant (good for collisiondetection) Requires texplay.
Methods included from Chingu::NamedResource
Class Method Details
Instance Method Details
#retrofy ⇒ Object
Retrofy should be called just after the image is loaded. When retrofied an image will use a non-blurry zoom. This could be used to make each pixel a sharp 4 pixelblock => retrofeeling.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/chingu/gosu_ext/image.rb', line 45 def retrofy Gosu::enable_undocumented_retrofication self # # The below code depends on the bad opengl gem # And it could affect other images anyhow... # So let's use Gosu::enable_undocumented_retrofication until further notice. # #glBindTexture(GL_TEXTURE_2D, self.gl_tex_info.tex_name) #glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST) #glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST) #self end |
#transparent_pixel?(x, y) ⇒ Boolean
Returns true if the pixel at x, y is 100% transperant (good for collisiondetection) Requires texplay
32 33 34 35 36 37 38 |
# File 'lib/chingu/gosu_ext/image.rb', line 32 def transparent_pixel?(x, y) begin self.get_pixel(x,y)[3] == 0 rescue puts "Error in get_pixel at x/y: #{x}/#{y}: #{$!}" end end |