Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update physics #5

Merged
merged 9 commits into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Physics Flatpak

Physics is a physical world simulator and playground. You can add squares, circles, triangles, or draw your own shapes, and see them come to life with forces, friction, and inertia.

To know more refer: https://github.com/sugarlabs/physics

## How To Build

```
git clone https://github.com/flathub/org.sugarlabs.Physics.git
cd org.sugarlabs.Physics
flatpak -y --user install org.gnome.{Platform,Sdk}//44
flatpak-builder --user --force-clean --install build org.sugarlabs.Physics.json
```

## Check For Updates

Install the flatpak external data checker
```
flatpak --user install org.flathub.flatpak-external-data-checker
```

Now to update every single module to the latest stable version use
```
cd org.sugarlabs.Physics
flatpak run --filesystem=$PWD org.flathub.flatpak-external-data-checker org.sugarlabs.Physics.json
```
90 changes: 69 additions & 21 deletions org.sugarlabs.Physics.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"app-id": "org.sugarlabs.Physics",
"base": "org.sugarlabs.BaseApp",
"base-version": "21.04",
"base-version": "23.06",
"runtime": "org.gnome.Platform",
"runtime-version": "40",
"runtime-version": "44",
"sdk": "org.gnome.Sdk",
"separate-locales": false,
"command": "sugarapp",
Expand All @@ -23,32 +23,78 @@
"/share/man"
],
"modules": [
"shared-modules/pygame/pygame-1.9.4.json",
{
"name": "swig",
"cleanup": [ "*" ],
"name": "pygame2",
"sources": [
{
"type": "archive",
"url": "https://github.com/swig/swig/archive/rel-3.0.8.tar.gz",
"sha256": "b00a4d54681ce0ab91d45dfbc89ebc400f4a05ba9cf217b459a521f9c0b9108e"
"url": "https://files.pythonhosted.org/packages/59/2a/cf94cd20b993baa764e3e7eae9e7084ca2d04c5e3f74eacf8f1ea62d9be9/pygame-2.5.0.tar.gz",
"sha256": "edd5745b79435976d92c0a7318aedcafcb7ac4567125ac6ba88aa473559ef9ab",
"x-checker-data": {
"type": "pypi",
"name": "pygame"
}
}
]
},
{
"name": "box2d",
],
"buildsystem": "simple",
"build-commands": [
"pip3 install --no-index --find-links \"file://${PWD}\" --prefix=${FLATPAK_DEST} box2d"
"pip3 install --ignore-installed --no-deps --prefix=/app ."
],
"build-options": {
"env": {
"PORTMIDI_INC_PORTTIME": "1",
"PYGAME_EXTRA_BASE": "/app"
},
"arch": {
"aarch64": {
"env": {
"ORIGLIBDIRS": "/lib:/lib64:/lib/aarch64-linux-gnu"
}
},
"x86_64": {
"env": {
"ORIGLIBDIRS": "/lib:/lib64:/lib/x86_64-linux-gnu"
}
}
}
}
},
{
"name": "swig",
"cleanup": [ "*" ],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/cc/7b/ddb96fea1fa5b24f8929714ef483f64c33e9649e7aae066e5f5023ea426a/Box2D-2.3.2.tar.gz",
"sha256": "d1557dffdf9c1d6c796ec5df53e3d93227bb026c14b8411d22c295edaa2fb225"
"type": "git",
"url": "https://github.com/swig/swig.git",
"tag": "v4.1.1",
"commit": "77323a0f07562b7d90d36181697a72a909b9519a",
"x-checker-data": {
"type": "git",
"tag-pattern": "^(?:v|rel-)([\\d.]+)$"
}
}
]
},
{
"name": "box2d",
"buildsystem": "simple",
"build-commands": [
"python3 setup.py build_ext --inplace",
"pip3 install --no-index --find-links \"file://${PWD}\" --prefix=${FLATPAK_DEST} ."
],
"sources": [
{
"type": "git",
"url": "https://github.com/pybox2d/pybox2d.git",
"tag": "2.3.10",
"commit": "ed9d7b04f7099a15984c727dbce46c13abd64409",
"x-checker-data": {
"type": "git",
"tag-pattern": "^([\\d.]+)$"
}
}
]
},
{
"name": "physics",
"buildsystem": "simple",
Expand All @@ -59,24 +105,28 @@
{
"type": "git",
"url": "https://github.com/sugarlabs/physics.git",
"commit": "12c5f706ad57ab236d615029021d1fc6af306bd9"
"commit": "cfd17b82b783f1ce4952ccdef6a8ddbe3d8f3e46"
},
{
"type": "patch",
"path": "physics-port.patch"
},
{
"type": "patch",
"path": "physics-monitors.patch"
"path": "physics-fix-destroy.patch"
},
{
"type": "patch",
"path": "physics-fix-load.patch"
"path": "physics-monitors.patch"
},
{
"type": "patch",
"path": "physics-fix-save.patch"
},
{
"type": "patch",
"path": "physics-fix-sugargame.patch"
},
{
"type": "patch",
"path": "physics-fix-remove-joint.patch"
Expand All @@ -92,9 +142,7 @@
"install -D activity/mimetypes.xml /app/share/mime/packages/org.sugarlabs.Physics.xml",
"install -D appdata /app/share/metainfo/org.sugarlabs.Physics.appdata.xml",
"install -D desktop /app/share/applications/org.sugarlabs.Physics.desktop",
"install -D activity/activity-physics.svg /app/share/icons/hicolor/scalable/apps/org.sugarlabs.Physics.svg",
"rm /app/share/sugar/activities/Physics.activity/samples/example-1.json",
"rm /app/share/sugar/activities/Physics.activity/samples/thumbnails/example-1.png"
"install -D activity/activity-physics.svg /app/share/icons/hicolor/scalable/apps/org.sugarlabs.Physics.svg"
]
}
]
Expand Down
14 changes: 14 additions & 0 deletions physics-fix-destroy.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/tools.py b/tools.py
index 78108fe..3f3c4b3 100644
--- a/tools.py
+++ b/tools.py
@@ -98,7 +98,8 @@ class Tool(object):
elif event.action == 'clear_all':
# Get bodies and destroy them too
for body in self.game.world.world.bodies:
- self.game.world.world.DestroyBody(body)
+ if body != self.game.world.world.groundBody:
+ self.game.world.world.DestroyBody(body)

# Add ground, because we destroyed it before
self.game.world.add.ground()
47 changes: 0 additions & 47 deletions physics-fix-load.patch

This file was deleted.

54 changes: 54 additions & 0 deletions physics-fix-samples.patch

Large diffs are not rendered by default.

Loading