프로젝트 추가

This commit is contained in:
2025-10-26 15:56:27 +09:00
parent ebc5fbe7c8
commit edb0e77b47
137 changed files with 3852 additions and 0 deletions

4
.axproj Normal file
View File

@@ -0,0 +1,4 @@
engine_version=2.8.1
project_type=cpp
package_name=dev.axmol.demo

70
.clang-format Normal file
View File

@@ -0,0 +1,70 @@
# This file is copy from https://github.com/google/angle with some modifications
# Defines the axmol style for automatic reformatting.
# https://code.google.com/p/angleproject/wiki/CodingStandard
# See Clang docs: http://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: Chromium
# Allow double brackets such as std::vector<std::vector<int>>.
Standard: Cpp11
# Indent 4 spaces at a time.
IndentWidth: 4
# Keep lines under 120 columns long.
ColumnLimit: 120
SortIncludes: false
# Always break before braces
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
# Keeps extern "C" blocks unindented.
AfterExternBlock: false
BeforeLambdaBody: false
# Lambda body indentation
LambdaBodyIndentation: OuterScope
# Indent case labels.
IndentCaseLabels: false
# Left-align pointers and references
PointerAlignment: Left
# ANGLE likes to align things as much as possible.
AlignOperands: true
AlignConsecutiveAssignments: true
# Use 0 space negative offset for access modifiers
AccessModifierOffset: -4
# TODO(jmadill): Decide if we want this on. Doesn't have an "all or none" mode.
AllowShortCaseLabelsOnASingleLine: false
# Useful for spacing out functions in classes
KeepEmptyLinesAtTheStartOfBlocks: true
# Indent nested PP directives.
IndentPPDirectives: AfterHash
# Include blocks style
IncludeBlocks: Preserve
UseTab: Never
BreakConstructorInitializers: BeforeComma
AlignConsecutiveMacros: AcrossEmptyLines

42
.editorconfig Normal file
View File

@@ -0,0 +1,42 @@
root = true
[*]
end_of_line = lf
charset = utf-8-bom
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.py]
indent_style = space
indent_size = 4
[{*[Mm]akefile*,*.mak,*.mk,depend}]
indent_style = tab
[*.{bat, cmd, cmd.*}]
end_of_line = crlf
indent_style = space
indent_size = 4
[*.yml]
indent_style = space
indent_size = 2
[*.md]
indent_size = 4
trim_trailing_whitespace = false
[*.gemspec]
indent_size = 2
[*.rb]
indent_size = 2
[*.bat]
end_of_line = crlf
[{*.cmake, *CMakeLists.txt}]
indent_size = 2
indent_style = space

55
.gitattributes vendored Normal file
View File

@@ -0,0 +1,55 @@
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
*.physicsMaterial2D merge=unityyamlmerge eol=lf
*.physicMaterial merge=unityyamlmerge eol=lf
*.asset merge=unityyamlmerge eol=lf
*.meta merge=unityyamlmerge eol=lf
*.controller merge=unityyamlmerge eol=lf
## git-lfs ##
#Image
*.jpg filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
*.ai filter=lfs diff=lfs merge=lfs -text
#Audio
*.mp3 filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.ogg filter=lfs diff=lfs merge=lfs -text
#Video
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.mov filter=lfs diff=lfs merge=lfs -text
#3D Object
*.FBX filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text
*.obj filter=lfs diff=lfs merge=lfs -text
#ETC
*.a filter=lfs diff=lfs merge=lfs -text
*.exr filter=lfs diff=lfs merge=lfs -text
*.tga filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.dll filter=lfs diff=lfs merge=lfs -text
*.unitypackage filter=lfs diff=lfs merge=lfs -text
*.aif filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.rns filter=lfs diff=lfs merge=lfs -text
*.reason filter=lfs diff=lfs merge=lfs -text
*.lxo filter=lfs diff=lfs merge=lfs -text

234
.gitignore vendored Normal file
View File

