term_canvas 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/term_canvas/version.rb +1 -1
- data/lib/term_canvas.rb +12 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ff8427af407eaaf82d05c19da9db7fc208a9336a7139c6907cf13963805975ca
|
|
4
|
+
data.tar.gz: 206ed68894092865c1d31252ea25b4fe2d02405063460570257da95cb679c504
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88f9527c3a1bc3ce52a2e4b632e31fe91286511bdeb11f7e638b0d2a59bd0684303ae5769f30117fd02d619fd7c9156eaf7133907f6ad20d81608f90359a8d5e
|
|
7
|
+
data.tar.gz: 2b812225ba4750fe614fdc54e4e34abb03f069578b557184fc7be818526272b66cee7082284722f3e3a932b09b3576ff804594644160781ef093caa62a370108
|
data/Gemfile.lock
CHANGED
data/lib/term_canvas/version.rb
CHANGED
data/lib/term_canvas.rb
CHANGED
|
@@ -17,6 +17,16 @@ module TermCanvas
|
|
|
17
17
|
Curses.close_screen
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
# @return [Integer] Width of this screen.
|
|
21
|
+
def self.width
|
|
22
|
+
Curses.cols
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# @return [Integer] Height of this screen.
|
|
26
|
+
def self.height
|
|
27
|
+
Curses.lines
|
|
28
|
+
end
|
|
29
|
+
|
|
20
30
|
class Canvas
|
|
21
31
|
attr_accessor :width, :height
|
|
22
32
|
# Create a convenient window.
|
|
@@ -44,12 +54,12 @@ module TermCanvas
|
|
|
44
54
|
|
|
45
55
|
# @return [Integer] Horizontal center of the window.
|
|
46
56
|
def centerx
|
|
47
|
-
@win.
|
|
57
|
+
@win.cols / 2 + @win.cols % 2
|
|
48
58
|
end
|
|
49
59
|
|
|
50
60
|
# @return [Integer] Vertical center of the window.
|
|
51
61
|
def centery
|
|
52
|
-
@win.
|
|
62
|
+
@win.lines / 2 + @win.lines % 2
|
|
53
63
|
end
|
|
54
64
|
|
|
55
65
|
# Add text object to the window but not display.
|