Class: Blight::RendersCenteredText
- Inherits:
-
Object
- Object
- Blight::RendersCenteredText
- Defined in:
- lib/blight.rb
Instance Method Summary collapse
-
#initialize(window) ⇒ RendersCenteredText
constructor
A new instance of RendersCenteredText.
- #render(text) ⇒ Object
Constructor Details
#initialize(window) ⇒ RendersCenteredText
Returns a new instance of RendersCenteredText.
81 82 83 |
# File 'lib/blight.rb', line 81 def initialize(window) @window = window end |
Instance Method Details
#render(text) ⇒ Object
85 86 87 88 89 |
# File 'lib/blight.rb', line 85 def render(text) center_x = @window.x + (@window.width - text.length) / 2 center_y = @window.height / 2 @window.print(text, center_x, center_y) end |