@@ -0,0 +1,234 @@
# Ignore thumbnails created by windows
Thumbs.db
buildsrc/
# Ignore files build by Visual Studio
*.exe
*.pdb
*.aps
*.vcproj.*.user
*.vcxproj.user
*.csproj.user
*.vspscc
*_i.c
*.i
*.icf
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug/
[Dd]ebug.win32/
*.sbr
*.sdf
obj/
[Rr]elease/
[Rr]elease.win32/
_ReSharper*/
[Tt]est[Rr]esult*
ipch/
*.opensdf
*.opendb
SubmissionInfo
Generated Files
AppPackages
BundleArtifacts
.vs/
*.VC.db
# Ignore files build by ndk and eclipse
/libs/
bin/
obj/
gen/
assets/
local.properties
/core/axmolver.h
/core/renderer/RenderConsts.h
# Ignore python compiled files
*.pyc
# Ignore files build by xcode
*.mode*v*
*.pbxuser
*.xcbkptlist
*.xcworkspacedata
*.xcuserstate
*.xccheckout
xcschememanagement.plist
IDEWorkspaceChecks.plist
.DS_Store
._.*
xcuserdata/
DerivedData/
# Ignore files built by AppCode
.idea/
# Ignore files built by bada
.Simulator-Debug/
.Target-Debug/
.Target-Release/
# Ignore files built by blackberry
Simulator/
Device-Debug/
Device-Release/
# Ignore vim swaps
*.swp
*.swo
# Ignore files created by create_project.py
projects/
# Ignore config files in javascript bindings generator
tools/tojs/user.cfg
# ... userconf.ini generated if running from tools/tojs
tools/tojs/userconf.ini
tools/tolua/userconf.ini
# ... userconf.ini generated if running from tools/jenkins_scripts/mac/android/
tools/jenkins_scripts/mac/android/userconf.ini
# CTags
tags
CMakeSettings.json
# ignore files, created with make-all-linux-project script
/lib
/build/linux-build
# ignore all build
/build
/build_*
# ignore ninja build dir
/out
/out*
# ignore jniLibs android
/**/jniLibs/*/*.so
# Cmake files
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake
CMakeLists.txt.user
# Ignore files generated by console
build/build/
extensions/scripting/lua-bindings/proj.ios_mac/build/
tests/*/runtime/
tests/*/publish/
tests/*/project/proj.android-studio/app/build.xml
tests/*/project/proj.android-studio/app/proguard-project.txt
tests/*/proj.android-studio/app/build.xml
tests/*/proj.android-studio/app/proguard-project.txt
# Android
project.properties
*.iml
# Ignore template runtime
/templates/lua-template-runtime/runtime
/v*-deps-*.zip
/v*-lua-runtime-*.zip
/v*-console-*.zip
/tools/fbx-conv/
/templates/lua-template-default/src/core/
/tests/lua-tests/src/core/
/tests/js-tests/res/
/tools/framework-compile/bin/proj_modifier/plutil-win32/
!/tools/framework-compile/bin/
# generated by framework-compile
/templates/*-template-binary/
/prebuilt/
/*/prebuilt-mk/Android.mk
/*/*/prebuilt-mk/Android.mk
/*/*/*/prebuilt-mk/Android.mk
/*/*/*/*/prebuilt-mk/Android.mk
*.xcscmblueprint
tests/cpp-empty-test/proj.tizen/res/
tests/cpp-tests/proj.tizen/res/
tests/lua-empty-test/project/proj.tizen/res/
tests/lua-tests/project/proj.tizen/res/
/extensions/Live2D/Core/
# Ignore x-studio folder
.xs
extensions/x-studio.cmake
# Ignore vscode folder
.vscode/
# Ignore the CMake build folder, such as ios-build/linux-build
*-build/
# Ignore the CLion build folder, such as cmake-build-debug
cmake-build-*/
.vs
cmake_build*
metal-support*.zip
**/.project
**/.classpath
**/org.eclipse.buildship.core.prefs
desktop.ini
# tmp folder for temp usage
tmp/
temp/
# external libs zip
*.zip
**/simulator/
# New .cxx temp folder
**/.cxx
**/SharedLoader.java
# ignore downloaded tools
tools/external
# ignore lua-tests res folder which is copy from cpp-tests
tests/lua-tests/res/
extensions/libeditor
extensions/libccs30
extensions/libccs21
extensions/libccs20
extensions/libccs19
extensions/fonteng
tools/bindings-generator/clang/prebuilt/*
templates/lua-template-default/Content/src/axmol
tests/lua-tests/Content/src/axmol
tests/lua-tests/Content/res
tests/cpp-tests/Content
tests/fairygui-tests/Content
tests/live2d-tests/Content
tests/unit-tests/Content
tests/*-tests/build
tests/*-tests/build_*
*.patch
/cache
/_cache
.gitee
release_note_draft.txt

89
CMakeLists.txt Normal file
View File

@@ -0,0 +1,89 @@
# /****************************************************************************
# Copyright (c) 2013-2014 cocos2d-x.org
# Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
#
# https://axmol.dev/
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# ****************************************************************************/
cmake_minimum_required(VERSION 3.22...4.1)
set(APP_NAME Pinball)
project(${APP_NAME})
if(XCODE)
set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE)
endif()
set(_is_axmol_embed FALSE)
set(_AX_USE_PREBUILT FALSE)
set(CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules
)
# NOTE: The order of the cmake module "include(AXGame...)" statements matters
include(AXGameEngineOptions)
include(AXGameEngineSetup)
# The common cross-platforms source files and header files
file(GLOB_RECURSE GAME_HEADER
Source/*.h Source/*.hpp
)
file(GLOB_RECURSE GAME_SOURCE
Source/*.cpp Source/*.c
)
set(GAME_INC_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/Source"
)
set(content_folder
"${CMAKE_CURRENT_SOURCE_DIR}/Content"
)
if(APPLE)
ax_mark_multi_resources(common_content_files RES_TO "Resources" FOLDERS ${content_folder})
elseif(WINDOWS)
ax_mark_multi_resources(common_content_files RES_TO "Content" FOLDERS ${content_folder})
endif()
include(AXGameSourceSetup)
# mark app complie info and libs info
set(APP_SOURCES
${GAME_HEADER}
${GAME_SOURCE}
)
include(AXGameTargetSetup)
# mark app resources, resource will be copy auto after mark
ax_setup_app_config(${APP_NAME})
# Add any libraries you need to link to the project after this point
# Default Platform-specific setup
include(AXGamePlatformSetup)
# Make sure the AXGameFinalSetup is included at the end of this file
include(AXGameFinalSetup)

BIN
Content/CloseNormal.png LFS Normal file

Binary file not shown.

BIN
Content/CloseSelected.png LFS Normal file

Binary file not shown.

BIN
Content/HelloWorld.png LFS Normal file

Binary file not shown.

BIN
Content/fonts/Marker Felt.ttf LFS Normal file

Binary file not shown.

BIN
Content/fonts/arial.ttf LFS Normal file

Binary file not shown.

0
Content/res/.gitkeep Normal file
View File

109
Source/AppDelegate.cpp Normal file
View File

@@ -0,0 +1,109 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
https://axmol.dev/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "AppDelegate.h"
#include "MainScene.h"
#define USE_AUDIO_ENGINE 1
#if USE_AUDIO_ENGINE
# include "audio/AudioEngine.h"
#endif
using namespace ax;
static ax::Size designResolutionSize = ax::Size(1280, 720);
AppDelegate::AppDelegate() {}
AppDelegate::~AppDelegate() {}
// if you want a different context, modify the value of gfxContextAttrs
// it will affect all platforms
void AppDelegate::initGfxContextAttrs()
{
// set graphics context attributes: red,green,blue,alpha,depth,stencil,multisamplesCount
GfxContextAttrs gfxContextAttrs = {8, 8, 8, 8, 24, 8, 0};
// since axmol-2.2 vsync was enabled in engine by default
// gfxContextAttrs.vsync = false;
RenderView::setGfxContextAttrs(gfxContextAttrs);
}
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
auto director = Director::getInstance();
auto renderView = director->getRenderView();
if (!renderView)
{
#if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32) || (AX_TARGET_PLATFORM == AX_PLATFORM_MAC) || \
(AX_TARGET_PLATFORM == AX_PLATFORM_LINUX)
renderView = RenderViewImpl::createWithRect(
"Pinball", ax::Rect(0, 0, designResolutionSize.width, designResolutionSize.height));
#else
renderView = RenderViewImpl::create("Pinball");
#endif
director->setRenderView(renderView);
}
// turn on display FPS
director->setStatsDisplay(true);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0f / 60);
// Set the design resolution
renderView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height,
ResolutionPolicy::SHOW_ALL);
// create a scene. it's an autorelease object
auto scene = utils::createInstance<MainScene>();
// run
director->runWithScene(scene);
return true;
}
// This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
void AppDelegate::applicationDidEnterBackground()
{
Director::getInstance()->stopAnimation();
#if USE_AUDIO_ENGINE
AudioEngine::pauseAll();
#endif
}
// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
Director::getInstance()->startAnimation();
#if USE_AUDIO_ENGINE
AudioEngine::resumeAll();
#endif
}

60
Source/AppDelegate.h Normal file
View File

@@ -0,0 +1,60 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
https://axmol.dev/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include "axmol.h"
/**
@brief The axmol Application.
Private inheritance here hides part of interface from Director.
*/
class AppDelegate : private ax::Application
{
public:
AppDelegate();
~AppDelegate() override;
void initGfxContextAttrs() override;
/**
@brief Implement Director and Scene init code here.
@return true Initialize success, app continue.
@return false Initialize failed, app terminate.
*/
bool applicationDidFinishLaunching() override;
/**
@brief Called when the application moves to the background
*/
void applicationDidEnterBackground() override;
/**
@brief Called when the application reenters the foreground
*/
void applicationWillEnterForeground() override;
};

297
Source/MainScene.cpp Normal file
View File

@@ -0,0 +1,297 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
https://axmol.dev/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "MainScene.h"
using namespace ax;
static int s_sceneID = 1000;
// Print useful error message instead of segfaulting when files are not there.
static void problemLoading(const char* filename)
{
printf("Error while loading: %s\n", filename);
printf(
"Depending on how you compiled you might have to add 'Content/' in front of filenames in "
"MainScene.cpp\n");
}
// on "init" you need to initialize your instance
bool MainScene::init()
{
//////////////////////////////
// 1. super init first
if (!Scene::init())
{
return false;
}
auto visibleSize = _director->getVisibleSize();
auto origin = _director->getVisibleOrigin();
auto safeArea = _director->getSafeAreaRect();
auto safeOrigin = safeArea.origin;
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
// add a "close" icon to exit the progress. it's an autorelease object
auto closeItem = MenuItemImage::create("CloseNormal.png", "CloseSelected.png",
AX_CALLBACK_1(MainScene::menuCloseCallback, this));
if (closeItem == nullptr || closeItem->getContentSize().width <= 0 || closeItem->getContentSize().height <= 0)
{
problemLoading("'CloseNormal.png' and 'CloseSelected.png'");
}
else
{
float x = safeOrigin.x + safeArea.size.width - closeItem->getContentSize().width / 2;
float y = safeOrigin.y + closeItem->getContentSize().height / 2;
closeItem->setPosition(Vec2(x, y));
}
// create menu, it's an autorelease object
auto menu = Menu::create(closeItem, NULL);
menu->setPosition(Vec2::ZERO);
this->addChild(menu, 1);
/////////////////////////////
// 3. add your codes below...
// Some templates (uncomment what you need)
_touchListener = EventListenerTouchAllAtOnce::create();
_touchListener->onTouchesBegan = AX_CALLBACK_2(MainScene::onTouchesBegan, this);
_touchListener->onTouchesMoved = AX_CALLBACK_2(MainScene::onTouchesMoved, this);
_touchListener->onTouchesEnded = AX_CALLBACK_2(MainScene::onTouchesEnded, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(_touchListener, this);
//_mouseListener = EventListenerMouse::create();
//_mouseListener->onMouseMove = AX_CALLBACK_1(MainScene::onMouseMove, this);
//_mouseListener->onMouseUp = AX_CALLBACK_1(MainScene::onMouseUp, this);
//_mouseListener->onMouseDown = AX_CALLBACK_1(MainScene::onMouseDown, this);
//_mouseListener->onMouseScroll = AX_CALLBACK_1(MainScene::onMouseScroll, this);
//_eventDispatcher->addEventListenerWithSceneGraphPriority(_mouseListener, this);
_keyboardListener = EventListenerKeyboard::create();
_keyboardListener->onKeyPressed = AX_CALLBACK_2(MainScene::onKeyPressed, this);
_keyboardListener->onKeyReleased = AX_CALLBACK_2(MainScene::onKeyReleased, this);
_eventDispatcher->addEventListenerWithFixedPriority(_keyboardListener, 11);
// add a label shows "Hello World"
// create and initialize a label
auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 24);
if (label == nullptr)
{
problemLoading("'fonts/Marker Felt.ttf'");
}
else
{
// position the label on the center of the screen
label->setPosition(
Vec2(origin.x + visibleSize.width / 2, origin.y + visibleSize.height - label->getContentSize().height));
// add the label as a child to this layer
this->addChild(label, 1);
}
// add "HelloWorld" splash screen"
auto sprite = Sprite::create("HelloWorld.png"sv);
if (sprite == nullptr)
{
problemLoading("'HelloWorld.png'");
}
else
{
// position the sprite on the center of the screen
sprite->setPosition(Vec2(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));
// add the sprite as a child to this layer
this->addChild(sprite, 0);
auto drawNode = DrawNode::create();
drawNode->setPosition(Vec2(0, 0));
addChild(drawNode);
drawNode->drawRect(safeArea.origin + Vec2(1, 1), safeArea.origin + safeArea.size, Color4F::BLUE);
}
// scheduleUpdate() is required to ensure update(float) is called on every loop
scheduleUpdate();
return true;
}
void MainScene::onTouchesBegan(const std::vector<ax::Touch*>& touches, ax::Event* event)
{
for (auto&& t : touches)
{
// AXLOGD("onTouchesBegan detected, X:{} Y:{}", t->getLocation().x, t->getLocation().y);
}
}
void MainScene::onTouchesMoved(const std::vector<ax::Touch*>& touches, ax::Event* event)
{
for (auto&& t : touches)
{
// AXLOGD("onTouchesMoved detected, X:{} Y:{}", t->getLocation().x, t->getLocation().y);
}
}
void MainScene::onTouchesEnded(const std::vector<ax::Touch*>& touches, ax::Event* event)
{
for (auto&& t : touches)
{
// AXLOGD("onTouchesEnded detected, X:{} Y:{}", t->getLocation().x, t->getLocation().y);
}
}
bool MainScene::onMouseDown(Event* event)
{
EventMouse* e = static_cast<EventMouse*>(event);
// AXLOGD("onMouseDown detected, Key: %d", static_cast<int>(e->getMouseButton()));
return true;
}
bool MainScene::onMouseUp(Event* event)
{
EventMouse* e = static_cast<EventMouse*>(event);
AXLOGD("onMouseUp detected, Key: %d", static_cast<int>(e->getMouseButton()));
return true;
}
bool MainScene::onMouseMove(Event* event)
{
EventMouse* e = static_cast<EventMouse*>(event);
// AXLOGD("onMouseMove detected, X:{} Y:{}", e->getCursorX(), e->getCursorY());
return true;
}
bool MainScene::onMouseScroll(Event* event)
{
EventMouse* e = static_cast<EventMouse*>(event);
// AXLOGD("onMouseScroll detected, X:{} Y:{}", e->getScrollX(), e->getScrollY());
return true;
}
void MainScene::onKeyPressed(EventKeyboard::KeyCode code, Event* event)
{
AXLOGD("Scene: #{} onKeyPressed, keycode: {}", _sceneID, static_cast<int>(code));
}
void MainScene::onKeyReleased(EventKeyboard::KeyCode code, Event* event)
{
AXLOGD("onKeyReleased, keycode: %d", static_cast<int>(code));
}
void MainScene::update(float delta)
{
switch (_gameState)
{
case GameState::init:
{
_gameState = GameState::update;
break;
}
case GameState::update:
{
/////////////////////////////
// Add your codes below...like....
//
// UpdateJoyStick();
// UpdatePlayer();
// UpdatePhysics();
// ...
break;
}
case GameState::pause:
{
/////////////////////////////
// Add your codes below...like....
//
// anyPauseStuff()
break;
}
case GameState::menu1:
{ /////////////////////////////
// Add your codes below...like....
//
// UpdateMenu1();
break;
}
case GameState::menu2:
{ /////////////////////////////
// Add your codes below...like....
//
// UpdateMenu2();
break;
}
case GameState::end:
{ /////////////////////////////
// Add your codes below...like....
//
// CleanUpMyCrap();
menuCloseCallback(this);
break;
}
} // switch
}
void MainScene::menuCloseCallback(ax::Object* sender)
{
// Close the axmol game scene and quit the application
_director->end();
/*To navigate back to native iOS screen(if present) without quitting the application ,do not use
* _director->end() as given above,instead trigger a custom event created in RootViewController.mm
* as below*/
// EventCustom customEndEvent("game_scene_close_event");
//_eventDispatcher->dispatchEvent(&customEndEvent);
}
MainScene::MainScene()
{
_sceneID = ++s_sceneID;
AXLOGD("Scene: ctor: #{}", _sceneID);
}
MainScene::~MainScene()
{
AXLOGD("~Scene: dtor: #{}", _sceneID);
if (_touchListener)
_eventDispatcher->removeEventListener(_touchListener);
if (_keyboardListener)
_eventDispatcher->removeEventListener(_keyboardListener);
if (_mouseListener)
_eventDispatcher->removeEventListener(_mouseListener);
_sceneID = -1;
}

74
Source/MainScene.h Normal file
View File

@@ -0,0 +1,74 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
https://axmol.dev/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#include "axmol.h"
class MainScene : public ax::Scene
{
enum class GameState
{
init = 0,
update,
pause,
end,
menu1,
menu2,
};
public:
bool init() override;
void update(float delta) override;
// touch
void onTouchesBegan(const std::vector<ax::Touch*>& touches, ax::Event* event);
void onTouchesMoved(const std::vector<ax::Touch*>& touches, ax::Event* event);
void onTouchesEnded(const std::vector<ax::Touch*>& touches, ax::Event* event);
// mouse
bool onMouseDown(ax::Event* event);
bool onMouseUp(ax::Event* event);
bool onMouseMove(ax::Event* event);
bool onMouseScroll(ax::Event* event);
// Keyboard
void onKeyPressed(ax::EventKeyboard::KeyCode code, ax::Event* event);
void onKeyReleased(ax::EventKeyboard::KeyCode code, ax::Event* event);
// a selector callback
void menuCloseCallback(ax::Object* sender);
MainScene();
~MainScene() override;
private:
GameState _gameState = GameState::init;
ax::EventListenerTouchAllAtOnce* _touchListener = nullptr;
ax::EventListenerKeyboard* _keyboardListener = nullptr;
ax::EventListenerMouse* _mouseListener = nullptr;
int _sceneID = 0;
};

2
build.bat Normal file
View File

@@ -0,0 +1,2 @@
@echo off
axmol build -p win32

View File

@@ -0,0 +1,47 @@
# NOTE: Changing the value of AX_EXT_HINT after cmake build files have been created
# will not update all other options that are using AX_EXT_HINT. You must delete the
# {build_dir}/CMakeCache.txt file and then re-run the `axmol build ...` command in
# order for the new setting to take effect. Alternatively, you can also delete the
# entire build folder and then re-run the `axmol build` command.
# set(AX_EXT_HINT ON CACHE BOOL "The default extensions hint" FORCE)
# The following are by default set the same as the AX_EXT_HINT flag above - default: ON
# Uncomment the lines below to set them individually
# set(AX_ENABLE_EXT_LUA OFF CACHE BOOL "Build lua libraries" FORCE)
# set(AX_ENABLE_EXT_GUI OFF CACHE BOOL "Build extension GUI" FORCE)
# set(AX_ENABLE_EXT_ASSETMANAGER OFF CACHE BOOL "Build extension asset-manager" FORCE)
# set(AX_ENABLE_EXT_SPINE OFF CACHE BOOL "Build extension spine" FORCE)
# set(AX_ENABLE_EXT_DRAGONBONES OFF CACHE BOOL "Build extension DragonBones" FORCE)
# set(AX_ENABLE_EXT_COCOSTUDIO OFF CACHE BOOL "Build extension cocostudio" FORCE)
# set(AX_ENABLE_EXT_FAIRYGUI OFF CACHE BOOL "Build extension FairyGUI" FORCE)
# set(AX_ENABLE_EXT_IMGUI OFF CACHE BOOL "Build extension ImGui" FORCE)
# set(AX_ENABLE_EXT_JSONDEFAULT OFF CACHE BOOL "Build extension JSONDefault" FORCE)
# 3D Support - - default: ON
# set(AX_ENABLE_3D ON CACHE BOOL "Build 3D support" FORCE)
# These depend on AX_EXT_HINT & AX_ENABLE_3D
# set(AX_ENABLE_EXT_PARTICLE3D ON CACHE BOOL "Build extension Particle3D" FORCE)
# set(AX_ENABLE_3D_PHYSICS ON CACHE BOOL "Build Physics3D support" FORCE)
# set(AX_ENABLE_NAVMESH ON CACHE BOOL "Build NavMesh support" FORCE)
# Physics Support - - default: ON
# set(AX_ENABLE_PHYSICS ON CACHE BOOL "Build Physics support" FORCE)
# These depend on AX_EXT_HINT & AX_ENABLE_PHYSICS
# set(AX_ENABLE_EXT_PHYSICS_NODE ON CACHE BOOL "Build extension physics-nodes" FORCE)
# These depend on AX_EXT_HINT & AX_ENABLE_EXT_IMGUI - default: ON
# set(AX_ENABLE_EXT_INSPECTOR ON CACHE BOOL "Enable extension Inspector" FORCE)
# set(AX_ENABLE_EXT_SDFGEN ON CACHE BOOL "Build extension SDFGen" FORCE)
# The follow options are set individually - default: OFF
# set(AX_ENABLE_EXT_LIVE2D OFF CACHE BOOL "Build extension Live2D" FORCE)
# set(AX_ENABLE_EXT_EFFEKSEER OFF CACHE BOOL "Build extension Effekseer" FORCE)
# Code modules that can be disabled - default: ON
# set(AX_ENABLE_AUDIO ON CACHE BOOL "Build audio support" FORCE)
# set(AX_ENABLE_WEBSOCKET ON CACHE BOOL "Build Websocket client based on yasio" FORCE)
# set(AX_ENABLE_HTTP ON CACHE BOOL "Build HTTP client based on yasio" FORCE)
# set(AX_ENABLE_OPUS ON CACHE BOOL "Build with opus support" FORCE)
# WEBVIEW2 - default: ON for WIN32 and WINRT
# set(AX_ENABLE_MSEDGE_WEBVIEW2 ON CACHE BOOL "Disable msedge webview2")

View File

@@ -0,0 +1,30 @@
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/axmol")
set(_AX_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/axmol")
set(_is_axmol_embed TRUE)
message(STATUS "Building isolated project: ${APP_NAME}")
else()
set(_AX_ROOT "$ENV{AX_ROOT}")
if(NOT(_AX_ROOT STREQUAL ""))
file(TO_CMAKE_PATH ${_AX_ROOT} _AX_ROOT)
message(STATUS "Using system env var _AX_ROOT=${_AX_ROOT}")
else()
message(FATAL_ERROR "Please run setup.ps1 add system env var 'AX_ROOT' to specific the engine root")
endif()
endif()
list(APPEND CMAKE_MODULE_PATH
${_AX_ROOT}/cmake/Modules/
)
include(AXBuildSet)
if(NOT _is_axmol_embed)
if((WIN32 OR LINUX) AND DEFINED AX_PREBUILT_DIR AND IS_DIRECTORY ${_AX_ROOT}/${AX_PREBUILT_DIR})
set(_AX_USE_PREBUILT TRUE)
endif()
endif()
if(NOT _AX_USE_PREBUILT)
add_subdirectory(${_AX_ROOT}/core ${ENGINE_BINARY_PATH}/axmol/core)
endif()

View File

@@ -0,0 +1,25 @@
if((NOT APPLE) AND(NOT WINRT))
ax_get_resource_path(APP_RES_DIR ${APP_NAME})
ax_sync_target_res(${APP_NAME} LINK_TO ${APP_RES_DIR} FOLDERS ${content_folder} SYM_LINK 1)
if((WINDOWS AND(NOT(CMAKE_GENERATOR MATCHES "Ninja"))))
set_property(TARGET ${APP_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${content_folder}")
if(NOT DEFINED BUILD_ENGINE_DONE)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${APP_NAME})
endif()
endif()
elseif(WINRT)
if(NOT DEFINED BUILD_ENGINE_DONE)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${APP_NAME})
endif()
endif()
if(_AX_USE_PREBUILT) # support windows and linux
use_ax_compile_define(${APP_NAME})
include(AXLinkHelpers)
ax_link_cxx_prebuilt(${APP_NAME} ${_AX_ROOT} ${AX_PREBUILT_DIR})
endif()
ax_setup_app_props(${APP_NAME})

View File

@@ -0,0 +1,29 @@
if(APPLE)
set_target_properties(${APP_NAME} PROPERTIES RESOURCE "${APP_UI_RES}")
set_xcode_property(${APP_NAME} INSTALL_PATH "\$(LOCAL_APPS_DIR)")
set_xcode_property(${APP_NAME} PRODUCT_BUNDLE_IDENTIFIER "dev.axmol.demo")
if(MACOSX)
set_target_properties(${APP_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/proj.ios_mac/mac/Info.plist")
elseif(TVOS)
set_target_properties(${APP_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/proj.ios_mac/ios/targets/tvos/Info.plist")
set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "Brand Assets")
elseif(IOS)
set_target_properties(${APP_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/proj.ios_mac/ios/targets/ios/Info.plist")
set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon")
set_xcode_property(${APP_NAME} TARGETED_DEVICE_FAMILY "1,2")
endif()
# For code-signing, set the DEVELOPMENT_TEAM:
# set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "GRLXXXX2K9")
elseif(WINDOWS)
# config quick starter batch script run.bat for windows
if(WIN32)
file(RELATIVE_PATH CMAKE_BUILD_RELATIVE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/run.bat.in" "${CMAKE_CURRENT_SOURCE_DIR}/run.bat" @ONLY)
endif()
if(NOT _AX_USE_PREBUILT)
ax_sync_target_dlls(${APP_NAME})
endif()
endif()

View File

@@ -0,0 +1,71 @@
if(ANDROID)
# the APP_NAME should match on AndroidManifest.xml
list(APPEND GAME_SOURCE
proj.android/app/jni/main.cpp
)
elseif(LINUX)
list(APPEND GAME_SOURCE
proj.linux/main.cpp
)
list(APPEND GAME_SOURCE ${common_content_files})
elseif(WASM)
list(APPEND GAME_SOURCE
proj.wasm/main.cpp
)
list(APPEND GAME_SOURCE ${common_content_files})
elseif(WINDOWS)
if(NOT WINRT)
list(APPEND GAME_HEADER
proj.win32/main.h
proj.win32/resource.h
)
list(APPEND GAME_SOURCE
proj.win32/main.cpp
proj.win32/game.rc
)
else()
ax_setup_winrt_sources()
endif()
list(APPEND GAME_SOURCE ${common_content_files})
elseif(APPLE)
if(IOS)
list(APPEND GAME_HEADER
proj.ios_mac/ios/AppController.h
proj.ios_mac/ios/RootViewController.h
)
if(TVOS)
set(APP_UI_RES
proj.ios_mac/ios/targets/tvos/LaunchScreenBackground.png
proj.ios_mac/ios/targets/tvos/LaunchScreen.storyboard
proj.ios_mac/ios/targets/tvos/Images.xcassets
)
else()
set(APP_UI_RES
proj.ios_mac/ios/targets/ios/LaunchScreenBackground.png
proj.ios_mac/ios/targets/ios/LaunchScreen.storyboard
proj.ios_mac/ios/targets/ios/Images.xcassets
)
endif()
list(APPEND GAME_SOURCE
proj.ios_mac/ios/main.m
proj.ios_mac/ios/AppController.mm
proj.ios_mac/ios/RootViewController.mm
proj.ios_mac/ios/Prefix.pch
${APP_UI_RES}
)
elseif(MACOSX)
set(APP_UI_RES
proj.ios_mac/mac/Icon.icns
)
list(APPEND GAME_SOURCE
proj.ios_mac/mac/main.cpp
proj.ios_mac/mac/Prefix.pch
${APP_UI_RES}
)
endif()
list(APPEND GAME_SOURCE ${common_content_files})
endif()

View File

@@ -0,0 +1,23 @@
if(NOT ANDROID)
add_executable(${APP_NAME} ${APP_SOURCES})
else()
add_library(${APP_NAME} SHARED ${APP_SOURCES})
# whole archive for jni when not building engine as shared libs, otherwise libaxmol.so is archived with it.
if(NOT BUILD_SHARED_LIBS)
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
endif()
config_android_shared_libs("dev.axmol.lib" "${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/src")
endif()
if(NOT _AX_USE_PREBUILT)
target_link_libraries(${APP_NAME} ${_AX_CORE_LIB})
endif()
# The optional thirdparties(not dependent by engine)
if(AX_WITH_YAML_CPP)
list(APPEND GAME_INC_DIRS "${_AX_ROOT}/3rdparty/yaml-cpp/include")
endif()
target_include_directories(${APP_NAME} PRIVATE ${GAME_INC_DIRS})

8
proj.android/.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
/.externalNativeBuild

2
proj.android/app/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/build
/.externalNativeBuild

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto">
<uses-feature android:glEsVersion="0x00020000" />
<application
android:label="@string/app_name"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher">
<!-- Tell AxmolActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="Pinball" />
<activity
android:name="dev.axmol.app.AppActivity"
android:screenOrientation="sensorLandscape"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:taskAffinity=""
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

View File

@@ -0,0 +1,132 @@
apply plugin: 'com.android.application'
apply from: project(':libaxmol').projectDir.toString() + "/../dsl/axmol.gradle"
// Resolve build profiles
def buildProfiles = AxmolUtils.resolveBuildProfiles(project)
android {
def packageName = buildProfiles['packageName']
def cmakeVer = buildProfiles['cmakeVer']
def cmakeOptions = Eval.me(buildProfiles['cmakeOptions'])
def minSdk = buildProfiles['minSdk']
def targetSdk = buildProfiles['targetSdk']
// Apply build profiles
namespace = packageName
compileSdk = targetSdk.toInteger()
ndkVersion = buildProfiles['ndkVer']
if(buildProfiles.containsKey('ndkPath')) {
ndkPath = buildProfiles['ndkPath']
}
defaultConfig {
applicationId packageName
minSdkVersion minSdk
targetSdkVersion targetSdk
versionCode 1
versionName "1.0"
externalNativeBuild {
cmake {
arguments = []
arguments.addAll(cmakeOptions)
cppFlags "-frtti -fexceptions -fsigned-char"
}
}
ndk {
// noinspection ChromeOsAbiSupport
abiFilters = __1K_ARCHS.split(':').collect{it as String}
}
}
sourceSets.main {
java.srcDir "src"
res.srcDir "res"
manifest.srcFile "AndroidManifest.xml"
assets.srcDir "build/assets"
}
externalNativeBuild {
cmake {
version = cmakeVer
path "../../CMakeLists.txt"
}
}
signingConfigs {
release {
if (project.hasProperty("KEY_STORE_FILE")) {
storeFile file(KEY_STORE_FILE)
storePassword KEY_STORE_PASSWORD
keyAlias KEY_ALIAS
keyPassword KEY_PASSWORD
}
}
}
buildTypes {
release {
debuggable false
jniDebuggable false
minifyEnabled true
shrinkResources = true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFile file(project(':libaxmol').projectDir.toString() + '/proguard-rules.pro')
if (project.hasProperty("KEY_STORE_FILE")) {
signingConfig signingConfigs.release
}
}
debug {
debuggable true
jniDebuggable true
}
}
aaptOptions {
noCompress 'mp3','ogg','wav','mp4','ttf','ttc','otf'
}
buildFeatures {
aidl = true
}
}
android.applicationVariants.configureEach { variant ->
def variantName = variant.name.capitalize()
tasks.register("copy${variantName}ContentToAssets") {
doFirst {
delete "${projectDir}/build/assets"
}
doLast {
copy {
from "${projectDir}/../../Content"
into "${projectDir}/build/assets"
exclude "**/*.gz"
}
copy {
from "${projectDir}/build/runtime/axslc"
into "${projectDir}/build/assets/axslc"
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':libaxmol')
}
project.afterEvaluate {
android.applicationVariants.configureEach { variant ->
def variantName = variant.name.capitalize()
def externalNativeBuild = tasks.named("externalNativeBuild${variantName}")
if (externalNativeBuild) {
def copyContentToAssets = tasks.named("copy${variantName}ContentToAssets")
copyContentToAssets
copyContentToAssets.get().dependsOn externalNativeBuild
tasks.named("compile${variantName}JavaWithJavac").get().dependsOn copyContentToAssets
}
}
}

View File

@@ -0,0 +1,45 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
https://axmol.dev/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include <memory>
#include <android/log.h>
#include <jni.h>
#include "AppDelegate.h"
#define LOG_TAG "main"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
namespace
{
std::unique_ptr<AppDelegate> appDelegate;
}
void axmol_android_app_init(JNIEnv* env)
{
LOGD("axmol_android_app_init");
appDelegate.reset(new AppDelegate());
}

25
proj.android/app/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${ANDROID_SDK_ROOT}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Proguard Android Webivew for release. uncomment if you are using a webview in axmol
#-keep public class android.net.http.SslError
#-keep public class android.webkit.WebViewClient
#-dontwarn android.webkit.WebView
#-dontwarn android.net.http.SslError
#-dontwarn android.webkit.WebViewClient

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,3 @@
<resources>
<string name="app_name">Pinball</string>
</resources>

View File

@@ -0,0 +1,64 @@
/****************************************************************************
Copyright (c) 2015-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
https://axmol.dev/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
package dev.axmol.app;
import android.os.Bundle;
import dev.axmol.lib.AxmolActivity;
import dev.axmol.lib.SharedLoader;
import android.os.Build;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
public class AppActivity extends AxmolActivity {
static {
// DNT remove, some android simulator require explicit load shared libraries, otherwise will crash
SharedLoader.load();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.setEnableVirtualButton(false);
super.onCreate(savedInstanceState);
// Workaround in https://stackoverflow.com/questions/16283079/re-launch-of-activity-on-home-button-but-only-the-first-time/16447508
if (!isTaskRoot()) {
// Android launched another instance of the root activity into an existing task
// so just quietly finish and go away, dropping the user back into the activity
// at the top of the stack (ie: the last state of this task)
// Don't need to finish it again since it's finished in super.onCreate .
return;
}
// Make sure we're running on Pie or higher to change cutout mode
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
// Enable rendering into the cutout area
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
getWindow().setAttributes(lp);
}
// DO OTHER INITIALIZATION BELOW
}
}

26
proj.android/build.gradle Normal file
View File

@@ -0,0 +1,26 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.11.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
tasks.register('clean', Delete) {
delete rootProject.layout.buildDirectory
}

View File

@@ -0,0 +1,34 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" -XX\:+HeapDumpOnOutOfMemoryError -Dfile.encoding\=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# List of CPU architecture to build that application with
# Available architectures (armeabi-v7a | arm64-v8a | x86 | x86_64)
# To build for multiple architecture, use the `:` between them
# Example - __1K_ARCHS=armeabi-v7a:arm64-v8a:x86:x86_64
__1K_ARCHS=arm64-v8a
# uncomment it and fill in sign information for generate signed apk
#KEY_STORE_FILE=file path of keystore
#KEY_STORE_PASSWORD=password of keystore
#KEY_ALIAS=alias of key
#KEY_PASSWORD=password of key
android.injected.testOnly=false
android.useAndroidX=true
android.native.buildOutput=verbose

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#Fri Aug 8 15:49:42 UTC+08 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

251
proj.android/gradlew vendored Normal file
View File

@@ -0,0 +1,251 @@
#!/bin/sh
#
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

94
proj.android/gradlew.bat vendored Normal file
View File

@@ -0,0 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -0,0 +1,14 @@
import java.nio.file.Paths
def folder = new File("${settingsDir}/../axmol")
if (folder.exists()) {
System.setProperty("AX_ROOT", folder.path)
} else {
System.setProperty("AX_ROOT", "${System.env.AX_ROOT}")
}
include ':libaxmol'
project(':libaxmol').projectDir = new File(Paths.get("${System.properties.AX_ROOT}/core/platform/android/libaxmol").toUri())
include ':Pinball'
project(':Pinball').projectDir = new File(settingsDir, 'app')
rootProject.name = "Pinball"

View File

@@ -0,0 +1,38 @@
/****************************************************************************
Copyright (c) 2010-2013 cocos2d-x.org
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
https://axmol.dev/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#import <UIKit/UIKit.h>
@class RootViewController;
@interface AppController : NSObject <UIApplicationDelegate> {
}
@property(nonatomic, readonly) RootViewController* viewController;
@end

View File

@@ -0,0 +1,136 @@
/****************************************************************************
Copyright (c) 2010-2013 cocos2d-x.org
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
https://axmol.dev/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#import "AppController.h"
#import "axmol.h"
#import "AppDelegate.h"
#import "RootViewController.h"
@implementation AppController
#pragma mark -
#pragma mark Application lifecycle
// axmol application instance
static AppDelegate s_sharedApplication;
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
ax::Application* app = ax::Application::getInstance();
// Initialize the RenderView attributes
app->initGfxContextAttrs();
// Override point for customization after application launch.
auto renderView = ax::RenderViewImpl::createWithFullScreen("axmol2");
_viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
// uncumment if you want disable multiple touches
// renderView->setMultipleTouchEnabled(false);
renderView->showWindow(_viewController);
// IMPORTANT: Setting the RenderView should be done after creating the RootViewController
ax::Director::getInstance()->setRenderView(renderView);
// run the axmol game scene
app->run();
return YES;
}
- (void)applicationWillResignActive:(UIApplication*)application
{
/*
Sent when the application is about to move from active to inactive state. This can occur for certain types of
temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and
it begins the transition to the background state. Use this method to pause ongoing tasks, disable timers, and
throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
// We don't need to call this method any more. It will interrupt user defined game pause&resume logic
/* ax::Director::getInstance()->pause(); */
}
- (void)applicationDidBecomeActive:(UIApplication*)application
{
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was
previously in the background, optionally refresh the user interface.
*/
// We don't need to call this method any more. It will interrupt user defined game pause&resume logic
/* ax::Director::getInstance()->resume(); */
}
- (void)applicationDidEnterBackground:(UIApplication*)application
{
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state
information to restore your application to its current state in case it is terminated later. If your application
supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
ax::Application::getInstance()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication*)application
{
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made
on entering the background.
*/
ax::Application::getInstance()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication*)application
{
/*
Called when the application is about to terminate.
See also applicationDidEnterBackground:.
*/
}
#pragma mark -
#pragma mark Memory management
- (void)applicationDidReceiveMemoryWarning:(UIApplication*)application
{
/*
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk)
later.
*/
}
#if !__has_feature(objc_arc)
- (void)dealloc
{
[_viewController release];
[super dealloc];
}
#endif
@end

View File

@@ -0,0 +1,12 @@
//
// Prefix header for all source files of the 'iphone' target in the 'iphone' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
#ifdef __cplusplus
#include "axmol.h"
#endif

View File

@@ -0,0 +1,35 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
https://axmol.dev/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#pragma once
#import <UIKit/UIKit.h>
@interface RootViewController : UIViewController {
}
- (BOOL)prefersStatusBarHidden;
@end

View File

@@ -0,0 +1,117 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
https://axmol.dev/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#import "RootViewController.h"
#import "axmol.h"
#import "platform/ios/EARenderView-ios.h"
@implementation RootViewController
/*
// The designated initializer. Override if you create the controller programmatically and want to perform
customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Custom initialization
}
return self;
}
*/
// Implement loadView to create a view hierarchy programmatically, without using a nib.
// - (void)loadView
// {
// }
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
#ifdef __IPHONE_6_0
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
#endif
- (BOOL)shouldAutorotate
{
return YES;
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
auto renderView = ax::Director::getInstance()->getRenderView();
if (renderView)
{
EARenderView* eaView = (__bridge EARenderView*)renderView->getEARenderView();
if (eaView)
{
CGSize s = CGSizeMake([eaView getWidth], [eaView getHeight]);
ax::Application::getInstance()->applicationScreenSizeChanged((int)s.width, (int)s.height);
}
}
}
// fix not hide status on ios7
- (BOOL)prefersStatusBarHidden
{
return YES;
}
// Controls the application's preferred home indicator auto-hiding when this view controller is shown.
- (BOOL)prefersHomeIndicatorAutoHidden
{
return YES;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
@end

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>compileBitcode</key>
<false/>
<key>method</key>
<string>development</string>
<key>provisioningProfiles</key>
<dict>
<key>Bundle Identifier</key>
<string>Provision Profile Name</string>
</dict>
</dict>
</plist>

7
proj.ios_mac/ios/main.m Normal file
View File

@@ -0,0 +1,7 @@
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, @"AppController");
}
}

View File

@@ -0,0 +1,158 @@
{
"images" : [
{
"filename" : "Icon-20@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "Icon-20@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"filename" : "Icon-29.png",
"idiom" : "iphone",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "Icon-29@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "Icon-29@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"filename" : "Icon-40@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "Icon-40@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"filename" : "Icon-57.png",
"idiom" : "iphone",
"scale" : "1x",
"size" : "57x57"
},
{
"filename" : "Icon-57@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "57x57"
},
{
"filename" : "Icon-60@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "Icon-60@3x.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"filename" : "Icon-20.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"filename" : "Icon-20@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "Icon-29.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "Icon-29@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "Icon-40.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"filename" : "Icon-40@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "Icon-50.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "50x50"
},
{
"filename" : "Icon-50@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "50x50"
},
{
"filename" : "Icon-72.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "72x72"
},
{
"filename" : "Icon-72@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "72x72"
},
{
"filename" : "Icon-76.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"filename" : "Icon-76@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"filename" : "Icon-83.5@2x.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"filename" : "Icon-1024.png",
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>${PROJECT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>Icon-57.png</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PROJECT_NAME}</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIAppFonts</key>
<array/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIPrerenderedIcon</key>
<true/>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
</array>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>UIRequiresFullScreen</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2023. All rights reserved.</string>
</dict>
</plist>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina5_9" orientation="landscape" appearance="light"/>
<dependencies>
<deployment version="4352" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="fm7-M6-edp"/>
<viewControllerLayoutGuide type="bottom" id="uRH-d6-mvd"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="812" height="375"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFill" insetsLayoutMarginsFromSafeArea="NO" image="LaunchScreenBackground.png" translatesAutoresizingMaskIntoConstraints="NO" id="YCC-wj-Gww" userLabel="Background">
<rect key="frame" x="0.0" y="0.0" width="812" height="375"/>
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="YCC-wj-Gww" secondAttribute="bottom" id="Naz-ae-jWI"/>
<constraint firstAttribute="trailing" secondItem="YCC-wj-Gww" secondAttribute="trailing" id="myj-85-hk9"/>
<constraint firstItem="YCC-wj-Gww" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="qOq-Cg-doS"/>
<constraint firstItem="YCC-wj-Gww" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="xL7-Fo-4bl"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="50.399999999999999" y="373.15270935960592"/>
</scene>
</scenes>
<resources>
<image name="LaunchScreenBackground.png" width="2208" height="1242"/>
</resources>
</document>

Binary file not shown.

View File

@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.447",
"green" : "0.282",
"red" : "0.129"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv",
"size" : "1280x768",
"filename" : "icon-0.png"
}
],
"author" : "Store Assets Generator",
"version" : "0.4.0"
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "Store Assets Generator",
"version" : "0.4.0"
}
}

View File

@@ -0,0 +1,17 @@
{
"info" : {
"author" : "Store Assets Generator",
"version" : "0.4.0"
},
"layers" : [
{
"filename" : "Front.imagestacklayer"
},
{
"filename" : "Middle.imagestacklayer"
},
{
"filename" : "Back.imagestacklayer"
}
]
}

View File

@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv",
"size" : "1280x768",
"filename" : "icon-0.png"
}
],
"author" : "Store Assets Generator",
"version" : "0.4.0"
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : "0.4.0",
"author" : "Store Assets Generator"
}
}

View File

@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv",
"size" : "1280x768",
"filename" : "icon-0.png"
}
],
"author" : "Store Assets Generator",
"version" : "0.4.0"
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "Store Assets Generator",
"version" : "0.4.0"
}
}

