Class: PM::Geometry
- Inherits:
-
Object
- Object
- PM::Geometry
- Includes:
- Curses
- Defined in:
- lib/patchmaster/curses/geometry.rb
Overview
Defines positions and sizes of windows. Rects contain [height, width, top, left], which is the order used by Curses::Window.new.
Instance Method Summary collapse
- #help_rect ⇒ Object
- #info_rect ⇒ Object
-
#initialize ⇒ Geometry
constructor
A new instance of Geometry.
- #message_rect ⇒ Object
- #patch_rect ⇒ Object
- #song_list_rect ⇒ Object
- #song_lists_rect ⇒ Object
- #song_rect ⇒ Object
- #trigger_rect ⇒ Object
Constructor Details
#initialize ⇒ Geometry
Returns a new instance of Geometry.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/patchmaster/curses/geometry.rb', line 9 def initialize @top_height = (lines() - 1) * 2 / 3 @bot_height = (lines() - 1) - @top_height @top_width = cols() / 3 @sls_height = @top_height / 3 @sl_height = @top_height - @sls_height @info_width = cols() - (@top_width * 2) @info_left = @top_width * 2 end |
Instance Method Details
#help_rect ⇒ Object
49 50 51 |
# File 'lib/patchmaster/curses/geometry.rb', line 49 def help_rect [lines() - 6, cols() - 6, 3, 3] end |
#info_rect ⇒ Object
45 46 47 |
# File 'lib/patchmaster/curses/geometry.rb', line 45 def info_rect [@top_height, @info_width, 0, @info_left] end |
#message_rect ⇒ Object
41 42 43 |
# File 'lib/patchmaster/curses/geometry.rb', line 41 def [1, cols(), lines()-1, 0] end |
#patch_rect ⇒ Object
37 38 39 |
# File 'lib/patchmaster/curses/geometry.rb', line 37 def patch_rect [@bot_height, cols(), @top_height, 0] end |
#song_list_rect ⇒ Object
21 22 23 |
# File 'lib/patchmaster/curses/geometry.rb', line 21 def song_list_rect [@sl_height, @top_width, 0, 0] end |
#song_lists_rect ⇒ Object
29 30 31 |
# File 'lib/patchmaster/curses/geometry.rb', line 29 def song_lists_rect [@sls_height, @top_width, @sl_height, 0] end |
#song_rect ⇒ Object
25 26 27 |
# File 'lib/patchmaster/curses/geometry.rb', line 25 def song_rect [@sl_height, @top_width, 0, @top_width] end |
#trigger_rect ⇒ Object
33 34 35 |
# File 'lib/patchmaster/curses/geometry.rb', line 33 def trigger_rect [@sls_height, @top_width, @sl_height, @top_width] end |