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
  •  
  •  
  •  
55 changes: 37 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ env:
run-name: 'build@c++${{ inputs.cxxstd || 23 }}'

jobs:
format-check:
uses: ./.github/workflows/clang-format.yml
with:
lint_mode: check_only

win32:
needs: [format-check]
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
Expand All @@ -55,6 +61,7 @@ jobs:
path: |
build/bin/cpp-tests/**/*
win32-arm64:
needs: [format-check]
runs-on: windows-11-arm
steps:
- uses: actions/checkout@v6
Expand All @@ -70,29 +77,33 @@ jobs:
axmol new HelloCpp
axmol -d .\HelloCpp -xc '-DAX_PREBUILT_DIR=build' -O3
winuwp:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
needs: [format-check]
runs-on: windows-latest
steps:
- uses: actions/checkout@v6

- name: Build
shell: pwsh
run: .\tools\cmdline\axmol -p winuwp -a x64 -O3 -xc '-DAX_RENDER_API=d3d11;d3d12;gl'
- name: Build
shell: pwsh
run: .\tools\cmdline\axmol -p winuwp -a x64 -O3 -xc '-DAX_RENDER_API=d3d11;d3d12;gl'
win32-clang:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
needs: [format-check]
runs-on: windows-latest
steps:
- uses: actions/checkout@v6