View File

@@ -0,0 +1,18 @@
{
"images" : [
{
"size" : "400x240",
"idiom" : "tv",
"filename" : "icon-400.png",
"scale" : "1x"
},
{
"size" : "400x240",
"idiom" : "tv",
"filename" : "icon-800.png",
"scale" : "2x"
}
],
"author" : "Store Assets Generator",
"version" : "0.4.0"
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : "0.4.0",
"author" : "Store Assets Generator"
}
}

View File

@@ -0,0 +1,17 @@
{
"info" : {
"version" : "0.4.0",
"author" : "Store Assets Generator"
},
"layers" : [
{
"filename" : "Front.imagestacklayer"
},
{
"filename" : "Middle.imagestacklayer"
},
{
"filename" : "Back.imagestacklayer"
}
]
}

View File

@@ -0,0 +1,18 @@
{
"images" : [
{
"size" : "400x240",
"idiom" : "tv",
"filename" : "icon-400.png",
"scale" : "1x"
},
{
"size" : "400x240",
"idiom" : "tv",
"filename" : "icon-800.png",
"scale" : "2x"
}
],
"author" : "Store Assets Generator",
"version" : "0.4.0"
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : "0.4.0",
"author" : "Store Assets Generator"
}
}

View File

@@ -0,0 +1,18 @@
{
"images" : [
{
"size" : "400x240",
"idiom" : "tv",
"filename" : "icon-400.png",
"scale" : "1x"
},
{
"size" : "400x240",
"idiom" : "tv",
"filename" : "icon-800.png",
"scale" : "2x"
}
],
"author" : "Store Assets Generator",
"version" : "0.4.0"
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : "0.4.0",
"author" : "Store Assets Generator"
}
}

Some files were not shown because too many files have changed in this diff Show More