Method: MiniGL::Button#set_position

Defined in:
lib/minigl/forms.rb

#set_position(x, y) ⇒ Object

Sets the position of the button in the screen.

Parameters:

x

The new x-coordinate for the button.

y

The new y-coordinate for the button.



205
206
207
208
209
210
211
# File 'lib/minigl/forms.rb', line 205

def set_position(x, y)
  if @center_x; @text_x = x + @w / 2
  else; @text_x += x - @x; end
  if @center_y; @text_y = y + @h / 2
  else; @text_y += y - @y; end
  @x = x; @y = y
end