rubysketch 0.9.5 → 0.11.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/.github/workflows/release-gem.yml +2 -40
- data/.github/workflows/tag.yml +5 -28
- data/.github/workflows/test.yml +1 -28
- data/ChangeLog.md +25 -0
- data/Gemfile.lock +14 -8
- data/RubySketch.podspec +2 -2
- data/VERSION +1 -1
- data/bin/rubysketch +9 -9
- data/examples/constraint.rb +89 -0
- data/lib/rubysketch/all.rb +2 -0
- data/lib/rubysketch/constraint.rb +422 -0
- data/lib/rubysketch/context.rb +33 -25
- data/lib/rubysketch/extension.rb +1 -1
- data/lib/rubysketch/helper.rb +10 -0
- data/lib/rubysketch/pin.rb +108 -0
- data/lib/rubysketch/shape.rb +1 -1
- data/lib/rubysketch/sprite.rb +449 -51
- data/lib/rubysketch.rb +1 -2
- data/pod.rake +1 -1
- data/rubysketch.gemspec +8 -8
- data/test/helper.rb +27 -0
- data/test/test_constraint.rb +230 -0
- data/test/test_context.rb +55 -18
- data/test/test_sprite.rb +2 -8
- data/test/test_sprite_world.rb +66 -0
- metadata +24 -18
- data/.github/workflows/utils.rb +0 -127
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 96ad467c03e2c1e7ccfce5d79414f57fb01af7f1353b91b7e5af361a4d16744e
|
|
4
|
+
data.tar.gz: 6318d1aa2fa9415f3fb9999544029603a965a81d1d7f79bf2848d2b5f444908b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dbd99157cfcd5d60419bbd78866ad8ab1b38e62880258893234f30b4daec3603c8b19e860749de9bacb3d128b76ca6ff13da24114cbc54e4c13b5131c0c2d3a9
|
|
7
|
+
data.tar.gz: 160e86d51c102494256145980059441ec4c4f161760758051865e3117ba2df4ced8ebd7e1bd13b058b123a41edaf5d680830490a9990afaccd647c37222e7349
|
|
@@ -9,43 +9,5 @@ permissions:
|
|
|
9
9
|
|
|
10
10
|
jobs:
|
|
11
11
|
release:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
steps:
|
|
15
|
-
- name: ruby 3.2
|
|
16
|
-
uses: ruby/setup-ruby@v1
|
|
17
|
-
with:
|
|
18
|
-
ruby-version: 3.2
|
|
19
|
-
|
|
20
|
-
- name: checkout
|
|
21
|
-
uses: actions/checkout@v4
|
|
22
|
-
|
|
23
|
-
- name: setup gems
|
|
24
|
-
run: bundle install
|
|
25
|
-
|
|
26
|
-
- name: setup dependencies
|
|
27
|
-
run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
|
|
28
|
-
|
|
29
|
-
- name: test
|
|
30
|
-
run: bundle exec rake packages test
|
|
31
|
-
|
|
32
|
-
- name: create gem
|
|
33
|
-
id: gem
|
|
34
|
-
run: |
|
|
35
|
-
bundle exec rake gem
|
|
36
|
-
echo path=$(ruby -e 'print Dir.glob("*.gem").first') >> $GITHUB_OUTPUT
|
|
37
|
-
|
|
38
|
-
- name: create github release
|
|
39
|
-
env:
|
|
40
|
-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
41
|
-
run: ruby -I.github/workflows -rutils -e 'release(*ARGV)' ./${{ steps.gem.outputs.path }}
|
|
42
|
-
|
|
43
|
-
- name: upload to rubygems
|
|
44
|
-
env:
|
|
45
|
-
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
|
|
46
|
-
run: |
|
|
47
|
-
mkdir -p $HOME/.gem
|
|
48
|
-
touch $HOME/.gem/credentials
|
|
49
|
-
chmod 0600 $HOME/.gem/credentials
|
|
50
|
-
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
|
51
|
-
bundle exec rake upload
|
|
12
|
+
uses: xord/xot/.github/workflows/release-gem.yml@master
|
|
13
|
+
secrets: inherit
|
data/.github/workflows/tag.yml
CHANGED
|
@@ -1,35 +1,12 @@
|
|
|
1
1
|
name: Tag
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
4
|
+
workflow_run:
|
|
5
|
+
workflows: [Test]
|
|
6
|
+
types: [completed]
|
|
5
7
|
branches: [master]
|
|
6
8
|
|
|
7
9
|
jobs:
|
|
8
10
|
tag:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
steps:
|
|
12
|
-
- name: ruby 3.2
|
|
13
|
-
uses: ruby/setup-ruby@v1
|
|
14
|
-
with:
|
|
15
|
-
ruby-version: 3.2
|
|
16
|
-
|
|
17
|
-
- name: checkout
|
|
18
|
-
uses: actions/checkout@v4
|
|
19
|
-
with:
|
|
20
|
-
fetch-depth: 0
|
|
21
|
-
token: ${{ secrets.PAT }}
|
|
22
|
-
|
|
23
|
-
- name: setup dependencies
|
|
24
|
-
run: "ruby -I.github/workflows -rutils -e 'setup_dependencies only: :xot'"
|
|
25
|
-
|
|
26
|
-
- name: setup user name and email
|
|
27
|
-
run: |
|
|
28
|
-
git config --global user.email "xordog@gmail.com"
|
|
29
|
-
git config --global user.name "xord"
|
|
30
|
-
|
|
31
|
-
- name: tag versions
|
|
32
|
-
run: "ruby -I.github/workflows -rutils -e 'tag_versions'"
|
|
33
|
-
|
|
34
|
-
- name: push tags
|
|
35
|
-
run: git push origin --tags
|
|
11
|
+
uses: xord/xot/.github/workflows/tag.yml@master
|
|
12
|
+
secrets: inherit
|
data/.github/workflows/test.yml
CHANGED
|
@@ -7,31 +7,4 @@ on:
|
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
test:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
steps:
|
|
13
|
-
- name: ruby 3.2
|
|
14
|
-
uses: ruby/setup-ruby@v1
|
|
15
|
-
with:
|
|
16
|
-
ruby-version: 3.2
|
|
17
|
-
|
|
18
|
-
- name: checkout
|
|
19
|
-
uses: actions/checkout@v4
|
|
20
|
-
|
|
21
|
-
- name: setup gems
|
|
22
|
-
run: bundle install
|
|
23
|
-
|
|
24
|
-
- name: setup dependencies
|
|
25
|
-
run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
|
|
26
|
-
|
|
27
|
-
- name: packages
|
|
28
|
-
run: bundle exec rake verbose packages
|
|
29
|
-
|
|
30
|
-
- name: lib
|
|
31
|
-
run: bundle exec rake verbose lib
|
|
32
|
-
|
|
33
|
-
- name: ext
|
|
34
|
-
run: bundle exec rake verbose ext
|
|
35
|
-
|
|
36
|
-
- name: test
|
|
37
|
-
run: bundle exec rake verbose test
|
|
10
|
+
uses: xord/xot/.github/workflows/test.yml@master
|
data/ChangeLog.md
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
# rubysketch ChangeLog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## [v0.11.0] - 2026-11-04
|
|
5
|
+
|
|
6
|
+
- [BREAKING] Rename Context#controllerIndex to #controllerNumber
|
|
7
|
+
- [BREAKING] Raise the deployment targets to macOS 11.0 and iOS 14.0
|
|
8
|
+
- [BREAKING] loadPixels and updatePixels exchange straight alpha, not premultiplied (from processing)
|
|
9
|
+
- [BREAKING] A shader from createShader sees premultiplied samples from texMap and must emit premultiplied color (from processing)
|
|
10
|
+
- [BREAKING] Report wheel deltas in pixels, in the same direction, on every platform (from reflex)
|
|
11
|
+
- Package a macOS app without CocoaPods
|
|
12
|
+
|
|
13
|
+
- Fix a canceled press, as by a menu popping up, becoming a click
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [v0.10.0] - 2026-08-04
|
|
17
|
+
|
|
18
|
+
- [BREAKING] Remove the context: parameter from Sprite.new and SpriteWorld#createSprite
|
|
19
|
+
- Add constraint mechanism backed by Reflex constraints
|
|
20
|
+
- Add mouseOver/mouseOut blocks to Sprite, and Sprite#mouseOver to read the state
|
|
21
|
+
- Add sprite(world) support to draw all sprites in a world
|
|
22
|
+
- Add position/size methods to SpriteWorld
|
|
23
|
+
- Deprecate addSprite/removeSprite array params in favor of to:/from: keywords
|
|
24
|
+
- Reject adding a sprite to two worlds, or removing it from another world
|
|
25
|
+
|
|
26
|
+
- Fix SpriteWorld#oy=
|
|
27
|
+
|
|
28
|
+
|
|
4
29
|
## [v0.9.5] - 2026-06-23
|
|
5
30
|
|
|
6
31
|
- Add packager support with bin/rubysketch CLI
|
data/Gemfile.lock
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: https://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
power_assert (3.0
|
|
5
|
-
rake (13.
|
|
4
|
+
power_assert (3.1.0)
|
|
5
|
+
rake (13.4.2)
|
|
6
6
|
rexml (3.4.4)
|
|
7
|
-
test-unit (3.7.
|
|
7
|
+
test-unit (3.7.8)
|
|
8
8
|
power_assert
|
|
9
|
-
yard (0.9.
|
|
9
|
+
yard (0.9.45)
|
|
10
10
|
|
|
11
11
|
PLATFORMS
|
|
12
|
-
|
|
13
|
-
arm64-darwin-23
|
|
14
|
-
arm64-darwin-24
|
|
12
|
+
ruby
|
|
15
13
|
|
|
16
14
|
DEPENDENCIES
|
|
17
15
|
rake
|
|
@@ -19,5 +17,13 @@ DEPENDENCIES
|
|
|
19
17
|
test-unit
|
|
20
18
|
yard
|
|
21
19
|
|
|
20
|
+
CHECKSUMS
|
|
21
|
+
bundler (4.0.20) sha256=7978a8ac648767f5e635bc522445b79e80a52b907a39a36c2d8085ed6bc762ae
|
|
22
|
+
power_assert (3.1.0) sha256=fefe98ed5d3140628138f3f9f9194d6ece01f1320e69700d3c928adca7518251
|
|
23
|
+
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
|
|
24
|
+
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
|
|
25
|
+
test-unit (3.7.8) sha256=689d1ca53f4d46f678b4e5d68d8e4294f87fc5e8b9238cc4de7c5727e8d65943
|
|
26
|
+
yard (0.9.45) sha256=52e211493f7cb8a3ebf7e104a25a1e73937a3103092545d34cb88fafebb3dc51
|
|
27
|
+
|
|
22
28
|
BUNDLED WITH
|
|
23
|
-
|
|
29
|
+
4.0.20
|
data/RubySketch.podspec
CHANGED
|
@@ -11,8 +11,8 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = {"xordog" => "xordog@gmail.com"}
|
|
12
12
|
s.homepage = "https://github.com/xord/rubysketch"
|
|
13
13
|
|
|
14
|
-
s.osx.deployment_target = "
|
|
15
|
-
s.ios.deployment_target = "
|
|
14
|
+
s.osx.deployment_target = "11.0"
|
|
15
|
+
s.ios.deployment_target = "14.0"
|
|
16
16
|
|
|
17
17
|
root = "${PODS_ROOT}/#{s.name}"
|
|
18
18
|
exts = File.read(File.expand_path 'Rakefile', __dir__)
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.11.0
|
data/bin/rubysketch
CHANGED
|
@@ -5,13 +5,9 @@ require 'reflex/packager'
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
profile = Reflex::Packager::Profile.new(
|
|
8
|
-
|
|
9
|
-
git: 'https://github.com/xord/rubysketch',
|
|
10
|
-
version: RubySketch::Extension.version,
|
|
11
|
-
libraries: %w[Xot Rucy Beeps Rays Reflex Processing RubySketch],
|
|
12
|
-
extensions: %w[beeps_ext rays_ext reflex_ext],
|
|
8
|
+
extension: RubySketch::Extension,
|
|
13
9
|
config_files: %w[rubysketch.yml rubysketch.yaml],
|
|
14
|
-
|
|
10
|
+
templates: {'main.rb': <<~MAIN, 'rubysketch.yml': <<~CONFIG})
|
|
15
11
|
require 'rubysketch'
|
|
16
12
|
using RubySketch
|
|
17
13
|
|
|
@@ -21,9 +17,13 @@ profile = Reflex::Packager::Profile.new(
|
|
|
21
17
|
|
|
22
18
|
draw do
|
|
23
19
|
background 100
|
|
24
|
-
|
|
25
|
-
ellipse width / 2, height / 2, 100, 100
|
|
20
|
+
text 'hello, world!', 100, 100
|
|
26
21
|
end
|
|
27
|
-
|
|
22
|
+
MAIN
|
|
23
|
+
name: {{name}}
|
|
24
|
+
version: 1.0.0
|
|
25
|
+
#bundle_id: org.xord.rubysketch.example.{{name_id}}
|
|
26
|
+
#icon: icon.png
|
|
27
|
+
CONFIG
|
|
28
28
|
|
|
29
29
|
Reflex::Packager::CLI.new(profile).run ARGV.dup
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
%w[xot rucy beeps rays reflex processing rubysketch]
|
|
2
|
+
.map {|s| File.expand_path "../../#{s}/lib", __dir__}
|
|
3
|
+
.each {|s| $:.unshift s if !$:.include?(s) && File.directory?(s)}
|
|
4
|
+
|
|
5
|
+
require 'rubysketch'
|
|
6
|
+
using RubySketch
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def setup()
|
|
10
|
+
noStroke
|
|
11
|
+
gravity 0, 1000
|
|
12
|
+
|
|
13
|
+
$statics = [
|
|
14
|
+
createSprite(0, height - 10, width, 10),
|
|
15
|
+
createSprite(0, 0, 10, height),
|
|
16
|
+
createSprite(width - 10, 0, 10, height)
|
|
17
|
+
]
|
|
18
|
+
walls = $statics[1..]
|
|
19
|
+
$balls = []
|
|
20
|
+
|
|
21
|
+
# pendulum: snap the hanging ball to the anchor
|
|
22
|
+
pivot = anchor 100, 100
|
|
23
|
+
weight = ball 170, 100, 30
|
|
24
|
+
pivot.snap weight
|
|
25
|
+
|
|
26
|
+
# motored arm: half a turn per second
|
|
27
|
+
hinge = anchor 250, 100
|
|
28
|
+
arm = ball 250, 140, 20
|
|
29
|
+
hinge.snap arm, motor: PI
|
|
30
|
+
|
|
31
|
+
# spring chain: balls linked with springs
|
|
32
|
+
prev = anchor 400, 60
|
|
33
|
+
4.times do |i|
|
|
34
|
+
node = ball 400, 100 + i * 40, 20
|
|
35
|
+
node.link prev, spring: 4, damping: 0.5, collide: true
|
|
36
|
+
prev = node
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# car: each tire rides on the body with a wheel constraint -- a vertical
|
|
40
|
+
# suspension spring and a drive motor, reversed whenever the body bumps
|
|
41
|
+
# into a wall
|
|
42
|
+
body = createSprite 60, height - 80, 60, 14
|
|
43
|
+
body.dynamic = true
|
|
44
|
+
axles = [10, 50].map do |x|
|
|
45
|
+
tire = ball 50 + x, height - 60, 18
|
|
46
|
+
tire.pin(9, 9).wheel body.pin(x, 12),
|
|
47
|
+
axis: [0, 1], spring: 6, damping: 0.7, motor: TWO_PI
|
|
48
|
+
end
|
|
49
|
+
body.contact do |o|
|
|
50
|
+
axles.each {|a| a.motor = -a.motor} if walls.include?(o)
|
|
51
|
+
end
|
|
52
|
+
$car = body
|
|
53
|
+
|
|
54
|
+
# chaser: follows the mouse pointer with a soft spring
|
|
55
|
+
chaser = ball 100, 300, 24
|
|
56
|
+
chaser.gravityScale = 0
|
|
57
|
+
chaser.sensor = true # do not bump the pendulum
|
|
58
|
+
$chase = chaser.chase [100, 300], spring: 2, damping: 0.7
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def draw()
|
|
62
|
+
background 0
|
|
63
|
+
|
|
64
|
+
$chase.target = [mouseX, mouseY]
|
|
65
|
+
|
|
66
|
+
fill 200
|
|
67
|
+
sprite *$statics
|
|
68
|
+
fill 240, 240, 240
|
|
69
|
+
sprite $car
|
|
70
|
+
fill 150, 240, 150
|
|
71
|
+
sprite *$balls
|
|
72
|
+
|
|
73
|
+
textSize 16
|
|
74
|
+
fill 255, 200, 150
|
|
75
|
+
text "#{frameRate.to_i} FPS - the ball chases the mouse pointer", 20, 30
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def ball(x, y, size)
|
|
79
|
+
sp = createSprite x, y, shape: Circle.new(0, 0, size)
|
|
80
|
+
sp.dynamic = true
|
|
81
|
+
$balls << sp
|
|
82
|
+
sp
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def anchor(x, y)
|
|
86
|
+
sp = createSprite x, y, 10, 10 # static by default
|
|
87
|
+
$statics << sp
|
|
88
|
+
sp
|
|
89
|
+
end
|
data/lib/rubysketch/all.rb
CHANGED