Permalink
Browse files

Remove matter.js from dxopal.js

  • Loading branch information...
yhara committed Jan 27, 2018
1 parent dc985c3 commit 294c1e458164c35009faac3743057ad993238998
Showing with 19 additions and 5 deletions.
  1. +15 −0 CHANGELOG.md
  2. +1 −2 Rakefile
  3. +1 −0 examples/matter/index.html
  4. +2 −3 opal/dxopal/sprite/physics.rb
View
@@ -1,5 +1,20 @@
## (not yet)
### Breaking change: matter.js is split from dxopal.js
To use `DXOpal::Sprite::Physics`, you need to load matter.js explicitly.
Old:
<script src="dxopal.min.js"></script>
New:
<script src="matter.js"></script>
<script src="dxopal.min.js"></script>
### Other improvements:
- new: Image#set_color_key
- new: Window.draw_scale
- new: Show the message of an exception if there is a `<div id='dxopal-errors'>`
View
@@ -13,10 +13,9 @@ file "build/dxopal.min.js" => "build/dxopal.js" do |t|
sh "uglifyjs #{t.source} -o #{t.name}"
end
file "build/dxopal.js" => Dir["opal/**/*.rb"] + ["vendor/matter.js"] do |t|
file "build/dxopal.js" => Dir["opal/**/*.rb"] do |t|
Opal.append_path("opal")
js = Opal::Builder.build("dxopal.rb").to_s
js << File.read("vendor/matter.js")
File.write(t.name, js)
end
@@ -3,6 +3,7 @@
<head>
<meta charset= "utf-8" />
<title>DXOpal demo</title>
<script type="text/javascript" src="../_vendor/matter-0.10.0.js"></script>
<script type="text/javascript" src="../../build/dxopal.js"></script>
<script type="text/ruby">
DXOpal.dump_error{ require_remote 'main.rb' }
@@ -1,9 +1,8 @@
module DXOpal
class Sprite
# Experimental Matter.js (physics engine) support
# TODO: Currently matter.js is embeeded in build/dxopal.js (see Rakefile).
# It is better to make it optional (i.e. do not embed matter.js and
# enable Matter.js support when matter.js is loaded before dxopal.js)
#
# You need to load matter.js in advance to using these features.
module Physics
# Create Matter Body and register it to the World
# - type: :rectangle, etc.

0 comments on commit 294c1e4

Please sign in to comment.