Class: Wads::Line

Inherits:
Widget show all
Defined in:
lib/wads/widgets.rb

Overview

Renders a line from x, y to x2, y2. The theme graphics elements color is used by default, unless specified using the optional parameter.

Instance Attribute Summary collapse

Attributes inherited from Widget

#base_z, #children, #gui_theme, #height, #is_selected, #layout, #overlay_widget, #override_color, #text_input_fields, #visible, #width, #x, #y

Instance Method Summary collapse

Methods inherited from Widget

#add, #add_axis_lines, #add_button, #add_child, #add_delete_button, #add_document, #add_graph_display, #add_image, #add_multi_select_table, #add_overlay, #add_panel, #add_plot, #add_single_select_table, #add_table, #add_text, #border_color, #bottom_edge, #button_down, #button_up, #center_children, #center_x, #center_y, #clear_children, #contains_click, #debug, #disable_background, #disable_border, #draw, #draw_background, #draw_border, #enable_background, #enable_border, #error, #get_layout, #get_theme, #graphics_color, #handle_key_held_down, #handle_key_press, #handle_key_up, #handle_mouse_down, #handle_mouse_up, #handle_right_mouse, #handle_update, #info, #intercept_widget_event, #left_edge, #move_recursive_absolute, #move_recursive_delta, #overlaps_with, #pad, #relative_x, #relative_y, #relative_z_order, #remove_child, #remove_children, #remove_children_by_type, #right_edge, #selection_color, #set_absolute_position, #set_dimensions, #set_layout, #set_selected, #set_theme, #text_color, #top_edge, #unset_selected, #update, #warn, #x_pixel_to_screen, #y_pixel_to_screen, #z_order

Constructor Details

#initialize(x, y, x2, y2, color = nil) ⇒ Line

Returns a new instance of Line.



2163
2164
2165
2166
2167
2168
2169
2170
# File 'lib/wads/widgets.rb', line 2163

def initialize(x, y, x2, y2, color = nil) 
    super(x, y)
    @override_color = color
    @x2 = x2 
    @y2 = y2
    disable_border
    disable_background
end

Instance Attribute Details

#x2Object

Returns the value of attribute x2.



2160
2161
2162
# File 'lib/wads/widgets.rb', line 2160

def x2
  @x2
end

#y2Object

Returns the value of attribute y2.



2161
2162
2163
# File 'lib/wads/widgets.rb', line 2161

def y2
  @y2
end

Instance Method Details

#renderObject



2172
2173
2174
# File 'lib/wads/widgets.rb', line 2172

def render
    Gosu::draw_line x, y, graphics_color, x2, y2, graphics_color, z_order
end

#uses_layoutObject



2180
2181
2182
# File 'lib/wads/widgets.rb', line 2180

def uses_layout
    false 
end

#widget_zObject



2176
2177
2178
# File 'lib/wads/widgets.rb', line 2176

def widget_z 
    Z_ORDER_GRAPHIC_ELEMENTS
end