Class: Device::Display
- Inherits:
-
Object
- Object
- Device::Display
- Defined in:
- lib/device/display.rb
Constant Summary collapse
- MAIN_BMP =
"main.bmp"
Class Method Summary collapse
- .adapter ⇒ Object
-
.clear(line = nil) ⇒ Object
Clean display.
- .main_image ⇒ Object
-
.print(buf, row = nil, column = nil) ⇒ NilClass
Display buffer.
-
.print_bitmap(path, row = 0, column = 0) ⇒ NilClass
Display bitmap.
- .print_line(buf, row = 0, column = 0) ⇒ Object
- .print_main_image ⇒ Object
-
.print_status_bar(slot, image_path) ⇒ NilClass, TrueClass
Print image in slot of status bar.
Class Method Details
.adapter ⇒ Object
5 6 7 |
# File 'lib/device/display.rb', line 5 def self.adapter Device.adapter::Display end |
.clear(line = nil) ⇒ Object
Clean display
44 45 46 47 48 49 50 51 |
# File 'lib/device/display.rb', line 44 def self.clear(line = nil) if line.nil? STDOUT.fresh adapter.clear else adapter.clear_line line end end |
.main_image ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'lib/device/display.rb', line 73 def self.main_image file = main_image_format if File.exists?("./shared/#{file}") file else MAIN_BMP end end |
.print(buf, row = nil, column = nil) ⇒ NilClass
Display buffer
15 16 17 18 19 20 21 |
# File 'lib/device/display.rb', line 15 def self.print(buf, row = nil, column = nil) if row.nil? && column.nil? STDOUT.print(buf) else adapter.print_in_line(buf, row, column) end end |
.print_bitmap(path, row = 0, column = 0) ⇒ NilClass
Display bitmap
33 34 35 36 37 38 39 |
# File 'lib/device/display.rb', line 33 def self.print_bitmap(path, row = 0, column = 0) if File.exists?(path) adapter.display_bitmap(path, row, column) else false end end |
.print_line(buf, row = 0, column = 0) ⇒ Object
23 24 25 |
# File 'lib/device/display.rb', line 23 def self.print_line(buf, row = 0, column = 0) self.print(buf, row, column) end |
.print_main_image ⇒ Object
68 69 70 71 |
# File 'lib/device/display.rb', line 68 def self.print_main_image bmp = "./shared/#{self.main_image}" self.print_bitmap(bmp,0,0) if File.exists?(bmp) end |
.print_status_bar(slot, image_path) ⇒ NilClass, TrueClass
Print image in slot of status bar
59 60 61 62 63 64 65 66 |
# File 'lib/device/display.rb', line 59 def self.(slot, image_path) slots = self.adapter. - 1 if (0..slots).include?(slot) if image_path.nil? || File.exists?(image_path) self.adapter.(slot, image_path) end end end |