Class: Gosu::Image
- Inherits:
-
Object
- Object
- Gosu::Image
- Includes:
- Chingu::NamedResource
- Defined in:
- lib/chingu/assets.rb,
lib/chingu/core_extensions.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.
47 48 49 50 51 52 |
# File 'lib/chingu/core_extensions.rb', line 47 def retrofy 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
34 35 36 37 38 39 40 |
# File 'lib/chingu/core_extensions.rb', line 34 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 |