term_canvas 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/_examples/curses.rb +7 -4
- data/_examples/test.rb +1 -1
- data/lib/term_canvas/version.rb +1 -1
- data/lib/term_canvas.rb +2 -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: a6e613e0a509152ba563e099fe7ec78a262fb2ea54d20192826caa3e07697894
|
4
|
+
data.tar.gz: 90ae22a2adfa87d06b8bdc669e86355d5039ff6664cfdb0d273b952f45526609
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 416bdd693fa4604308e3fe4583009af1e47d9e9a6c7cd526a15aa8006653476d8ea6f12a5d5bb4e2eb44a5951b13708827b0818292f7c227d521a475b35758ef
|
7
|
+
data.tar.gz: 418039a781cd6e6dc16c9bc03b0eb48394fcef2ffe31be976879c4fae7abba518c46b0831fedb807825a9700a174e8969dd740fd4b539b10e3495bf7b9f173b1
|
data/Gemfile.lock
CHANGED
data/_examples/curses.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
require 'curses'
|
2
2
|
|
3
3
|
Curses.init_screen
|
4
|
-
Curses::noecho
|
5
|
-
Curses.curs_set(0)
|
4
|
+
# Curses::noecho
|
5
|
+
# Curses.curs_set(0)
|
6
6
|
Curses.start_color
|
7
7
|
Curses.use_default_colors
|
8
8
|
|
9
|
-
win = Curses::Window.new(
|
9
|
+
win = Curses::Window.new(Curses.lines, Curses.cols, 0, 0)
|
10
|
+
win.box(?*, ?*)
|
11
|
+
puts Curses.cols
|
12
|
+
puts Curses.lines
|
10
13
|
|
11
14
|
color_struct = Struct.new(:id, :r, :g, :b)
|
12
15
|
id = 1
|
@@ -15,7 +18,7 @@ Curses.init_color(*color)
|
|
15
18
|
Curses.init_pair(id, 0, id)
|
16
19
|
pair = Curses.color_pair(id)
|
17
20
|
win.attron(pair)
|
18
|
-
win.addstr("
|
21
|
+
win.addstr("1")
|
19
22
|
win.attroff(pair)
|
20
23
|
win.refresh
|
21
24
|
sleep 3
|
data/_examples/test.rb
CHANGED
@@ -21,7 +21,7 @@ loop do
|
|
21
21
|
field.clear
|
22
22
|
field.rect(
|
23
23
|
TermCanvas::Rect.new(
|
24
|
-
x:
|
24
|
+
x: field.centerx, y: field.centery, width: 2, height: 1, background_color: {r: 200, b: 200, g: 800}
|
25
25
|
)
|
26
26
|
)
|
27
27
|
field.text(
|
data/lib/term_canvas/version.rb
CHANGED
data/lib/term_canvas.rb
CHANGED
@@ -54,12 +54,12 @@ module TermCanvas
|
|
54
54
|
|
55
55
|
# @return [Integer] Horizontal center of the window.
|
56
56
|
def centerx
|
57
|
-
@
|
57
|
+
@width / 2 + @width % 2
|
58
58
|
end
|
59
59
|
|
60
60
|
# @return [Integer] Vertical center of the window.
|
61
61
|
def centery
|
62
|
-
@
|
62
|
+
@height / 2 + @height % 2
|
63
63
|
end
|
64
64
|
|
65
65
|
# Add text object to the window but not display.
|