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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff8427af407eaaf82d05c19da9db7fc208a9336a7139c6907cf13963805975ca
4
- data.tar.gz: 206ed68894092865c1d31252ea25b4fe2d02405063460570257da95cb679c504
3
+ metadata.gz: a6e613e0a509152ba563e099fe7ec78a262fb2ea54d20192826caa3e07697894
4
+ data.tar.gz: 90ae22a2adfa87d06b8bdc669e86355d5039ff6664cfdb0d273b952f45526609
5
5
  SHA512:
6
- metadata.gz: 88f9527c3a1bc3ce52a2e4b632e31fe91286511bdeb11f7e638b0d2a59bd0684303ae5769f30117fd02d619fd7c9156eaf7133907f6ad20d81608f90359a8d5e
7
- data.tar.gz: 2b812225ba4750fe614fdc54e4e34abb03f069578b557184fc7be818526272b66cee7082284722f3e3a932b09b3576ff804594644160781ef093caa62a370108
6
+ metadata.gz: 416bdd693fa4604308e3fe4583009af1e47d9e9a6c7cd526a15aa8006653476d8ea6f12a5d5bb4e2eb44a5951b13708827b0818292f7c227d521a475b35758ef
7
+ data.tar.gz: 418039a781cd6e6dc16c9bc03b0eb48394fcef2ffe31be976879c4fae7abba518c46b0831fedb807825a9700a174e8969dd740fd4b539b10e3495bf7b9f173b1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- term_canvas (0.2.3)
4
+ term_canvas (0.2.4)
5
5
  curses
6
6
 
7
7
  GEM
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(10, 10, 10, 10)
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("123")
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: 0, y: 0, width: 10, height: 10, background_color: {r: 200, b: 200, g: 800}
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(
@@ -1,3 +1,3 @@
1
1
  module TermCanvas
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
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
- @win.cols / 2 + @win.cols % 2
57
+ @width / 2 + @width % 2
58
58
  end
59
59
 
60
60
  # @return [Integer] Vertical center of the window.
61
61
  def centery
62
- @win.lines / 2 + @win.lines % 2
62
+ @height / 2 + @height % 2
63
63
  end
64
64
 
65
65
  # Add text object to the window but not display.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: term_canvas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - kthatoto