Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .github/ci/ci-members.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@
"CodenameOne/src/com/codename1/db/sql/**",
"CodenameOne/src/com/codename1/hardware/**",
"CodenameOne/src/com/codename1/realtime/**",
"CodenameOne/src/com/codename1/gaming/platformer/*.java",
"CodenameOne/src/com/codename1/qrcode/QrCode.java",
"CodenameOne/src/com/codename1/impl/office/Snappy.java",
"CodenameOne/src/com/codename1/impl/MdnsEngine.java",
Expand Down Expand Up @@ -735,6 +736,7 @@
"scripts/splat/**",
"scripts/skirmish/**",
"scripts/papercut/**",
"scripts/ledge/**",
"scripts/dash/**",
"scripts/parley/**",
"scripts/hellocodenameone/common/src/main/kmp/**",
Expand Down Expand Up @@ -779,6 +781,7 @@
"scripts/splat/**",
"scripts/skirmish/**",
"scripts/papercut/**",
"scripts/ledge/**",
"scripts/dash/**",
"scripts/parley/**",
"scripts/hellocodenameone/common/src/main/kmp/**",
Expand Down Expand Up @@ -816,6 +819,7 @@
"scripts/splat/**",
"scripts/skirmish/**",
"scripts/papercut/**",
"scripts/ledge/**",
"scripts/dash/**",
"scripts/hellocodenameone/common/src/main/kmp/**",
"docs/website/content/blog/**",
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/developer-guide-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
- 'scripts/bazaar/**'
- 'scripts/skirmish/**'
- 'scripts/papercut/**'
- 'scripts/ledge/**'
- 'scripts/dash/**'
- 'scripts/parley/**'
- 'scripts/reel/**'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/initializr-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ on:
- 'scripts/bazaar/common/src/test/**'
- 'scripts/skirmish/common/src/test/**'
- 'scripts/papercut/common/src/test/**'
- 'scripts/ledge/common/src/test/**'
- 'scripts/dash/common/src/test/**'
- 'scripts/parley/common/src/test/**'
- 'scripts/reel/common/src/test/**'
Expand Down Expand Up @@ -62,7 +63,7 @@ jobs:
strategy:
fail-fast: false
matrix:
template: [BAREBONES, KOTLIN, WAYLINE, SAVOR, SKIRMISH, DASH, SPLAT, PAPERCUT, PARLEY, BASTION, REEL, PULSE, SLATE, FIELDLINE, BAZAAR]
template: [BAREBONES, KOTLIN, WAYLINE, SAVOR, SKIRMISH, DASH, SPLAT, PAPERCUT, PARLEY, BASTION, REEL, PULSE, SLATE, FIELDLINE, BAZAAR, LEDGE]
java: ['17']
# Developers download on current JDKs too: Kotlin 1.6.0 crashed on 25
# ("IllegalArgumentException: 25") while every 17 leg was green.
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/samples-ios-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
# Watch-app samples (dash, pulse, splat, slate) are the slow ones;
# they are split across the shards.
- shard: a
samples: ' parley savor dash pulse bastion fieldline papercut '
samples: ' parley savor dash pulse bastion fieldline papercut ledge '
- shard: b
samples: ' wayline reel splat slate skirmish bazaar '
steps:
Expand Down Expand Up @@ -195,4 +195,7 @@ jobs:
- name: 'iOS: papercut'
if: ${{ !cancelled() && contains(matrix.samples, ' papercut ') }}
run: scripts/ci/build-sample-ios-simulator.sh scripts/papercut
- name: 'iOS: ledge'
if: ${{ !cancelled() && contains(matrix.samples, ' ledge ') }}
run: scripts/ci/build-sample-ios-simulator.sh scripts/ledge
timeout-minutes: 45
135 changes: 133 additions & 2 deletions .github/workflows/samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ on:
- scripts/ci/start-test-database.sh
- scripts/dash/**
- scripts/fieldline/**
- scripts/ledge/**
- scripts/papercut/**
- scripts/parley/**
- scripts/pulse/**
Expand Down Expand Up @@ -85,8 +86,8 @@ jobs:
env:
EVENT: ${{ github.event_name }}
BASE: ${{ github.event.pull_request.base.sha || '' }}
PATHS: '{"bastion": ["scripts/bastion/**", "maven/cn1-app-kit/**"], "bazaar": ["scripts/bazaar/**", "maven/cn1-app-kit/**"], "brickyard": ["scripts/brickyard/**"], "dash": ["scripts/dash/**", "maven/cn1-app-kit/**"], "fieldline": ["scripts/fieldline/**", "maven/cn1-app-kit/**"], "papercut": ["scripts/papercut/**"], "parley": ["scripts/parley/**", "maven/cn1-app-kit/**"], "pulse": ["scripts/pulse/**", "maven/cn1-app-kit/**"], "reel": ["scripts/reel/**", "maven/cn1-app-kit/**"], "savor": ["scripts/savor/**", "scripts/ci/sample-server-tests-on-database.sh", "scripts/ci/start-test-database.sh", "scripts/ci/reset-*.sh", "maven/cn1-app-kit/**"], "skirmish": ["scripts/skirmish/**", "maven/cn1-app-kit/**"], "slate": ["scripts/slate/**", "maven/cn1-app-kit/**"], "splat": ["scripts/splat/**"], "wayline": ["scripts/wayline/**", "scripts/ci/sample-server-tests-on-database.sh", "scripts/ci/start-test-database.sh", "scripts/ci/reset-*.sh", "maven/cn1-app-kit/**"]}'
KINDS: '{"android": ["bastion", "bazaar", "dash", "fieldline", "papercut", "parley", "pulse", "reel", "savor", "skirmish", "slate", "splat", "wayline"], "app": ["brickyard"], "backend": ["bastion", "bazaar", "brickyard", "dash", "fieldline", "papercut", "parley", "pulse", "reel", "savor", "skirmish", "slate", "splat", "wayline"], "backend-database": ["bastion", "bazaar", "brickyard", "dash", "fieldline", "papercut", "parley", "pulse", "reel", "savor", "skirmish", "slate", "splat", "wayline"], "chain": ["bastion"], "client-e2e": ["bastion", "bazaar", "dash", "fieldline", "papercut", "parley", "pulse", "reel", "savor", "skirmish", "slate", "splat", "wayline"], "ios": ["bastion", "bazaar", "dash", "fieldline", "papercut", "parley", "pulse", "reel", "savor", "skirmish", "slate", "splat", "wayline"], "rules": ["dash", "skirmish", "splat"], "template-sync": ["bastion", "bazaar", "dash", "fieldline", "papercut", "parley", "pulse", "reel", "savor", "skirmish", "slate", "splat", "wayline"],
PATHS: '{"bastion": ["scripts/bastion/**", "maven/cn1-app-kit/**"], "bazaar": ["scripts/bazaar/**", "maven/cn1-app-kit/**"], "brickyard": ["scripts/brickyard/**"], "dash": ["scripts/dash/**", "maven/cn1-app-kit/**"], "fieldline": ["scripts/fieldline/**", "maven/cn1-app-kit/**"], "ledge": ["scripts/ledge/**"], "papercut": ["scripts/papercut/**"], "parley": ["scripts/parley/**", "maven/cn1-app-kit/**"], "pulse": ["scripts/pulse/**", "maven/cn1-app-kit/**"], "reel": ["scripts/reel/**", "maven/cn1-app-kit/**"], "savor": ["scripts/savor/**", "scripts/ci/sample-server-tests-on-database.sh", "scripts/ci/start-test-database.sh", "scripts/ci/reset-*.sh", "maven/cn1-app-kit/**"], "skirmish": ["scripts/skirmish/**", "maven/cn1-app-kit/**"], "slate": ["scripts/slate/**", "maven/cn1-app-kit/**"], "splat": ["scripts/splat/**"], "wayline": ["scripts/wayline/**", "scripts/ci/sample-server-tests-on-database.sh", "scripts/ci/start-test-database.sh", "scripts/ci/reset-*.sh", "maven/cn1-app-kit/**"]}'
KINDS: '{"android": ["bastion", "bazaar", "dash", "fieldline", "ledge", "papercut", "parley", "pulse", "reel", "savor", "skirmish", "slate", "splat", "wayline"], "app": ["brickyard"], "backend": ["bastion", "bazaar", "brickyard", "dash", "fieldline", "ledge", "papercut", "parley", "pulse", "reel", "savor", "skirmish", "slate", "splat", "wayline"], "backend-database": ["bastion", "bazaar", "brickyard", "dash", "fieldline", "ledge", "papercut", "parley", "pulse", "reel", "savor", "skirmish", "slate", "splat", "wayline"], "chain": ["bastion"], "client-e2e": ["bastion", "bazaar", "dash", "fieldline", "ledge", "papercut", "parley", "pulse", "reel", "savor", "skirmish", "slate", "splat", "wayline"], "ios": ["bastion", "bazaar", "dash", "fieldline", "ledge", "papercut", "parley", "pulse", "reel", "savor", "skirmish", "slate", "splat", "wayline"], "rules": ["dash", "skirmish", "splat"], "template-sync": ["bastion", "bazaar", "dash", "fieldline", "ledge", "papercut", "parley", "pulse", "reel", "savor", "skirmish", "slate", "splat", "wayline"],
"web": ["bastion", "bazaar", "fieldline", "parley", "pulse", "reel", "savor", "slate", "wayline"]}'
run: |
python3 - <<'EOF'
Expand Down Expand Up @@ -143,6 +144,10 @@ jobs:
run: |
python3 scripts/sync-initializr-template.py papercut
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' papercut ') }}
- name: 'ledge: Compare the template with scripts/ledge'
run: |
python3 scripts/sync-initializr-template.py ledge
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' ledge ') }}
- name: 'parley: Compare the template with scripts/parley'
run: python3 scripts/sync-initializr-template.py parley
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' parley ') }}
Expand Down Expand Up @@ -395,6 +400,35 @@ jobs:
path: scripts/papercut/backend/target/surefire-reports/**
if-no-files-found: warn
retention-days: 14
- name: 'ledge: Run the server tests on the JVM and compiled'
working-directory: scripts/ledge
run: |
mvn -B -Dcodename1.platform=backend -pl shared,backend test \
-Dcn1.backend.compiledTests=true \
-Dmaven.repo.local="$GITHUB_WORKSPACE/.m2-repo"
env:
JAVA_HOME: ${{ env.JDK_17_HOME }}
JDK_8_HOME: ${{ env.JDK_8_HOME }}
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' ledge ') }}
- name: 'ledge: Check that both runners reported'
working-directory: scripts/ledge/backend/target/surefire-reports
run: |
jvm=$(find . -maxdepth 1 -name 'TEST-*.xml' ! -name '*-compiled.xml' | wc -l)
compiled=$(find . -maxdepth 1 -name 'TEST-*-compiled.xml' | wc -l)
echo "JVM reports: $jvm, compiled reports: $compiled"
if [ "$jvm" -eq 0 ] || [ "$compiled" -eq 0 ]; then
echo "::error::a runner produced no test reports"
exit 1
fi
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' ledge ') }}
- name: 'ledge: Upload the test reports'
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' ledge ') && (!cancelled()) }}
uses: actions/upload-artifact@v7
with:
name: ledge-backend-tests
path: scripts/ledge/backend/target/surefire-reports/**
if-no-files-found: warn
retention-days: 14
- name: 'parley: Run the server tests on the JVM and compiled'
working-directory: scripts/parley
run: |
Expand Down Expand Up @@ -875,6 +909,26 @@ jobs:
path: scripts/papercut/backend/target/surefire-reports/**
if-no-files-found: warn
retention-days: 14
- name: 'ledge: Run the server tests on ${{ matrix.database }}'
run: |
if [ "${{ matrix.database }}" = mysql ]; then
export CN1_TEST_DATABASE_URL="mysql://cn1:secret@127.0.0.1:3306/cn1?sslmode=disable"
else
export CN1_TEST_DATABASE_URL="postgres://cn1:secret@localhost:5432/cn1?sslmode=disable"
fi
scripts/ci/sample-server-tests-on-database.sh scripts/ledge \
-Dmaven.repo.local="$GITHUB_WORKSPACE/.m2-repo"
env:
JAVA_HOME: ${{ env.JDK_17_HOME }}
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' ledge ') && (matrix.database == 'postgresql' || matrix.database == 'mysql') }}
- name: 'ledge: Upload the test reports'
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' ledge ') && (matrix.database == 'postgresql' || matrix.database == 'mysql') && (always()) }}
uses: actions/upload-artifact@v7
with:
name: ledge-backend-${{ matrix.database }}-tests
path: scripts/ledge/backend/target/surefire-reports/**
if-no-files-found: warn
retention-days: 14
- name: 'parley: Run the server tests on ${{ matrix.database }}'
run: |
if [ "${{ matrix.database }}" = mysql ]; then
Expand Down Expand Up @@ -1228,6 +1282,30 @@ jobs:
scripts/papercut/target/e2e-server.log
if-no-files-found: warn
retention-days: 14
- name: 'ledge: Build a project generated from the Initializr template'
run: |
export JDK_8_HOME="${JAVA_HOME_8}"
export JAVA_HOME="${JAVA_HOME_17}"
export PATH="${JAVA_HOME_17}/bin:$PATH"
scripts/ledge/check-template.sh "$RUNNER_TEMP/ledge-template"
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' ledge ') }}
- name: 'ledge: Run the application against the server'
run: |
export JDK_8_HOME="${JAVA_HOME_8}"
export JAVA_HOME="${JAVA_HOME_17}"
export PATH="${JAVA_HOME_17}/bin:$PATH"
scripts/ledge/run-e2e.sh
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' ledge ') }}
- name: 'ledge: Upload the captures and the server log'
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' ledge ') && (!cancelled()) }}
uses: actions/upload-artifact@v7
with:
name: ledge-e2e
path: |
scripts/ledge/target/e2e-shots/**
scripts/ledge/target/e2e-server.log
if-no-files-found: warn
retention-days: 14
- name: 'parley: Build a project generated from the Initializr template'
run: |
export JDK_8_HOME="${JAVA_HOME_8}"
Expand Down Expand Up @@ -1697,6 +1775,14 @@ jobs:
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' papercut ') }}
env:
CN1_APP_DIR: scripts/papercut
- name: 'ledge: Build the Android application'
run: |
mkdir -p ~/.codenameone
cp maven/UpdateCodenameOne.jar ~/.codenameone/
./scripts/build-android-app.sh -q -DskipTests
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' ledge ') }}
env:
CN1_APP_DIR: scripts/ledge
- name: 'parley: Build the Android application'
run: |
mkdir -p ~/.codenameone
Expand Down Expand Up @@ -1971,6 +2057,51 @@ jobs:
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' papercut ') }}
env:
CN1_APP_DIR: scripts/papercut
- name: 'ledge: Generate the Xcode project'
id: build-ios-app-ledge
run: ./scripts/build-ios-app.sh -q -DskipTests
timeout-minutes: 25
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' ledge ') }}
env:
CN1_APP_DIR: scripts/ledge
- name: 'ledge: Build the application for the simulator'
run: |
set -euo pipefail
WORKSPACE='${{ steps.build-ios-app-ledge.outputs.workspace }}'
SCHEME='${{ steps.build-ios-app-ledge.outputs.scheme }}'
DERIVED_DATA="${{ runner.temp }}/ledge-dd"
rm -rf "$DERIVED_DATA"
# One architecture, the host's: the port's SIMD natives are NEON
# under __aarch64__, and a universal simulator build compiles an
# x86_64 slice that has no use here.
HOST_ARCH="$(uname -m)"
case "$HOST_ARCH" in
arm64|x86_64) BUILD_ARCH="$HOST_ARCH" ;;
*) BUILD_ARCH=arm64 ;;
esac
XCB_CONTAINER_FLAG="-workspace"
if [[ "$WORKSPACE" != *.xcworkspace ]]; then
XCB_CONTAINER_FLAG="-project"
fi
# No -sdk: it forces every target of the scheme onto the iPhone SDK, the
# embedded watch app included, whose watch-only icon then has nothing to
# compile for. The destination picks each target's own SDK.
xcodebuild "$XCB_CONTAINER_FLAG" "$WORKSPACE" -scheme "$SCHEME" \
-configuration Debug \
-destination 'generic/platform=iOS Simulator' \
-derivedDataPath "$DERIVED_DATA" \
ARCHS="$BUILD_ARCH" ONLY_ACTIVE_ARCH=YES \
EXCLUDED_ARCHS="armv7 armv7s" \
CODE_SIGNING_ALLOWED=NO build
APP_BUNDLE="$(find "$DERIVED_DATA/Build/Products" -maxdepth 3 -type d -name "${SCHEME}.app" | head -n 1)"
if [ -z "$APP_BUNDLE" ]; then
echo "::error::no .app bundle under $DERIVED_DATA"
exit 1
fi
timeout-minutes: 20
if: ${{ !cancelled() && contains(needs.select.outputs.samples, ' ledge ') }}
env:
CN1_APP_DIR: scripts/ledge
- name: 'pulse: Generate the Xcode project'
id: build-ios-app-pulse
run: ./scripts/build-ios-app.sh -q -DskipTests
Expand Down
7 changes: 5 additions & 2 deletions CodenameOne/src/com/codename1/gaming/SpriteRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,12 @@ private float[] billboardMatrix(Sprite s) {
float w = s.getRenderWidth() * s.getScaleX();
float h = s.getRenderHeight() * s.getScaleY();

// y-up anchor offset (image y is top-down, world y is up)
// y-up anchor offset. The anchor is in image space, y down, so anchor
// 1 is the bottom edge: the quad must then lie above the position,
// an offset of +0.5. It was 0.5 - anchorY, which hung a sprite
// anchored at its feet one height below the ground it stood on.
float[] anchor = Matrix4.translation(0.5f - (float) s.getAnchorX(),
0.5f - (float) s.getAnchorY(), 0f);
(float) s.getAnchorY() - 0.5f, 0f);
float[] scale = Matrix4.scaling(w, h, 1f);
float[] roll = Matrix4.rotation((float) -Math.toRadians(s.getRotation()), 0f, 0f, 1f);
float[] basis = gameCamera.getBillboardBasis();
Expand Down
51 changes: 51 additions & 0 deletions CodenameOne/src/com/codename1/gaming/physics/ContactFilter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2012, Codename One and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Codename One designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Codename One through http://www.codenameone.com/ if you
* need additional information or have any questions.
*/

package com.codename1.gaming.physics;

/// Decides, step by step, whether two touching bodies in a `PhysicsWorld` push
/// on each other. Install with `PhysicsWorld#setContactFilter(ContactFilter)`.
///
/// Returning false lets the bodies pass through each other for this step only;
/// the question is asked again on the next step while they still overlap. That
/// is how one-way platforms, team pass-through and "ghost" pickups are made --
/// `PhysicsWorld#setOneWay(PhysicsBody, boolean)` is the stock one-way rule.
///
/// Called from inside `PhysicsWorld#step(float)`. Do not create or destroy
/// bodies here.
public interface ContactFilter {
/// Whether two bodies collide this step.
///
/// #### Parameters
///
/// - `a`: one body
/// - `b`: the other
/// - `normalX`: the contact normal from `a` to `b`, screen space
/// - `normalY`: the contact normal from `a` to `b`, screen space (positive is
/// down)
///
/// #### Returns
///
/// false to let them pass through each other this step
boolean shouldCollide(PhysicsBody a, PhysicsBody b, float normalX, float normalY);
}
Loading
Loading