starx 0.1.1 → 0.1.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/starx +27 -27
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48c7d63f141c1a80441d623a878d9c93bb30c3cb
4
- data.tar.gz: c3674921cc91c5f42a24cf681a1708f53efbb089
3
+ metadata.gz: 7d4429a9a304a622e0c6eb4877e0093c01e35dcd
4
+ data.tar.gz: 0759e56a7b4fdb1bab804d03ab054ded72845b12
5
5
  SHA512:
6
- metadata.gz: a625d1017ae68b83a8da9492a04c2762852c4791197e4b97937308fdd145f2cfe1a2162b034dbb9cbf817114dd6bbf46ccca89ea4b43ecd38caa3ae733e3dc64
7
- data.tar.gz: 00d15e6cfe4ae5d1131b145e3e0fca5a73d153d0c786f58eff3a8dd1bd5cde61192b263ed7ea919c80163aa7fd0310b749137f64470e14fc8f610ebfa37e961b
6
+ metadata.gz: f64d22914133461d841b136fe78204dcc7efae2cfdd61cc364e5c02852db3aeda9ccc1c5b29d36cfc8b1577badc766996935d06949a7dbbf56460598a607b564
7
+ data.tar.gz: 8d2476c806be3e80fdc7e36fe61e11b7d520fb21d033506cf934c139c01065dde0923a92108945d6de21b71c2f2539e38f67a6c67bae4515da6f95731f640d35
data/bin/starx CHANGED
@@ -207,34 +207,30 @@ class Starx
207
207
 
208
208
  def read_char
209
209
  begin
210
- state = `stty -g`
211
- `stty raw -echo isig`
212
- c = nil
213
- if $stdin.ready?
214
- c = $stdin.getc.chr
215
- if c == "\e"
216
- extra_thread = Thread.new do
217
- c += $stdin.getc.chr
218
- c += $stdin.getc.chr
219
- end
220
- extra_thread.join(0.00001)
221
- extra_thread.kill
222
- end
223
- end
224
- ensure
225
- system "stty #{state}"
226
- end
227
- c
228
- # TODO: Hide non-blocking io
229
- end
210
+ system 'stty raw -echo'
211
+ if $stdin.ready?
212
+ c = $stdin.getc.chr
213
+ if c == "\e"
214
+ extra_thread = Thread.new do
215
+ c += $stdin.getc.chr
216
+ c += $stdin.getc.chr
217
+ end
218
+ extra_thread.join 0.00001
219
+ extra_thread.kill
220
+ end
221
+ end
222
+ ensure
223
+ system 'stty -raw echo'
224
+ end
225
+ c
226
+ end
230
227
 
231
228
  def read_char_menu
232
229
  begin
233
- state = `stty -g`
234
- `stty raw -echo isig`
235
- c = $stdin.getc.chr if $stdin
230
+ system 'stty raw -echo'
231
+ c = $stdin.getc.chr
236
232
  ensure
237
- system "stty #{state}"
233
+ system 'stty -raw echo'
238
234
  end
239
235
  c
240
236
  end
@@ -273,18 +269,22 @@ class Starx
273
269
  puts ''
274
270
  keys_menu
275
271
 
276
- # TODO: Add best scores
277
272
  end
278
273
 
279
274
  def play
280
275
  loop do
276
+ begin
281
277
  tick
282
278
  sleep 0.04
283
279
  system 'clear'
284
- end
280
+ rescue Interrupt
281
+ system 'tput cnorm'
282
+ system 'clear'
283
+ Process.exit! true
284
+ end
285
+ end
285
286
  end
286
287
  #
287
- # TODO: score count in hidden file and displayed on screen
288
288
  end
289
289
 
290
290
  g = Starx.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: starx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justyna Rachowicz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-27 00:00:00.000000000 Z
11
+ date: 2015-02-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: justynarachowicz@gmail.com