Class: Radventure::Texts
- Inherits:
-
Object
- Object
- Radventure::Texts
- Defined in:
- lib/radventure/texts.rb
Overview
Method for generic text functionalities
Class Method Summary collapse
-
.clear ⇒ void
Clears the console screen.
- .header ⇒ Object
-
.intro(meta) ⇒ void
Outputs a simple intro to the game.
-
.prelude(meta) ⇒ void
Outputs a simple intro to the game.
-
.show_room(room) ⇒ void
Outputs the room’s name and description.
-
.wait_for_key ⇒ void
Prints a “press any key” message and waits for, well, any key.
Class Method Details
.clear ⇒ void
This method returns an undefined value.
Clears the console screen
69 70 71 |
# File 'lib/radventure/texts.rb', line 69 def self.clear $stdout.clear_screen end |
.header ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/radventure/texts.rb', line 46 def self.header # y, x = $stdout.winsize # puts Rainbow("+#{'=' * (x - 2)}+").italic # # i = 0 # until i == (y - 2) # puts '+' # i += 1 # end end |
.intro(meta) ⇒ void
This method returns an undefined value.
Outputs a simple intro to the game
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/radventure/texts.rb', line 13 def self.intro() puts Rainbow("## #{.title} ##").yellow.bright puts "Version #{.version}" puts "© #{.year}, #{.}" puts "Available under #{.license}" puts '' puts .description wait_for_key clear end |
.prelude(meta) ⇒ void
This method returns an undefined value.
Outputs a simple intro to the game
28 29 30 31 32 33 34 |
# File 'lib/radventure/texts.rb', line 28 def self.prelude() return unless .prelude != '' puts .prelude wait_for_key clear end |
.show_room(room) ⇒ void
This method returns an undefined value.
Outputs the room’s name and description
40 41 42 43 44 |
# File 'lib/radventure/texts.rb', line 40 def self.show_room(room) puts Rainbow("## #{room.name} ##").blue.bright puts room.description puts '' end |
.wait_for_key ⇒ void
This method returns an undefined value.
Prints a “press any key” message and waits for, well, any key
60 61 62 63 64 |
# File 'lib/radventure/texts.rb', line 60 def self.wait_for_key puts '' puts Rainbow('<Press any key>').color(:dimgray) gets end |