Class: Metro::UI::Border
- Inherits:
-
Model
- Object
- Model
- Metro::UI::Border
show all
- Defined in:
- lib/metro/models/ui/border.rb
Overview
Draws a rectanglar border around the specififed position and dimensions with the width provided. This is an unfilled rectangle.
Constant Summary
Metro::Units::Bounds
Instance Attribute Summary collapse
Attributes inherited from Model
#scene, #window
Instance Method Summary
collapse
Methods inherited from Model
#_load, #_save, #after_initialize, #bounds, #completed?, #create, hierarchy, inherited, #initialize, metro_name, #model, model_name, models, #name, #notification, #saveable_to_view, #show, #to_hash, #update
Methods included from HasEvents
included
#get, #set
included, #properties
Constructor Details
This class inherits a constructor from Metro::Model
Instance Attribute Details
#border ⇒ Object
The width of the border lines
24
|
# File 'lib/metro/models/ui/border.rb', line 24
property :border, default: 2
|
#color ⇒ Object
The color which to use to draw the border.
20
|
# File 'lib/metro/models/ui/border.rb', line 20
property :color, default: "rgba(255,255,255,1.0)"
|
#dimensions ⇒ Object
The dimension of the border.
16
|
# File 'lib/metro/models/ui/border.rb', line 16
property :dimensions
|
#position ⇒ Object
The starting position of the border.
12
|
# File 'lib/metro/models/ui/border.rb', line 12
property :position
|
Instance Method Details
#bottom ⇒ Object
84
85
86
|
# File 'lib/metro/models/ui/border.rb', line 84
def bottom
y + height
end
|
#bottom_with_border ⇒ Object
88
89
90
|
# File 'lib/metro/models/ui/border.rb', line 88
def bottom_with_border
bottom + border
end
|
#draw ⇒ Object
26
27
28
|
# File 'lib/metro/models/ui/border.rb', line 26
def draw
draw_border
end
|
#draw_border ⇒ Object
30
31
32
33
34
35
|
# File 'lib/metro/models/ui/border.rb', line 30
def draw_border
draw_top
draw_bottom
draw_left
draw_right
end
|
#draw_bottom ⇒ Object
49
50
51
|
# File 'lib/metro/models/ui/border.rb', line 49
def draw_bottom
draw_line left_with_border, bottom, right,bottom_with_border
end
|
#draw_left ⇒ Object
41
42
43
|
# File 'lib/metro/models/ui/border.rb', line 41
def draw_left
draw_line left, top, left_with_border, bottom_with_border
end
|
#draw_line(start_x, start_y, finish_x, finish_y) ⇒ Object
53
54
55
56
57
58
|
# File 'lib/metro/models/ui/border.rb', line 53
def draw_line(start_x,start_y,finish_x,finish_y)
window.draw_quad start_x, start_y, color,
finish_x, start_y, color,
finish_x, finish_y, color,
start_x, finish_y, color, z_order
end
|
#draw_right ⇒ Object
45
46
47
|
# File 'lib/metro/models/ui/border.rb', line 45
def draw_right
draw_line right, top, right_with_border, bottom_with_border
end
|
#draw_top ⇒ Object
37
38
39
|
# File 'lib/metro/models/ui/border.rb', line 37
def draw_top
draw_line left_with_border, top, right, top_with_border
end
|
#left ⇒ Object
60
61
62
|
# File 'lib/metro/models/ui/border.rb', line 60
def left
x
end
|
#left_with_border ⇒ Object
64
65
66
|
# File 'lib/metro/models/ui/border.rb', line 64
def left_with_border
x + border
end
|
#right ⇒ Object
68
69
70
|
# File 'lib/metro/models/ui/border.rb', line 68
def right
x + width
end
|
#right_with_border ⇒ Object
72
73
74
|
# File 'lib/metro/models/ui/border.rb', line 72
def right_with_border
right + border
end
|
#top ⇒ Object
76
77
78
|
# File 'lib/metro/models/ui/border.rb', line 76
def top
y
end
|
#top_with_border ⇒ Object
80
81
82
|
# File 'lib/metro/models/ui/border.rb', line 80
def top_with_border
top + border
end
|