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

      color = (alpha << 24) | color
      text_color =
        if @enabled
          if @state == :down
            @down_text_color
          else
            @state == :over ? @over_text_color : @text_color
          end
        else
          @disabled_text_color
        end
      text_color = (alpha << 24) | text_color
      @img[@img_index].draw @x, @y, z_index, @scale_x, @scale_y, color if @img
      if @text
        if @center_x or @center_y
          rel_x = @center_x ? 0.5 : 0
          rel_y = @center_y ? 0.5 : 0
          @font.draw_text_rel @text, @text_x, @text_y, z_index, rel_x, rel_y, @scale_x, @scale_y, text_color
        else
          @font.draw_text @text, @text_x, @text_y, z_index, @scale_x, @scale_y, text_color
        end
      end
    end
def draw(alpha = 0xff, z_index = 0, color = 0xffffff)
      return unless @visible

      color = (alpha << 24) | color
      text_color =
        if @enabled
          if @state == :down
            @down_text_color
          else
            @state == :over ? @over_text_color : @text_color
          end
        else
          @disabled_text_color
        end
      text_color = (alpha << 24) | text_color
      @img[@img_index].draw @x, @y, z_index, @scale_x, @scale_y, color if @img
      if @text
        if @center_x or @center_y
          rel_x = @center_x ? 0.5 : 0
          rel_y = @center_y ? 0.5 : 0
          @font.draw_text_rel @text, @text_x, @text_y, z_index, rel_x, rel_y, @scale_x, @scale_y, text_color
        else
          @font.draw_text @text, @text_x, @text_y, z_index, @scale_x, @scale_y, text_color
        end
      end
    end
Draws the button in the screen.

 Parameters:
 [alpha] The opacity with which the button will be drawn. Allowed values
         vary between 0 (fully transparent) and 255 (fully opaque).
 [z_index] The z-order to draw the object. Objects with larger z-orders
           will be drawn on top of the ones with smaller z-orders.
 [color] Color to apply a filter to the image.