lib/minigl/forms.rb
def draw(alpha = 255, z_index = 0, color = 0xffffff)
      return unless @visible

      c = (alpha << 24) | color
      if @img
        if @img.is_a?(Array)
          @img[0].draw(@x, @y, z_index, @scale_x, @scale_y, c)
          @img[1].draw(@x + @tile_w, @y, z_index, @center_scale_x, @scale_y, c) if @draw_center_x
          @img[2].draw(@x + @w - @tile_w, @y, z_index, @scale_x, @scale_y, c)
          @img[3].draw(@x, @y + @tile_h, z_index, @scale_x, @center_scale_y, c) if @draw_center_y
          @img[4].draw(@x + @tile_w, @y + @tile_h, z_index, @center_scale_x, @center_scale_y, c) if @draw_center_x && @draw_center_y
          @img[5].draw(@x + @w - @tile_w, @y + @tile_h, z_index, @scale_x, @center_scale_y, c) if @draw_center_y
          @img[6].draw(@x, @y + @h - @tile_h, z_index, @scale_x, @scale_y, c)
          @img[7].draw(@x + @tile_w, @y + @h - @tile_h, z_index, @center_scale_x, @scale_y, c) if @draw_center_x
          @img[8].draw(@x + @w - @tile_w, @y + @h - @tile_h, z_index, @scale_x, @scale_y, c)
        else
          @img.draw(@x, @y, z_index, @w.to_f / @img.width, @h.to_f / @img.height)
        end
      end

      @controls.each { |k| k.draw(alpha, z_index, color) if k.visible }
    end
def draw(alpha = 255, z_index = 0, color = 0xffffff)
      return unless @visible

      c = (alpha << 24) | color
      if @img
        if @img.is_a?(Array)
          @img[0].draw(@x, @y, z_index, @scale_x, @scale_y, c)
          @img[1].draw(@x + @tile_w, @y, z_index, @center_scale_x, @scale_y, c) if @draw_center_x
          @img[2].draw(@x + @w - @tile_w, @y, z_index, @scale_x, @scale_y, c)
          @img[3].draw(@x, @y + @tile_h, z_index, @scale_x, @center_scale_y, c) if @draw_center_y
          @img[4].draw(@x + @tile_w, @y + @tile_h, z_index, @center_scale_x, @center_scale_y, c) if @draw_center_x && @draw_center_y
          @img[5].draw(@x + @w - @tile_w, @y + @tile_h, z_index, @scale_x, @center_scale_y, c) if @draw_center_y
          @img[6].draw(@x, @y + @h - @tile_h, z_index, @scale_x, @scale_y, c)
          @img[7].draw(@x + @tile_w, @y + @h - @tile_h, z_index, @center_scale_x, @scale_y, c) if @draw_center_x
          @img[8].draw(@x + @w - @tile_w, @y + @h - @tile_h, z_index, @scale_x, @scale_y, c)
        else
          @img.draw(@x, @y, z_index, @w.to_f / @img.width, @h.to_f / @img.height)
        end
      end

      @controls.each { |k| k.draw(alpha, z_index, color) if k.visible }
    end
Draws the panel and all its child components.
 Parameters:
 [alpha] The opacity of the panel (0 = fully transparent, 255 = fully opaque).
 [z_index] The z-index to draw the panel.
 [color] The color to apply as filter to the panel image and to all child components' images as well.