Skip to content
This repository has been archived by the owner on Jun 29, 2024. It is now read-only.

Commit

Permalink
update box2d to use custom fork
Browse files Browse the repository at this point in the history
update

upd
  • Loading branch information
Ughuuu committed Jul 22, 2023
1 parent b923241 commit 4458a79
Show file tree
Hide file tree
Showing 36 changed files with 413 additions and 98 deletions.
10 changes: 1 addition & 9 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Physics Server Box2D Build
description: Build Godot Cpp and the Physics Server 2D Extension. Also uploads the artifacts.
description: Build Godot Cpp and the Physics Server 2D Extension.

inputs:
platform:
Expand Down Expand Up @@ -46,11 +46,3 @@ runs:
SCONS_CACHE_DIR: .scons-cache
run: |
scons target=${{ inputs.target }} platform=${{ inputs.platform }} arch=${{ inputs.arch }} generate_bindings=no ${{ inputs.sconsflags }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Physics Server Box2D - ${{ matrix.os }}
path: |
${{ github.workspace }}/demo/bin/
${{ github.workspace }}/demo/physics_server_box2d.gdextension
retention-days: 14
13 changes: 13 additions & 0 deletions .github/actions/upload/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Physics Server Box2D Upload
description: Upload Godot Cpp and the Physics Server 2D Extension.

runs:
using: composite
steps:
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Physics Server Box2D
path: |
${{ github.workspace }}/dist/**
retention-days: 14
3 changes: 3 additions & 0 deletions .github/workflows/android_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ jobs:
arch: ${{ matrix.arch }}
platform: android
target: ${{ matrix.target }}

- name: Upload ${{ matrix.target }} ${{ matrix.arch }}
uses: ./.github/actions/upload
82 changes: 82 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '34 1 * * 3'

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
3 changes: 3 additions & 0 deletions .github/workflows/ios_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ jobs:
arch: ${{ matrix.arch }}
platform: ios
target: ${{ matrix.target }}

- name: Upload ${{ matrix.target }} ${{ matrix.arch }}
uses: ./.github/actions/upload
4 changes: 4 additions & 0 deletions .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ jobs:
arch: ${{ matrix.arch }}
platform: linux
target: ${{ matrix.target }}

- name: Upload ${{ matrix.target }} ${{ matrix.arch }}
uses: ./.github/actions/upload

13 changes: 13 additions & 0 deletions .github/workflows/macos_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,16 @@ jobs:
arch: ${{ matrix.arch }}
platform: macos
target: ${{ matrix.target }}

- name: Sign frameworks
shell: pwsh
env:
APPLE_CERT_BASE64: ${{ secrets.PROD_MACOS_CERTIFICATE }}
APPLE_CERT_PASSWORD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }}
APPLE_DEV_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
APPLE_DEV_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
APPLE_DEV_PASSWORD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }}
run: gci -R ./dist/*.framework | ./scripts/ci_sign_macos.ps1

- name: Upload ${{ matrix.target }} ${{ matrix.arch }}
uses: ./.github/actions/upload
4 changes: 4 additions & 0 deletions .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ jobs:
- name: Clang Format
shell: sh
run: ./scripts/clang-format.sh

- name: Upload ${{ matrix.target }} ${{ matrix.arch }}
uses: ./.github/actions/upload

4 changes: 4 additions & 0 deletions .github/workflows/windows_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ jobs:
arch: ${{ matrix.arch }}
platform: windows
target: ${{ matrix.target }}

- name: Upload ${{ matrix.target }} ${{ matrix.arch }}
uses: ./.github/actions/upload

5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# Godot 4+ specific ignores
demo/.godot/

# Binaries
*.os
*.dblite

# Generated directories with binaries
demo/bin/
dist/**

.DS_Store
.vscode
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
url = https://github.com/godotengine/godot-cpp
[submodule "box2d"]
path = box2d
url = https://github.com/erincatto/box2d
url = https://github.com/godot-box2d/box2d
branch = common-assert-noop
29 changes: 9 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
# PhysicsServerBox2D
![Box2D Logo](box2d_icon.svg)

An unofficial [**Box2D**](https://github.com/erincatto/box2d) physics server for [**Godot Engine**](https://github.com/godotengine/godot) 4.1, implemented as a GDExtension.
# Build Status
[![🔗 Build Status](https://github.com/godot-box2d/godot-box2d/actions/workflows/runner.yml/badge.svg)](https://github.com/godot-box2d/godot-box2d/actions/workflows/runner.yml)

The goal of the project is to be a drop-in solution for 2D physics in Godot 4.1. In your Godot project you can load the GDExtension, change the (advanced) project setting `physics/2d/physics_engine` to `Box2D`, and it will work with Godot's original 2D physics nodes such as `RigidBody2D` and `StaticBody2D`.
Based of [rburing/physics_server_box2d](https://github.com/rburing/physics_server_box2d).

## Current state
A [box2D](https://github.com/erincatto/box2d) physics server for [Godot Engine](https://github.com/godotengine/godot) 4.1, implemented as a GDExtension.

⚠ This project is a work in progress. ⚠

Missing functionality:

- Pickable not implemented
- Collision layer and mask don't work same as in godot
- Torque and rotation doesn't work same as in godot (different values)
- Skewed/scaled shapes.
- Separation Ray works as a segment.
- Pin joint doesn't have softness
- Some joint properties(max force, etc.)

Things that work:
## Features

Bodies:
- [x] Rigid Body
Expand Down Expand Up @@ -46,7 +35,7 @@ Direct State:
- [x] Direct Space State


## Install from build binaries
## Install from binaries

Currently it's built automatically for:

Expand Down Expand Up @@ -101,6 +90,6 @@ sed -i '' 's/#define b2Assert(A) assert(A)/#define b2Assert(A) ((void)(A))/g' ./

*Note*: The `template_debug` target can also be loaded in the Godot editor.

## Demo
## Lint

The Godot project in the `demo` subdirectory is an example of how to load the GDExtension.
Run `scripts/clang-tidy.sh` in order to lint.
4 changes: 2 additions & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ sources.extend([box2d_folder + 'src/' + box2d_src_file for box2d_src_file in box

if env["platform"] == "macos":
library = env.SharedLibrary(
"demo/addons/physics_server_box2d/bin/libphysics_server_box2d.{}.{}.framework/libphysics_server_box2d.{}.{}".format(
"dist/addons/physics_server_box2d/bin/libphysics_server_box2d.{}.{}.framework/libphysics_server_box2d.{}.{}".format(
env["platform"], env["target"], env["platform"], env["target"]
),
source=sources,
)
else:
library = env.SharedLibrary(
"demo/addons/physics_server_box2d/bin/libphysics_server_box2d{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),
"dist/addons/physics_server_box2d/bin/libphysics_server_box2d{}{}".format(env["suffix"], env["SHLIBSUFFIX"]),
source=sources,
)

Expand Down
2 changes: 1 addition & 1 deletion box2d
Submodule box2d updated from 411acc to 45a785
126 changes: 126 additions & 0 deletions box2d_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4458a79

Please sign in to comment.