runnerpack edited this page Nov 13, 2014 · 12 revisions
Clone this wiki locally

TODO and completed features


  • #to_opengl - Converts to [1.0, 1.0, 1.0, 1.0] rgba format (as used, by default, by OpenGL).
  • .from_opengl - Creates new Color object from [1.0, 1.0, 1.0, 1.0] rgba format (as used by OpenGL).
  • #to_i - converts Color object into Gosu integer: 0xAARRGGBB


  • #draw - Added :shader hash option to choose optional shader to use.
  • #draw_rot - Added :shader hash option to choose optional shader to use.
  • #draw_as_points - Draw many, identical-looking sprites at a series of (x, y) coordinates.
  • #to_texture


  • #primary_buffer and #secondary_buffer - Window-sized framebuffers for general use; used by post-processing system, but you can use them temporarily, if required (but make sure you #clear them before use).
  • #post_process {} - Apply one or more shaders to the contents of the block, after they have been drawn.
  • [TODO] #to_framebuffer - Copy the contents of the window as an {Ashton::Framebuffer}.
  • [TODO] #to_image - Create a Gosu::Image from a window's contents.
  • [TODO] #draw_line - Added :shader hash option
  • [TODO] #draw_quad - Added :shader hash option
  • [TODO] #draw_triangle - Added :shader hash option


  • Wrapper around a GLSL shader program, which allows for complex, real-time, graphical manipulations.
  • #enable {} - Inside the block, all draw operations are affected by the shader (Generally better to use Window#post_process or Image.draw* for this). Can use #enable/#disable if not using a block.
  • Supports vertex and fragment shaders. Geometry shaders would require OpenGL at a higher level.
  • Includes a small library of example shaders, which can be used either to affect individual draw actions or to post-process the whole screen (:radial_blur, :pixelate, etc).


  • A source of illumination with radius and color. Generally easiest to use as part of a Lighting::Manager


  • Manages one or more LightSource objects and merges them to create a screen-sized lighting effect.
  • #create_light Creates a new light-source.


A relatively low-level graphics buffer that can be drawn upon and drawn onto the Window. Can be used as a general replacement for Gosu::Image.

Advantages over Gosu::Image

  • Size is not limited to 1022x1022, but to the maximum size supported by the graphics card.
  • Can be rendered to, directly (TexPlay's Window#render_to_image also does this, but that is slower and limited to the smaller of 1022x1022 and the size of the window, as well as not handling transparency properly).
  • Can be duplicated (TexPlay's Image#dup also did this, but was much slower).
  • Can draw in :replace mode (As well as the standard :alpha_blend, :add and :multiply modes). This replaces the existing pixels (including the alpha channel) with those in the Texture, without any sort of blending.

Disadvantages over Gosu::Image

  • Drawing with it is slower, so don't use an Ashton::Texture when a Gosu::Image will suffice.
  • Can't use the TexPlay primitive drawing operations on it, like Image#circle and Image#set_pixel (although you can draw directly onto the Texture with #render – with or without a shader – to replicate any of those effects much more quickly).


  • #render {} - Inside the block, draw operations go into the Texture, via a framebuffer, rather than onto the window.
  • #to_image - Convert to Gosu::Image.
  • #draw - Draw directly onto a Gosu::Window (Only accepts x, y, z with :shader, :mode options).
  • #clear
  • #[x, y] - Get Gosu::Color of a specific pixel. Much faster than the TexPlay equivalent.
  • #transparent?(x, y) - true if the pixel at that point has alpha == 0 (useful for pixel-based collision). VERY FAST!


  • Generates and managed particles with acceleration, gravity, velocity, angular velocity, direction, image, color, etc.
  • Particle velocity affected by acceleration and gravity, fade (affects alpha) and zoom (affects scale).
  • [TODO] Changes rgb color over time.
  • [TODO] Animate images.