Skip to content

Commit acaeec4

Browse files
committed
Merge branch 'release/2.x' into dev
2 parents 614903b + df10ced commit acaeec4

25 files changed

+371
-222
lines changed

1k/install-pwsh.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mkdir -p $cacheDir
1212

1313
pwsh_ver=$1
1414
if [ "$pwsh_ver" = "" ] ; then
15-
pwsh_ver='7.5.2'
15+
pwsh_ver='7.5.3'
1616
fi
1717

1818
pwsh_min_ver=$2

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,19 @@
1515
- Add new API `EventKeyboard::isRepeat` by @halx99 in [#2735](https://github.com/axmolengine/axmol/pull/2735)
1616
- Add new API `ZipFile::createWithData` and mark `ZipFile::createWithBuffer` as deprecated by @halx99
1717
- Enhance Base64 decoder to skip whitespace/newlines and prevent premature termination by @halx99
18+
- Add Device::resolveOrientation and compact resolution logic by @halx99 in [#2792](https://github.com/axmolengine/axmol/pull/2792)
1819

1920
## Bug fixes
2021

2122
- Fix `ui::MediaPlayer` may crash on Apple platforms by @halx99 in [#2704](https://github.com/axmolengine/axmol/pull/2704)
2223
- Fix occasional missing Android assets in AAB build by @paulocoutinhox in [#2713](https://github.com/axmolengine/axmol/pull/2713)
2324
- Fix format specifiers in logging calls by @rh101 in [#2749](https://github.com/axmolengine/axmol/pull/2749)
2425

26+
2527
## Improvements
2628

29+
- Improve ios EditBox orientation handling with keyboard by @halx99 in [#2791](https://github.com/axmolengine/axmol/pull/2791) and [#2795](https://github.com/axmolengine/axmol/pull/2795)
30+
- Add support for extracting the previous scene from the scene stack by @rh101 in [#2793](https://github.com/axmolengine/axmol/pull/2793)
2731
- Destroy `ScriptEngine` instance before `_scheduler` to respect dependency by @halx99
2832
- Fix SpineTest aim y-axis by @halx99
2933
- Replace deprecated calls with new API in engine by @halx99
@@ -32,6 +36,7 @@
3236
- Remove non-existent yaml-cpp from template cmake modules by @halx99
3337
- Remove CI pull-request trigger event: `ready_for_review` by @halx99
3438
- Update kcp to resolve cmake error by @halx99
39+
- Dispatch applicationScreenSizeChanged when layoutSubviews on ios by @halx99
3540

3641
## SDK & Tools updates
3742

axmol/2d/ParticleSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,14 +2305,14 @@ void ParticleEmissionMaskCache::bakeEmissionMask(std::string_view maskId,
23052305
if (inbetweenSamples > 1)
23062306
{
23072307
float a = data[(y * w + x) * 4 + 3] / 255.0F;
2308-
if (a >= alphaThreshold && !inverted || a < alphaThreshold && inverted)
2308+
if ((a >= alphaThreshold && !inverted) || (a < alphaThreshold && inverted))
23092309
for (float i = 0; i < 1.0F; i += 1.0F / inbetweenSamples)
23102310
points.emplace_back(Vec2{float(x + i), float(h - y + i)});
23112311
}
23122312
else
23132313
{
23142314
float a = data[(y * w + x) * 4 + 3] / 255.0F;
2315-
if (a >= alphaThreshold && !inverted || a < alphaThreshold && inverted)
2315+
if ((a >= alphaThreshold && !inverted) || (a < alphaThreshold && inverted))
23162316
points.emplace_back(Vec2{float(x), float(h - y)});
23172317
}
23182318
}

axmol/base/Director.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,39 @@ void Director::popToSceneStackLevel(int level)
963963
_sendCleanupToScene = true;
964964
}
965965

966+
Scene* Director::popPreviousSceneOut()
967+
{
968+
if (_nextScene)
969+
{
970+
return nullptr;
971+
}
972+
973+
const auto numScenes = _scenesStack.size();
974+
975+
if (numScenes < 2)
976+
{
977+
return nullptr;
978+
}
979+
980+
const auto previousSceneIndex = numScenes - 2;
981+
982+
auto previousScene = _scenesStack.at(previousSceneIndex);
983+
previousScene->retain();
984+
previousScene->autorelease();
985+
986+
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
987+
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
988+
if (sEngine)
989+
{
990+
sEngine->releaseScriptObject(this, previousScene);
991+
}
992+
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
993+
994+
_scenesStack.erase(previousSceneIndex);
995+
996+
return previousScene;
997+
}
998+
966999
void Director::end()
9671000
{
9681001
_cleanupDirectorInNextLoop = true;

axmol/base/Director.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,15 @@ class AX_DLL Director
321321
*/
322322
void replaceScene(Scene* scene);
323323

324+
/** Removes the previous scene from the stack if it exists, and returns it
325+
* If there are less than 2 scenes in the stack, or if there is a
326+
* scene switch about to occur, then this call would be invalid, and a nullptr
327+
* will be returned.
328+
*
329+
* Returns previous scene or nullptr if invalid
330+
*/
331+
Scene* popPreviousSceneOut();
332+
324333
/** Ends the execution, releases the running scene.
325334
* @lua endToLua
326335
*/

axmol/platform/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ elseif(APPLE)
7878
${_AX_PLATFORM_SPECIFIC_HEADER}
7979
platform/ios/Application-ios.h
8080
platform/ios/DirectorCaller-ios.h
81-
platform/ios/EARenderView-ios.h
81+
platform/ios/RenderHostView-ios.h
8282
platform/ios/RenderViewImpl-ios.h
8383
platform/ios/StdC-ios.h
8484
platform/ios/InputView-ios.h
@@ -91,7 +91,7 @@ elseif(APPLE)
9191
platform/ios/Common-ios.mm
9292
platform/ios/Device-ios.mm
9393
platform/ios/DirectorCaller-ios.mm
94-
platform/ios/EARenderView-ios.mm
94+
platform/ios/RenderHostView-ios.mm
9595
platform/ios/RenderViewImpl-ios.mm
9696
platform/ios/Image-ios.mm
9797
platform/ios/InputView-ios.mm

axmol/platform/Device.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,32 @@ class AX_DLL Device
267267
*/
268268
static Orientation getPhysicalOrientation();
269269

270+
/**
271+
* Resolve the orientation of the application window.
272+
*
273+
* This method combines three sources of information:
274+
* 1. Supported orientations (from getSupportedOrientations)
275+
* 2. Preferred orientation (from getPreferredOrientation)
276+
* 3. Current physical device orientation (from getPhysicalOrientation)
277+
*
278+
* Resolution rules:
279+
* - If the preferred orientation is a concrete value (Portrait, Landscape, etc.)
280+
* and is included in the supported mask, it will be used.
281+
* - If the preferred orientation is a sensor-based value (SensorPortrait,
282+
* SensorLandscape, Sensor, FullSensor), the physical orientation is used
283+
* if it is supported; otherwise a fallback orientation is chosen.
284+
* - If no valid orientation can be resolved, the first available orientation
285+
* from the supported mask is used as a fallback.
286+
*
287+
* The returned Orientation is guaranteed to be compatible with the supported
288+
* orientation mask, and can be used by RenderViewImpl-ios to compute the
289+
* logical screen size and viewport before app->run().
290+
*
291+
* @return Orientation The resolved final orientation for the application.
292+
* @since axmol-2.9.0
293+
*/
294+
static Orientation resolveOrientation();
295+
270296
#pragma endregion Orientation control support
271297

272298
/**

axmol/platform/android/Device-android.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ Device::Orientation Device::getPhysicalOrientation()
250250
return static_cast<Device::Orientation>(orientation);
251251
}
252252

253+
Device::Orientation Device::resolveOrientation()
254+
{
255+
return s_preferredOrientation;
256+
}
257+
253258
} // namespace ax
254259

255260
// this method is called by BitmapHelper

axmol/platform/desktop/Device-desktop.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,9 @@ Device::Orientation Device::getPhysicalOrientation()
6464
return Orientation::Unknown;
6565
}
6666

67+
Device::Orientation Device::resolveOrientation()
68+
{
69+
return Orientation::Unknown;
70+
}
71+
6772
} // namespace ax

axmol/platform/ios/AxmolViewController.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ of this software and associated documentation files (the "Software"), to deal
2323
****************************************************************************/
2424

2525
#import "axmol/platform/ios/AxmolViewController.h"
26-
#import "axmol/platform/ios/EARenderView-ios.h"
26+
#import "axmol/platform/ios/RenderHostView-ios.h"
2727
#include "axmol/platform/Device.h"
2828
#include "axmol/platform/Application.h"
2929
#include "axmol/base/Director.h"

0 commit comments

Comments
 (0)