- name: Build
shell: pwsh
run: .\tools\cmdline\axmol -p win32 -a 'x64' -cc clang -O3 -xc '-DAX_RENDER_API=d3d11;d3d12;gl;vk'
- name: Build
shell: pwsh
run: .\tools\cmdline\axmol -p win32 -a 'x64' -cc clang -O3 -xc '-DAX_RENDER_API=d3d11;d3d12;gl;vk'
win32-dll:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Build
shell: pwsh
run: .\tools\cmdline\axmol -p win32 -a x64 -dll -xc '-DAX_RENDER_API=d3d11;d3d12;gl;vk'
needs: [format-check]
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Build
shell: pwsh
run: .\tools\cmdline\axmol -p win32 -a x64 -dll -xc '-DAX_RENDER_API=d3d11;d3d12;gl;vk'
linux:
needs: [format-check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
Expand All @@ -106,6 +117,7 @@ jobs:
shell: pwsh
run: ./tools/cmdline/axmol -p linux -a x64 -t 'cpp-tests,lua-tests' -xc '-DAX_RENDER_API=vk;gl' && ./tools/cmdline/axmol run -p linux -a x64 -t unit-tests -wait
linux-arm64:
needs: [format-check]
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v6
Expand All @@ -119,6 +131,7 @@ jobs:
shell: pwsh
run: ./tools/cmdline/axmol -p linux -a arm64 -t 'cpp-tests,lua-tests' -xc '-DAX_RENDER_API=vk;gl' && ./tools/cmdline/axmol run -p linux -a arm64 -t unit-tests -wait
osx-arm64:
needs: [format-check]
runs-on: macos-15
steps:
- uses: actions/checkout@v6
Expand All @@ -130,6 +143,7 @@ jobs:
shell: pwsh
run: ./tools/cmdline/axmol -p osx -a arm64 && ./tools/cmdline/axmol run -p osx -a arm64 -t unit-tests
osx-x64:
needs: [format-check]
runs-on: macos-15-intel
steps:
- uses: actions/checkout@v6
Expand All @@ -141,6 +155,7 @@ jobs:
shell: pwsh
run: ./tools/cmdline/axmol -p osx -a x64
android:
needs: [format-check]
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -166,6 +181,7 @@ jobs:
templates/**/*.apk
tests/**/*.apk
ios-sim-x64:
needs: [format-check]
runs-on: macos-15
strategy:
matrix:
Expand All @@ -184,6 +200,7 @@ jobs:
shell: pwsh
run: ./tools/cmdline/axmol -p $env:TARGET_OS -a 'x64'
ios-sim-arm64:
needs: [format-check]
runs-on: macos-15
strategy:
matrix:
Expand All @@ -203,6 +220,7 @@ jobs:
# axmol cmdline can't guess ios arm64 as simulator, so need specify by option '-sdk'
run: ./tools/cmdline/axmol -p $env:TARGET_OS -a 'arm64' -sdk 'simulator'
wasm:
needs: [format-check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
Expand All @@ -216,6 +234,7 @@ jobs:
path: build_wasm/bin/**/*
if-no-files-found: error
wasm64:
needs: [format-check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
Expand Down
69 changes: 55 additions & 14 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: clang-format

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- dev
workflow_dispatch:
inputs:
lint_mode:
Expand All @@ -16,18 +12,50 @@ on:
- check_only
- create_pr
- auto_commit

workflow_call:
inputs:
lint_mode:
description: 'Select lint mode: check_only, auto_commit, or create_pr'
required: false
default: 'check_only'
type: string
should_run:
description: 'Whether clang-format should actually run'
required: false
default: true
type: boolean
head_repo:
description: 'Repository to checkout'
required: false
default: ''
type: string
head_ref:
description: 'Ref to checkout'
required: false
default: ''
type: string

issue_comment:
types: [created] # Listen for new comments on issues/PRs

jobs:
clang-format-lint:
runs-on: ubuntu-latest
# Run if:
# - PR event
# - workflow_dispatch
# - pull_request/push from build.yml reusable workflow calls
# - issue_comment on a PR with /clang-format AND commenter is halx99
#
# Note:
# When called from build.yml, github.event_name keeps the caller event name
# such as pull_request, push, or workflow_dispatch. It is not workflow_call.
# The job itself must not be skipped when should_run is false; only the
# clang-format steps should be skipped so build.yml jobs that need
# [format-check] can continue.
if: |
(github.event_name == 'pull_request') ||
(github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch') ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
Expand Down Expand Up @@ -60,11 +88,13 @@ jobs:
core.setOutput('head_ref', pr.head.ref);
core.setOutput('head_repo', pr.head.repo.full_name);

# Determine lint_mode to auto_commit if triggered by /clang-format comment and store head commit sha
# Determine whether to run, checkout target, and lint mode
- name: Prepare clang-format lint
id: pp
shell: pwsh
run: |
$should_run = '${{ inputs.should_run || true }}'

if ($env:GITHUB_EVENT_NAME -eq 'issue_comment') {
$head_repo = "${{ steps.pr.outputs.head_repo }}"
$head_ref = "${{ steps.pr.outputs.head_ref }}"
Expand All @@ -77,30 +107,41 @@ jobs:
$head_repo = "${{ github.repository }}"
$head_ref = "${{ github.head_ref || github.ref_name }}"
}
if (!$head_repo -or !$head_ref) {

if ($should_run -eq 'true' -and (!$head_repo -or !$head_ref)) {
Write-Error "❌ head_repo or head_ref is empty"
exit 1
}

if ($env:GITHUB_EVENT_NAME -eq 'issue_comment') {
echo "Set lint_mode=auto_commit for ${{ github.event.comment.user.login }} Command **/clang-format**"
$lint_mode = 'auto_commit'
}
else {
$lint_mode = "${{ inputs.lint_mode || 'check_only' }}"
}

echo "should_run=$should_run" >> ${env:GITHUB_OUTPUT}
echo "head_repo=$head_repo" >> ${env:GITHUB_OUTPUT}
echo "head_ref=$head_ref" >> ${env:GITHUB_OUTPUT}
echo "lint_mode=$lint_mode" >> ${env:GITHUB_OUTPUT}
Write-Host "head_repo=$head_repo, head_ref=$head_ref, lint_mode=$lint_mode"

Write-Host "should_run=$should_run, head_repo=$head_repo, head_ref=$head_ref, lint_mode=$lint_mode"

- name: Skip clang-format
if: ${{ steps.pp.outputs.should_run != 'true' }}
run: echo "clang-format skipped for this caller event."

# Checkout correct branch
- uses: actions/checkout@v6
if: ${{ steps.pp.outputs.should_run == 'true' }}
with:
repository: ${{ steps.pp.outputs.head_repo }}
ref: ${{ steps.pp.outputs.head_ref }}
token: ${{ secrets.AX_BOT_TOKEN || github.token }}

- name: Run clang-format lint
if: ${{ steps.pp.outputs.should_run == 'true' }}
uses: DoozyX/clang-format-lint-action@v0.20
with:
source: './axmol ./extensions ./tests ./templates'
Expand All @@ -111,7 +152,7 @@ jobs:

# check_only mode
- name: Check for uncommitted changes
if: ${{ steps.pp.outputs.lint_mode == 'check_only' }}
if: ${{ steps.pp.outputs.should_run == 'true' && steps.pp.outputs.lint_mode == 'check_only' }}
shell: pwsh
run: |
git diff --quiet
Expand All @@ -127,7 +168,7 @@ jobs:
}

- name: Prepare for create pull request
if: ${{ steps.pp.outputs.lint_mode == 'create_pr' }}
if: ${{ steps.pp.outputs.should_run == 'true' && steps.pp.outputs.lint_mode == 'create_pr' }}
id: ppr
shell: pwsh
run: |
Expand All @@ -137,7 +178,7 @@ jobs:

# create_pr mode
- name: Create pull request
if: ${{ steps.pp.outputs.lint_mode == 'create_pr' }}
if: ${{ steps.pp.outputs.should_run == 'true' && steps.pp.outputs.lint_mode == 'create_pr' }}
id: cpr
uses: peter-evans/create-pull-request@v8
with:
Expand All @@ -162,14 +203,14 @@ jobs:
draft: false

- name: Check pull request outputs
if: ${{ steps.pp.outputs.lint_mode == 'create_pr' && steps.cpr.outputs.pull-request-number }}
if: ${{ steps.pp.outputs.should_run == 'true' && steps.pp.outputs.lint_mode == 'create_pr' && steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

# auto_commit mode (including comment trigger)
# auto_commit mode, including comment trigger
- name: Commit clang-format changes to PR source branch
if: ${{ steps.pp.outputs.lint_mode == 'auto_commit' }}
if: ${{ steps.pp.outputs.should_run == 'true' && steps.pp.outputs.lint_mode == 'auto_commit' }}
uses: EndBug/add-and-commit@v10
with:
author_name: axmol-bot
Expand Down
2 changes: 2 additions & 0 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ if((WINDOWS AND NOT WINRT) OR MACOSX OR LINUX)
list(APPEND _glfw_options "GLFW_BUILD_X11 ON")
if(AX_ENABLE_WAYLAND)
list(APPEND _glfw_options "GLFW_BUILD_WAYLAND ON")
else()
list(APPEND _glfw_options "GLFW_BUILD_WAYLAND OFF")
endif()
endif()
ax_add_3rd(glfw OPTIONS ${_glfw_options})
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

## glfw
- [![Upstream](https://img.shields.io/github/v/release/glfw/glfw?label=Upstream)](https://github.com/glfw/glfw)
- Version: 3.5-2f3efb7 of https://github.com/axmolengine/glfw
- Version: 3.5-12d2696 of https://github.com/axmolengine/glfw
- License: zlib

## ghc (iOS < 13 ONLY)
Expand Down
28 changes: 28 additions & 0 deletions 3rdparty/glfw/src/cocoa_window.m
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,34 @@ - (void)keyUp:(NSEvent *)event
_glfwInputKey(window, key, [event keyCode], GLFW_RELEASE, mods);
}

- (BOOL)performKeyEquivalent:(NSEvent *)event
{
// HACK: Some key combinations are consumed before reaching keyDown:
// so we claim those events and emit them here
const int key = translateKey([event keyCode]);
const int mods = translateFlags([event modifierFlags]);

if (mods & GLFW_MOD_CONTROL)
{
if (key == GLFW_KEY_TAB || key == GLFW_KEY_ESCAPE)
{
_glfwInputKey(window, key, [event keyCode], GLFW_PRESS, mods);
return YES;
}
}

if (mods & GLFW_MOD_SUPER)
{
if (key == GLFW_KEY_PERIOD)
{
_glfwInputKey(window, key, [event keyCode], GLFW_PRESS, mods);
return YES;
}
}

return [super performKeyEquivalent:event];
}

- (void)scrollWheel:(NSEvent *)event
{
double deltaX = [event scrollingDeltaX];
Expand Down
2 changes: 1 addition & 1 deletion CMakeOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- AX_ENABLE_3D: whether to enable 3D support, default: `TRUE`
- AX_ENABLE_PHYSICS_3D: whether to enable physics3d support, default: `TRUE`
- AX_ENABLE_NAVMESH: whether to enable NavMesh support default: `TRUE`
- AX_ENABLE_MEDIA: whether to enable media support, default: `TRUE`
- AX_ENABLE_VIDEO: whether to enable video player, default: `TRUE`
- AX_ENABLE_AUDIO: whether to enable audio support, default: `TRUE`
- AX_ENABLE_CONSOLE: whether to enable debug tool console support, default: `TRUE`
- AX_ENABLE_OPUS: whether to enable audio engine play .opus files support, default: `TRUE`
Expand Down
2 changes: 1 addition & 1 deletion INFRA.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Microsoft.Windows.CppWinRT

- [![nuget](https://img.shields.io/nuget/v/Microsoft.Windows.CppWinRT?label=Upstream)](https://www.nuget.org/packages/Microsoft.Windows.CppWinRT)
- Version: 2.0.250303.1
- Version: 3.0.260520.1
- License: MIT
- Platform: WinRT/WinUWP
- Manged by: `cmake/Modules/AXConfigDefine.cmake`
Expand Down
4 changes: 2 additions & 2 deletions axmol/2d/ActionInterval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ THE SOFTWARE.
#include "axmol/2d/SpriteFrame.h"
#include "axmol/2d/ActionInstant.h"
#include "axmol/base/Director.h"
#include "axmol/base/EventCustom.h"
#include "axmol/base/CustomEvent.h"
#include "axmol/base/EventDispatcher.h"
#include "axmol/platform/StdC.h"
#include "axmol/base/ScriptSupport.h"
Expand Down Expand Up @@ -2591,7 +2591,7 @@ void Animate::update(float t)
if (!dict.empty())
{
if (_frameDisplayedEvent == nullptr)
_frameDisplayedEvent = new EventCustom(AnimationFrameDisplayedNotification);
_frameDisplayedEvent = new CustomEvent(AnimationFrameDisplayedNotification);

_frameDisplayedEventInfo.target = _target;
_frameDisplayedEventInfo.userInfo = &dict;
Expand Down
Loading
Loading