pixo 0.1.4 → 0.2.0
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/exe/pixo +5 -0
- data/lib/pixo/version.rb +1 -1
- data/lib/pixo.rb +61 -36
- data/pixo.gemspec +2 -4
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a2ed5c3cd2e91b160038f832a3b282710879b21
|
4
|
+
data.tar.gz: 533ea89508d8054cda89981d09dc7a012ba428d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b3bce155d3ac4418236f4cfc8ee774371bab059cf21f8b8c5a253587b3b2d9eef0a50cb7211ba2a1752cc7fbf892e42bbf94700b65ddc41221bcf19609513c7
|
7
|
+
data.tar.gz: 43e9f3a7dd771a5c7b47b94382adfd30f3acaaf6f143f8730e1b3c31508dc200e47e9bf487d6d5034c67d62fe7289c4abed9534a14bbd22e99e8878d2fdea1cd
|
data/Gemfile.lock
CHANGED
data/exe/pixo
ADDED
data/lib/pixo/version.rb
CHANGED
data/lib/pixo.rb
CHANGED
@@ -1,57 +1,82 @@
|
|
1
1
|
require "pixo/version"
|
2
|
+
require "open3"
|
3
|
+
require 'benchmark'
|
4
|
+
require 'base64'
|
2
5
|
|
3
6
|
require File.expand_path('../libpixgem', __FILE__)
|
4
7
|
|
5
8
|
module Pixo
|
9
|
+
class FrameStatus
|
10
|
+
attr_accessor :render_ms
|
11
|
+
def initialize(render_ms)
|
12
|
+
self.render_ms = render_ms
|
13
|
+
end
|
14
|
+
end
|
6
15
|
|
7
|
-
class
|
8
|
-
attr_accessor :running
|
16
|
+
class Renderer
|
9
17
|
|
10
|
-
|
11
|
-
|
12
|
-
|
18
|
+
def run(&block)
|
19
|
+
Open3.popen3('bundle exec pixo') do |i, o, e, t|
|
20
|
+
while line = o.readline
|
13
21
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def run
|
18
|
-
p active_pattern
|
19
|
-
while(
|
20
|
-
running &&
|
21
|
-
tick(active_pattern))
|
22
|
-
if (active_pattern.elapsed > 10 * 60)
|
23
|
-
self.active_pattern = random_pattern
|
22
|
+
block.call(Marshal.load(Base64.strict_decode64(line.strip)))
|
23
|
+
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
close
|
27
26
|
end
|
28
27
|
|
28
|
+
class Application < Pixo::Native::Application
|
29
|
+
attr_accessor :running
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
def initialize()
|
32
|
+
super
|
33
|
+
self.running = true
|
34
|
+
|
35
|
+
add_fadecandy(Pixo::Native::FadeCandy.new('localhost', 8))
|
36
|
+
end
|
37
|
+
|
38
|
+
def run
|
39
|
+
while(running)
|
40
|
+
render_ms = Benchmark.realtime do
|
41
|
+
running = tick(active_pattern) && running
|
42
|
+
end
|
43
|
+
|
44
|
+
stats = Pixo::FrameStatus.new(render_ms)
|
45
|
+
STDOUT.write(Base64.strict_encode64(Marshal.dump(stats)))
|
46
|
+
STDOUT.write($/)
|
47
|
+
STDOUT.flush
|
48
|
+
|
49
|
+
if (active_pattern.elapsed > 1)
|
50
|
+
self.active_pattern = random_pattern
|
51
|
+
end
|
37
52
|
end
|
53
|
+
close
|
38
54
|
end
|
39
|
-
@patterns
|
40
|
-
end
|
41
55
|
|
42
|
-
def active_pattern
|
43
|
-
@active_pattern ||= random_pattern
|
44
|
-
end
|
45
56
|
|
46
|
-
|
47
|
-
|
48
|
-
|
57
|
+
def patterns
|
58
|
+
unless @patterns
|
59
|
+
@patterns = Hash.new
|
60
|
+
patterns_dir = File.join(File.dirname(__FILE__), "..", 'ext', 'pixo', 'patterns')
|
61
|
+
Dir.entries(patterns_dir).each do | pattern_file|
|
62
|
+
next unless pattern_file.end_with?('.glsl')
|
63
|
+
@patterns[pattern_file] = Pixo::Native::Pattern.new(File.read(File.join(patterns_dir, pattern_file)))
|
64
|
+
end
|
65
|
+
end
|
66
|
+
@patterns
|
67
|
+
end
|
49
68
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
69
|
+
def active_pattern
|
70
|
+
@active_pattern ||= random_pattern
|
71
|
+
end
|
54
72
|
|
55
|
-
|
73
|
+
def random_pattern
|
74
|
+
patterns[patterns.keys.sample]
|
75
|
+
end
|
56
76
|
|
77
|
+
def active_pattern=(pattern)
|
78
|
+
pattern.reset_start
|
79
|
+
@active_pattern = pattern
|
80
|
+
end
|
81
|
+
end
|
57
82
|
end
|
data/pixo.gemspec
CHANGED
@@ -17,12 +17,10 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.extensions << "ext/libpixgem/extconf.rb"
|
18
18
|
|
19
19
|
|
20
|
-
spec.files = (Dir['*'] + Dir['bin/**/*'] + Dir['ext/**/*'] + Dir['lib/**/*'] ).keep_if do |file|
|
20
|
+
spec.files = (Dir['*'] + Dir['bin/**/*'] + Dir['exe/**/*'] + Dir['ext/**/*'] + Dir['lib/**/*'] ).keep_if do |file|
|
21
21
|
File.file?(file) && !file.end_with?(".so")
|
22
22
|
end
|
23
|
-
|
24
|
-
# f.match(%r{^(test|spec|features)/})
|
25
|
-
#end
|
23
|
+
|
26
24
|
spec.bindir = "exe"
|
27
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
26
|
spec.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Constantine
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,7 +55,8 @@ dependencies:
|
|
55
55
|
description: Write a longer description or delete this line.
|
56
56
|
email:
|
57
57
|
- cconstan@gmail.com
|
58
|
-
executables:
|
58
|
+
executables:
|
59
|
+
- pixo
|
59
60
|
extensions:
|
60
61
|
- ext/libpixgem/extconf.rb
|
61
62
|
extra_rdoc_files: []
|
@@ -68,6 +69,7 @@ files:
|
|
68
69
|
- Rakefile
|
69
70
|
- bin/console
|
70
71
|
- bin/setup
|
72
|
+
- exe/pixo
|
71
73
|
- ext/CMakeLists.txt
|
72
74
|
- ext/libpixgem/extconf.rb
|
73
75
|
- ext/libpixgem/include/opengl.h
|
@@ -1531,7 +1533,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1531
1533
|
version: '0'
|
1532
1534
|
requirements: []
|
1533
1535
|
rubyforge_project:
|
1534
|
-
rubygems_version: 2.6.
|
1536
|
+
rubygems_version: 2.6.11
|
1535
1537
|
signing_key:
|
1536
1538
|
specification_version: 4
|
1537
1539
|
summary: Write a short summary, because Rubygems requires one.
|