roflcopter 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/bin/roflcopter +1 -1
- data/lib/roflcopter.rb +50 -54
- data/lib/roflcopter/version.rb +2 -2
- metadata +1 -1
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/bin/roflcopter
CHANGED
data/lib/roflcopter.rb
CHANGED
@@ -1,69 +1,65 @@
|
|
1
1
|
require 'roflcopter/version'
|
2
2
|
require 'curses'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
%| I I |,
|
19
|
-
%| --------------/ |,
|
20
|
-
%| |
|
21
|
-
]
|
22
|
-
end
|
23
|
-
|
24
|
-
def fly
|
25
|
-
audio
|
26
|
-
video
|
27
|
-
end
|
28
|
-
|
29
|
-
def audio
|
30
|
-
Thread.new do
|
31
|
-
system "say -v Alex the rofl copter says #{'siff ' * 1000}"
|
32
|
-
exit
|
4
|
+
module Roflcopter
|
5
|
+
class << self
|
6
|
+
include Curses
|
7
|
+
|
8
|
+
def fly
|
9
|
+
audio
|
10
|
+
video
|
11
|
+
end
|
12
|
+
|
13
|
+
def audio
|
14
|
+
Thread.new do
|
15
|
+
system "say -v Alex the rofl copter says #{'siff ' * 1000}"
|
16
|
+
exit
|
17
|
+
end
|
33
18
|
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def video
|
37
|
-
init_screen
|
38
19
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
20
|
+
def video
|
21
|
+
init_screen
|
22
|
+
curs_set frame = 0
|
23
|
+
altitude = 5
|
24
|
+
|
25
|
+
while frame += 1
|
26
|
+
[
|
27
|
+
%| |,
|
28
|
+
%| 4321043210LOL4321043210 |,
|
29
|
+
%| ^ |,
|
30
|
+
%|012 /------------- |,
|
31
|
+
%|3O3======= [ ] \\ |,
|
32
|
+
%|210 \\ \\ |,
|
33
|
+
%| \\____________] |,
|
34
|
+
%| I I |,
|
35
|
+
%| --------------/ |,
|
36
|
+
%| |
|
37
|
+
].each_with_index do |line, index|
|
38
|
+
{ 1 => [':LFOR', 5], (3..5) => ['L ', 4] }.each do |key, (ch, n)|
|
43
39
|
n.times do |i|
|
44
|
-
line.tr!(i.to_s, ch.chars.to_a[(i +
|
45
|
-
end
|
40
|
+
line.tr!(i.to_s, ch.chars.to_a[(i + frame) % n])
|
41
|
+
end if key === index
|
42
|
+
|
43
|
+
copter = (line + (' ' * (cols - 31))).chars.to_a
|
44
|
+
frame.times { copter.unshift copter.pop }
|
45
|
+
|
46
|
+
setpos altitude + index, 0
|
47
|
+
addstr copter.join
|
46
48
|
end
|
47
49
|
|
48
|
-
|
49
|
-
|
50
|
+
case rand 1..10
|
51
|
+
when 1
|
52
|
+
altitude -= 1
|
53
|
+
when 10
|
54
|
+
altitude += 1
|
55
|
+
end
|
50
56
|
|
51
|
-
|
52
|
-
|
57
|
+
refresh
|
58
|
+
sleep 0.08
|
53
59
|
end
|
54
60
|
|
55
|
-
|
56
|
-
when 1
|
57
|
-
@altitude -= 1
|
58
|
-
when 10
|
59
|
-
@altitude += 1
|
60
|
-
end
|
61
|
-
|
62
|
-
refresh
|
63
|
-
sleep 0.08
|
61
|
+
at_exit { close_screen }
|
64
62
|
end
|
65
|
-
|
66
|
-
at_exit { close_screen }
|
67
63
|
end
|
68
64
|
end
|
69
65
|
end
|
data/lib/roflcopter/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = '0.0.
|
1
|
+
module Roflcopter
|
2
|
+
VERSION = '0.0.4'
|
3
3
|
end
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|