dxopal 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/DEVELOPMENT.md +1 -1
- data/Gemfile +8 -1
- data/Gemfile.lock +13 -23
- data/Rakefile +1 -2
- data/TODO.md +20 -16
- data/build/dxopal.js +338 -232
- data/build/dxopal.min.js +1 -1
- data/doc/api/DXOpal.html +18 -12
- data/doc/api/DXOpal/Font.html +3 -3
- data/doc/api/DXOpal/Image.html +229 -202
- data/doc/api/DXOpal/Input.html +23 -17
- data/doc/api/DXOpal/Input/MouseCodes.html +38 -32
- data/doc/api/DXOpal/RemoteResource.html +33 -27
- data/doc/api/DXOpal/Sound.html +3 -3
- data/doc/api/DXOpal/SoundEffect.html +5 -4
- data/doc/api/DXOpal/SoundEffect/WaveTypes.html +33 -27
- data/doc/api/DXOpal/Sprite.html +177 -33
- data/doc/api/DXOpal/Window.html +58 -52
- data/doc/api/_index.html +4 -4
- data/doc/api/css/style.css +4 -7
- data/doc/api/file.README.html +3 -3
- data/doc/api/frames.html +1 -1
- data/doc/api/index.html +3 -3
- data/doc/api/js/app.js +44 -0
- data/doc/api/method_list.html +57 -41
- data/doc/api/top-level-namespace.html +3 -3
- data/dxopal.gemspec +0 -6
- data/opal/dxopal.rb +3 -11
- data/opal/dxopal/image.rb +11 -2
- data/opal/dxopal/patches/require_remote.rb +10 -0
- data/opal/dxopal/sprite.rb +6 -0
- data/opal/dxopal/version.rb +1 -1
- metadata +3 -86
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Top Level Namespace
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.16
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -100,9 +100,9 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on
|
103
|
+
Generated on Sat Sep 29 15:56:47 2018 by
|
104
104
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
|
-
0.9.
|
105
|
+
0.9.16 (ruby-2.5.1).
|
106
106
|
</div>
|
107
107
|
|
108
108
|
</div>
|
data/dxopal.gemspec
CHANGED
@@ -23,12 +23,6 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
|
-
spec.add_runtime_dependency "opal", "~> 0.11.0"
|
27
26
|
spec.add_runtime_dependency "thor", "~> 0.19.1"
|
28
27
|
spec.add_runtime_dependency "rack", "~> 2.0"
|
29
|
-
spec.add_development_dependency "bundler", "~> 1.14"
|
30
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
-
spec.add_development_dependency "yard", "~> 0.9.12"
|
32
|
-
spec.add_development_dependency "puma", "~> 3.11.2"
|
33
|
-
spec.add_development_dependency "opal-sprockets", "~> 0.4.1"
|
34
28
|
end
|
data/opal/dxopal.rb
CHANGED
@@ -15,17 +15,6 @@ require 'dxopal/version'
|
|
15
15
|
# without even install Ruby)
|
16
16
|
require 'opal-parser'
|
17
17
|
|
18
|
-
# Patch to opal-parser
|
19
|
-
def require_remote(url)
|
20
|
-
%x{
|
21
|
-
var r = new XMLHttpRequest();
|
22
|
-
r.overrideMimeType("text/plain"); // Patch for Firefox + file://
|
23
|
-
r.open("GET", url, false);
|
24
|
-
r.send('');
|
25
|
-
}
|
26
|
-
eval `r.responseText`
|
27
|
-
end
|
28
|
-
|
29
18
|
# These opal stdlibs will be embedded in dxopal.js.
|
30
19
|
require 'singleton'
|
31
20
|
require 'delegate'
|
@@ -35,6 +24,9 @@ require 'promise'
|
|
35
24
|
require 'set'
|
36
25
|
require 'time'
|
37
26
|
|
27
|
+
# Patches
|
28
|
+
require 'dxopal/patches/require_remote'
|
29
|
+
|
38
30
|
module DXOpal
|
39
31
|
include DXOpal::Constants::Colors
|
40
32
|
include DXOpal::Input::KeyCodes
|
data/opal/dxopal/image.rb
CHANGED
@@ -70,13 +70,18 @@ module DXOpal
|
|
70
70
|
draw_ex(x, y, image, angle: angle, center_x: center_x, center_y: center_y)
|
71
71
|
end
|
72
72
|
|
73
|
+
BLEND_TYPES = {
|
74
|
+
alpha: "source-over", # A over B (Default)
|
75
|
+
add: "lighter" # A + B
|
76
|
+
}
|
77
|
+
|
73
78
|
def draw_ex(x, y, image, options={})
|
74
79
|
scale_x = options[:scale_x] || 1
|
75
80
|
scale_y = options[:scale_y] || 1
|
76
81
|
center_x = options[:center_x] || image.width/2
|
77
82
|
center_y = options[:center_y] || image.height/2
|
78
|
-
|
79
|
-
|
83
|
+
alpha = options[:alpha] || 255
|
84
|
+
blend = options[:blend] || :alpha
|
80
85
|
angle = options[:angle] || 0
|
81
86
|
|
82
87
|
cx = x + center_x
|
@@ -85,7 +90,11 @@ module DXOpal
|
|
85
90
|
#{@ctx}.translate(cx, cy);
|
86
91
|
#{@ctx}.rotate(angle * Math.PI / 180.0);
|
87
92
|
#{@ctx}.scale(scale_x, scale_y);
|
93
|
+
#{@ctx}.save();
|
94
|
+
#{@ctx}.globalAlpha = alpha / 255;
|
95
|
+
#{@ctx}.globalCompositeOperation = #{BLEND_TYPES[blend]};
|
88
96
|
#{@ctx}.drawImage(#{image.canvas}, x-cx, y-cy);
|
97
|
+
#{@ctx}.restore();
|
89
98
|
#{@ctx}.setTransform(1, 0, 0, 1, 0, 0); // reset
|
90
99
|
}
|
91
100
|
return self
|
data/opal/dxopal/sprite.rb
CHANGED
@@ -53,6 +53,11 @@ module DXOpal
|
|
53
53
|
attr_accessor :scale_x, :scale_y
|
54
54
|
# Set rotation center (default: center of `image`)
|
55
55
|
attr_accessor :center_x, :center_y
|
56
|
+
# Set alpha (0~255, default: nil)
|
57
|
+
attr_accessor :alpha
|
58
|
+
# Set blend type (Any of :alpha(default), :add)
|
59
|
+
# (:none, :add2 and :sub are not implemented yet; Pull request is welcome)
|
60
|
+
attr_accessor :blend
|
56
61
|
|
57
62
|
attr_reader :x, :y
|
58
63
|
|
@@ -88,6 +93,7 @@ module DXOpal
|
|
88
93
|
|
89
94
|
Window.draw_ex(@x, @y, @image,
|
90
95
|
scale_x: @scale_x, scale_y: @scale_y,
|
96
|
+
alpha: @alpha, blend: @blend,
|
91
97
|
angle: @angle, center_x: @center_x, center_y: @center_y)
|
92
98
|
end
|
93
99
|
end
|
data/opal/dxopal/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dxopal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yutaka HARA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: opal
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.11.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.11.0
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: thor
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,76 +38,6 @@ dependencies:
|
|
52
38
|
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '2.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: bundler
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.14'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.14'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '10.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '10.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: yard
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.9.12
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.9.12
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: puma
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 3.11.2
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 3.11.2
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: opal-sprockets
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 0.4.1
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 0.4.1
|
125
41
|
description:
|
126
42
|
email:
|
127
43
|
- yutaka.hara+github@gmail.com
|
@@ -180,6 +96,7 @@ files:
|
|
180
96
|
- opal/dxopal/image.rb
|
181
97
|
- opal/dxopal/input.rb
|
182
98
|
- opal/dxopal/input/key_codes.rb
|
99
|
+
- opal/dxopal/patches/require_remote.rb
|
183
100
|
- opal/dxopal/remote_resource.rb
|
184
101
|
- opal/dxopal/sound.rb
|
185
102
|
- opal/dxopal/sound_effect.rb
|