├── .cocos-project.json
├── OpenAL32.dll
├── QQ20170818-223750.png
├── README.md
├── agar-client.exe
├── glew32.dll
├── iconv.dll
├── libcocos2d.dll
├── libcrypto-1_1.dll
├── libcurl.dll
├── libmpg123.dll
├── libogg.dll
├── libssl-1_1.dll
├── libtiff.dll
├── libvorbis.dll
├── libvorbisfile.dll
├── lua51.dll
├── msvcp120.dll
├── msvcp120d.dll
├── msvcr120.dll
├── msvcr120d.dll
├── net.dll
├── pic.gif
├── project
├── CMakeLists.txt
├── Classes
│ ├── AppDelegate.cpp
│ ├── AppDelegate.h
│ └── lua_module_register.h
├── proj.android-studio
│ ├── .gitignore
│ ├── app
│ │ ├── .gitignore
│ │ ├── AndroidManifest.xml
│ │ ├── build.gradle
│ │ ├── get_environment.sh
│ │ ├── jni
│ │ │ ├── Android.mk
│ │ │ ├── Application.mk
│ │ │ └── main.cpp
│ │ ├── proguard-rules.pro
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ └── values
│ │ │ │ └── strings.xml
│ │ └── src
│ │ │ └── org
│ │ │ └── cocos2dx
│ │ │ └── lua_empty_test
│ │ │ └── AppActivity.java
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── proj.android
│ ├── .classpath
│ ├── .project
│ ├── AndroidManifest.xml
│ ├── ant.properties
│ ├── build-cfg.json
│ ├── build.xml
│ ├── jni
│ │ ├── Android.mk
│ │ ├── Application.mk
│ │ └── main.cpp
│ ├── proguard-project.txt
│ ├── project.properties
│ ├── res
│ │ ├── drawable-hdpi
│ │ │ └── icon.png
│ │ ├── drawable-ldpi
│ │ │ └── icon.png
│ │ ├── drawable-mdpi
│ │ │ └── icon.png
│ │ └── values
│ │ │ └── strings.xml
│ └── src
│ │ └── org
│ │ └── cocos2dx
│ │ └── lua_empty_test
│ │ └── AppActivity.java
├── proj.ios
│ ├── AppController.h
│ ├── AppController.mm
│ ├── Default-568h@2x.png
│ ├── Default-667h@2x.png
│ ├── Default-736h@3x.png
│ ├── Default.png
│ ├── Default@2x.png
│ ├── HelloLua_Prefix.pch
│ ├── Icon-114.png
│ ├── Icon-120.png
│ ├── Icon-144.png
│ ├── Icon-152.png
│ ├── Icon-57.png
│ ├── Icon-72.png
│ ├── Icon-76.png
│ ├── Info.plist
│ ├── RootViewController.h
│ ├── RootViewController.mm
│ └── main.m
├── proj.linux
│ └── main.cpp
├── proj.mac
│ ├── HelloLua_Prefix.pch
│ ├── Icon.icns
│ ├── Info.plist
│ ├── en.lproj
│ │ ├── InfoPlist.strings
│ │ └── MainMenu.xib
│ └── main.cpp
├── proj.tizen
│ ├── .cproject
│ ├── .exportMap
│ ├── .gitignore
│ ├── .project
│ ├── .tproject
│ ├── Build
│ │ ├── appendix.mk
│ │ ├── basedef.mk
│ │ ├── build_c.mk
│ │ ├── build_edc.mk
│ │ ├── build_po.mk
│ │ ├── flags.mk
│ │ ├── funcs.mk
│ │ ├── makefile
│ │ ├── makefile.mk
│ │ ├── platform.mk
│ │ └── tooldef.mk
│ ├── build-cfg.json
│ ├── copy_resource.sh
│ ├── project_def.prop
│ ├── res
│ │ ├── .gitignore
│ │ └── .gitkeep
│ ├── shared
│ │ └── res
│ │ │ └── lua-empty-test.png
│ ├── src
│ │ └── main.cpp
│ └── tizen-manifest.xml
└── proj.win32
│ ├── build-cfg.json
│ ├── lua-empty-test.vcxproj
│ ├── lua-empty-test.vcxproj.filters
│ ├── lua-empty-test.vcxproj.user
│ ├── main.cpp
│ └── main.h
├── res
├── .gitignore
├── Fight_NormalIco_01.png
├── Fight_NormalIco_02.png
├── background.caf
├── background.mp3
├── background.ogg
├── crop.png
├── dog.png
├── effect1.wav
├── farm.jpg
├── fonts
│ └── Marker Felt.ttf
├── land.png
├── menu1.png
├── menu2.png
└── rocker
│ ├── plate.png
│ └── stick.png
├── sqlite3.dll
├── src
├── ball.lua
├── cocos
│ ├── 3d
│ │ └── 3dConstants.lua
│ ├── cocos2d
│ │ ├── Cocos2d.lua
│ │ ├── Cocos2dConstants.lua
│ │ ├── DeprecatedCocos2dClass.lua
│ │ ├── DeprecatedCocos2dEnum.lua
│ │ ├── DeprecatedCocos2dFunc.lua
│ │ ├── DeprecatedOpenglEnum.lua
│ │ ├── DrawPrimitives.lua
│ │ ├── Opengl.lua
│ │ ├── OpenglConstants.lua
│ │ ├── bitExtend.lua
│ │ ├── deprecated.lua
│ │ ├── functions.lua
│ │ ├── json.lua
│ │ ├── luaj.lua
│ │ └── luaoc.lua
│ ├── cocosbuilder
│ │ ├── CCBReaderLoad.lua
│ │ └── DeprecatedCocosBuilderClass.lua
│ ├── cocosdenshion
│ │ ├── AudioEngine.lua
│ │ ├── DeprecatedCocosDenshionClass.lua
│ │ └── DeprecatedCocosDenshionFunc.lua
│ ├── cocostudio
│ │ ├── CocoStudio.lua
│ │ ├── DeprecatedCocoStudioClass.lua
│ │ ├── DeprecatedCocoStudioFunc.lua
│ │ └── StudioConstants.lua
│ ├── controller
│ │ └── ControllerConstants.lua
│ ├── extension
│ │ ├── DeprecatedExtensionClass.lua
│ │ ├── DeprecatedExtensionEnum.lua
│ │ ├── DeprecatedExtensionFunc.lua
│ │ └── ExtensionConstants.lua
│ ├── framework
│ │ ├── audio.lua
│ │ ├── components
│ │ │ └── event.lua
│ │ ├── device.lua
│ │ ├── display.lua
│ │ ├── extends
│ │ │ ├── LayerEx.lua
│ │ │ ├── MenuEx.lua
│ │ │ ├── NodeEx.lua
│ │ │ ├── SpriteEx.lua
│ │ │ ├── UICheckBox.lua
│ │ │ ├── UIEditBox.lua
│ │ │ ├── UIListView.lua
│ │ │ ├── UIPageView.lua
│ │ │ ├── UIScrollView.lua
│ │ │ ├── UISlider.lua
│ │ │ ├── UITextField.lua
│ │ │ └── UIWidget.lua
│ │ ├── init.lua
│ │ ├── package_support.lua
│ │ └── transition.lua
│ ├── init.lua
│ ├── network
│ │ ├── DeprecatedNetworkClass.lua
│ │ ├── DeprecatedNetworkEnum.lua
│ │ ├── DeprecatedNetworkFunc.lua
│ │ └── NetworkConstants.lua
│ ├── physics3d
│ │ └── physics3d-constants.lua
│ ├── spine
│ │ └── SpineConstants.lua
│ └── ui
│ │ ├── DeprecatedUIEnum.lua
│ │ ├── DeprecatedUIFunc.lua
│ │ ├── GuiConstants.lua
│ │ └── experimentalUIConstants.lua
├── config.lua
├── main.lua
├── mobdebug.lua
├── scene.lua
├── star.lua
└── util.lua
├── vccorlib120.dll
├── vccorlib120d.dll
├── websockets.dll
├── ws2_32.dll
└── zlib1.dll
/.cocos-project.json:
--------------------------------------------------------------------------------
1 | {
2 | "win32_cfg": {
3 | "project_path": "../../build",
4 | "sln_file": "cocos2d-win32.sln",
5 | "project_name": "lua-empty-test",
6 | "build_cfg_path": "project/proj.win32",
7 | "exe_out_dir": "lua-empty-test"
8 | },
9 | "linux_cfg": {
10 | "project_path": "project/proj.linux",
11 | "project_name": "lua-empty-test",
12 | "cmake_path": "../../",
13 | "build_dir": "../../build/linux-build",
14 | "build_result_dir": "lua-empty-test"
15 | },
16 | "ios_cfg": {
17 | "project_path": "../../build",
18 | "project_file": "cocos2d_tests.xcodeproj",
19 | "target_name": "lua-empty-test iOS"
20 | },
21 | "project_type": "lua",
22 | "has_native": true,
23 | "mac_cfg": {
24 | "project_path": "../../build",
25 | "project_file": "cocos2d_tests.xcodeproj",
26 | "target_name": "lua-empty-test Mac"
27 | },
28 | "android_cfg": {
29 | "project_path": "project/proj.android",
30 | "studio_proj_path" : "project/proj.android-studio"
31 | },
32 | "tizen_cfg" : {
33 | "project_path": "project/proj.tizen"
34 | },
35 | "engine_dir": "../../"
36 | }
37 |
--------------------------------------------------------------------------------
/OpenAL32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/OpenAL32.dll
--------------------------------------------------------------------------------
/QQ20170818-223750.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/QQ20170818-223750.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Agar.io cocos lua核心战斗客户端
2 |
3 | 使用cocos2d-x-3.15.1 lua实现的Agar.io核心,不包含任何外围系统,只为了演示核心战斗。
4 |
5 | [服务端](https://github.com/sniperHW/Agar.io-Server.git)
6 |
7 | ## 项目依赖
8 |
9 | [netclient](https://github.com/sniperHW/netclient)
10 |
11 | windows下直接使用预编译的exe文件启动客户端
12 |
13 | 
--------------------------------------------------------------------------------
/agar-client.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/agar-client.exe
--------------------------------------------------------------------------------
/glew32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/glew32.dll
--------------------------------------------------------------------------------
/iconv.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/iconv.dll
--------------------------------------------------------------------------------
/libcocos2d.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/libcocos2d.dll
--------------------------------------------------------------------------------
/libcrypto-1_1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/libcrypto-1_1.dll
--------------------------------------------------------------------------------
/libcurl.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/libcurl.dll
--------------------------------------------------------------------------------
/libmpg123.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/libmpg123.dll
--------------------------------------------------------------------------------
/libogg.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/libogg.dll
--------------------------------------------------------------------------------
/libssl-1_1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/libssl-1_1.dll
--------------------------------------------------------------------------------
/libtiff.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/libtiff.dll
--------------------------------------------------------------------------------
/libvorbis.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/libvorbis.dll
--------------------------------------------------------------------------------
/libvorbisfile.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/libvorbisfile.dll
--------------------------------------------------------------------------------
/lua51.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/lua51.dll
--------------------------------------------------------------------------------
/msvcp120.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/msvcp120.dll
--------------------------------------------------------------------------------
/msvcp120d.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/msvcp120d.dll
--------------------------------------------------------------------------------
/msvcr120.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/msvcr120.dll
--------------------------------------------------------------------------------
/msvcr120d.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/msvcr120d.dll
--------------------------------------------------------------------------------
/net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/net.dll
--------------------------------------------------------------------------------
/pic.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/pic.gif
--------------------------------------------------------------------------------
/project/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(APP_NAME lua_empty_test)
2 |
3 | set(SAMPLE_SRC Classes/AppDelegate.cpp)
4 |
5 | if(LINUX)
6 | set(SAMPLE_SRC ${SAMPLE_SRC} proj.linux/main.cpp)
7 | set(RES_PREFIX "/Resources")
8 | elseif(WINDOWS)
9 | list(APPEND SAMPLE_SRC proj.win32/main.cpp)
10 | set(RES_PREFIX "")
11 | elseif(MACOSX OR APPLE)
12 | set(SAMPLE_SRC ${SAMPLE_SRC} proj.mac/main.cpp)
13 |
14 | file(GLOB_RECURSE APP_RESOURCES ../res/*)
15 | cocos_mark_resources(FILES ${APP_RESOURCES} BASEDIR ../res RESOURCEBASE Resources/res)
16 | file(GLOB_RECURSE APP_SCRIPTS ../src/*)
17 | cocos_mark_resources(FILES ${APP_SCRIPTS} BASEDIR ../src RESOURCEBASE Resources/src)
18 | file(GLOB_RECURSE COCOS_SCRIPTS ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script/*)
19 | cocos_mark_resources(FILES ${COCOS_SCRIPTS} BASEDIR ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script RESOURCEBASE Resources/src/cocos)
20 |
21 | list(APPEND SAMPLE_SRC ${APP_RESOURCES} ${APP_SCRIPTS} ${COCOS_SCRIPTS})
22 | endif()
23 |
24 | include_directories(
25 | Classes
26 | ../../../cocos/scripting/lua-bindings/manual
27 | ../../../external/lua/lua
28 | ../../../external/lua/tolua
29 | )
30 |
31 | # add the executable
32 | add_executable(${APP_NAME} ${SAMPLE_SRC})
33 |
34 | target_link_libraries(${APP_NAME} cocos2d luacocos2d)
35 |
36 | if(MACOSX OR APPLE)
37 | set_target_properties(${APP_NAME} PROPERTIES
38 | MACOSX_BUNDLE 1
39 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
40 | )
41 |
42 | else()
43 |
44 | set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}")
45 |
46 | set_target_properties(${APP_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}")
47 |
48 | pre_build(${APP_NAME}
49 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../res ${APP_BIN_DIR}${RES_PREFIX}/res
50 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../src ${APP_BIN_DIR}${RES_PREFIX}/src
51 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/cocos/scripting/lua-bindings/script/ ${APP_BIN_DIR}${RES_PREFIX}/src/cocos
52 | )
53 |
54 | endif()
55 |
--------------------------------------------------------------------------------
/project/Classes/AppDelegate.cpp:
--------------------------------------------------------------------------------
1 | #include "cocos2d.h"
2 | #include "AppDelegate.h"
3 | #include "audio/include/SimpleAudioEngine.h"
4 | #include "base/CCScriptSupport.h"
5 | #include "scripting/lua-bindings/manual/CCLuaEngine.h"
6 | #include "scripting/lua-bindings/manual/lua_module_register.h"
7 |
8 | USING_NS_CC;
9 | using namespace CocosDenshion;
10 |
11 | AppDelegate::AppDelegate()
12 | {
13 | // fixed me
14 | //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
15 | }
16 |
17 | AppDelegate::~AppDelegate()
18 | {
19 | // end simple audio engine here, or it may crashed on win32
20 | SimpleAudioEngine::getInstance()->end();
21 | //CCScriptEngineManager::destroyInstance();
22 | }
23 |
24 | void AppDelegate::initGLContextAttrs()
25 | {
26 | GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
27 |
28 | GLView::setGLContextAttrs(glContextAttrs);
29 | }
30 |
31 | bool AppDelegate::applicationDidFinishLaunching()
32 | {
33 | // register lua engine
34 | LuaEngine* engine = LuaEngine::getInstance();
35 | ScriptEngineManager::getInstance()->setScriptEngine(engine);
36 | lua_State* L = engine->getLuaStack()->getLuaState();
37 | lua_module_register(L);
38 | //The call was commented because it will lead to ZeroBrane Studio can't find correct context when debugging
39 | //engine->executeScriptFile("src/hello.lua");
40 |
41 | #if CC_64BITS
42 | FileUtils::getInstance()->addSearchPath("src/64bit");
43 | #endif
44 | FileUtils::getInstance()->addSearchPath("src");
45 | FileUtils::getInstance()->addSearchPath("res");
46 | engine->executeString("require 'main.lua'");
47 |
48 | return true;
49 | }
50 |
51 | // This function will be called when the app is inactive. Note, when receiving a phone call it is invoked.
52 | void AppDelegate::applicationDidEnterBackground()
53 | {
54 | Director::getInstance()->stopAnimation();
55 | SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
56 | }
57 |
58 | // this function will be called when the app is active again
59 | void AppDelegate::applicationWillEnterForeground()
60 | {
61 | Director::getInstance()->startAnimation();
62 | SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
63 | }
64 |
--------------------------------------------------------------------------------
/project/Classes/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #ifndef _APP_DELEGATE_H_
2 | #define _APP_DELEGATE_H_
3 |
4 | #include "platform/CCApplication.h"
5 |
6 | /**
7 | @brief The cocos2d Application.
8 |
9 | Private inheritance here hides part of interface from Director.
10 | */
11 | class AppDelegate : private cocos2d::Application
12 | {
13 | public:
14 | AppDelegate();
15 | virtual ~AppDelegate();
16 |
17 | virtual void initGLContextAttrs();
18 | /**
19 | @brief Implement Director and Scene init code here.
20 | @return true Initialize success, app continue.
21 | @return false Initialize failed, app terminate.
22 | */
23 | virtual bool applicationDidFinishLaunching();
24 |
25 | /**
26 | @brief Called when the application moves to the background
27 | @param the pointer of the application
28 | */
29 | virtual void applicationDidEnterBackground();
30 |
31 | /**
32 | @brief Called when the application reenters the foreground
33 | @param the pointer of the application
34 | */
35 | virtual void applicationWillEnterForeground();
36 | };
37 |
38 | #endif // _APP_DELEGATE_H_
39 |
40 |
--------------------------------------------------------------------------------
/project/Classes/lua_module_register.h:
--------------------------------------------------------------------------------
1 | #ifndef __TEST_LUA_TESTS_PROJECT_CLASSES_LUA_MODULE_REGISTER_H__
2 | #define __TEST_LUA_TESTS_PROJECT_CLASSES_LUA_MODULE_REGISTER_H__
3 |
4 | #include "scripting/lua-bindings/manual/cocosdenshion/lua_cocos2dx_cocosdenshion_manual.h"
5 |
6 |
7 | int lua_module_register(lua_State* L)
8 | {
9 | register_cocosdenshion_module(L);
10 | return 1;
11 | }
12 |
13 | #endif // __TEST_LUA_TESTS_PROJECT_CLASSES_LUA_MODULE_REGISTER_H__
14 |
15 |
--------------------------------------------------------------------------------
/project/proj.android-studio/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 | /captures
8 |
--------------------------------------------------------------------------------
/project/proj.android-studio/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /.externalNativeBuild
3 |
--------------------------------------------------------------------------------
/project/proj.android-studio/app/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
13 |
14 |
15 |
17 |
18 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/project/proj.android-studio/app/get_environment.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | source ~/.bash_profile
4 | echo $COCOS_CONSOLE_ROOT
--------------------------------------------------------------------------------
/project/proj.android-studio/app/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 |
5 | LOCAL_MODULE := lua_empty_test_shared
6 |
7 | LOCAL_MODULE_FILENAME := liblua_empty_test
8 |
9 | LOCAL_ARM_MODE := arm
10 |
11 | LOCAL_SRC_FILES := main.cpp \
12 | ../../../Classes/AppDelegate.cpp
13 |
14 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes \
15 | $(LOCAL_PATH)/../../../../../../external/lua/tolua \
16 |
17 | LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
18 |
19 | include $(BUILD_SHARED_LIBRARY)
20 |
21 | $(call import-module,scripting/lua-bindings/proj.android)
22 |
--------------------------------------------------------------------------------
/project/proj.android-studio/app/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_STL := gnustl_static
2 |
3 | APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
4 | APP_LDFLAGS := -latomic
5 | APP_ABI := armeabi
6 | APP_SHORT_COMMANDS := true
7 |
8 |
9 | ifeq ($(NDK_DEBUG),1)
10 | APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
11 | APP_OPTIM := debug
12 | else
13 | APP_CPPFLAGS += -DNDEBUG
14 | APP_OPTIM := release
15 | endif
16 |
--------------------------------------------------------------------------------
/project/proj.android-studio/app/jni/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 |
6 | #include "AppDelegate.h"
7 |
8 | #define LOG_TAG "main"
9 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
10 |
11 | namespace {
12 | std::unique_ptr appDelegate;
13 | }
14 |
15 | void cocos_android_app_init(JNIEnv* env) {
16 | LOGD("cocos_android_app_init");
17 | appDelegate.reset(new AppDelegate());
18 | }
19 |
--------------------------------------------------------------------------------
/project/proj.android-studio/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in E:\developSoftware\Android\SDK/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/project/proj.android-studio/app/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.android-studio/app/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/project/proj.android-studio/app/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.android-studio/app/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/project/proj.android-studio/app/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.android-studio/app/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/project/proj.android-studio/app/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.android-studio/app/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/project/proj.android-studio/app/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | LuaEmptyTest
3 |
4 |
--------------------------------------------------------------------------------
/project/proj.android-studio/app/src/org/cocos2dx/lua_empty_test/AppActivity.java:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | Copyright (c) 2015-2017 Chukong Technologies Inc.
3 |
4 | http://www.cocos2d-x.org
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | ****************************************************************************/
24 |
25 | package org.cocos2dx.lua_empty_test;
26 |
27 | import org.cocos2dx.lib.Cocos2dxActivity;
28 |
29 | public class AppActivity extends Cocos2dxActivity {
30 | }
31 |
--------------------------------------------------------------------------------
/project/proj.android-studio/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/project/proj.android-studio/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 | PROP_TARGET_SDK_VERSION=13
20 | PROP_APP_ABI=armeabi
21 |
22 | # uncomment it and fill in sign information for release mode
23 | #RELEASE_STORE_FILE=file path of keystore
24 | #RELEASE_STORE_PASSWORD=password of keystore
25 | #RELEASE_KEY_ALIAS=alias of key
26 | #RELEASE_KEY_PASSWORD=password of key
27 |
28 | # if you want to encrypt lua codes, uncomment the codes and set value to PROP_LUA_ENCRYPT_KEY and PROP_LUA_ENCRYPT_SIGN
29 | #PROP_LUA_ENCRYPT=1
30 | #PROP_LUA_ENCRYPT_KEY=
31 | #PROP_LUA_ENCRYPT_SIGN=
32 |
--------------------------------------------------------------------------------
/project/proj.android-studio/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.android-studio/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/project/proj.android-studio/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Mar 14 17:47:54 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/project/proj.android-studio/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/project/proj.android-studio/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/project/proj.android-studio/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':libcocos2dx'
2 | project(':libcocos2dx').projectDir = new File(settingsDir, '../../../../cocos/platform/android/libcocos2dx')
3 | include ':LuaEmptyTest'
4 | project(':LuaEmptyTest').projectDir = new File(settingsDir, 'app')
5 |
--------------------------------------------------------------------------------
/project/proj.android/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/project/proj.android/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | LuaEmptyTest
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
30 | full,incremental,
31 |
32 |
33 |
34 |
35 |
36 | com.android.ide.eclipse.adt.AndroidNature
37 | org.eclipse.jdt.core.javanature
38 | org.eclipse.cdt.core.cnature
39 | org.eclipse.cdt.core.ccnature
40 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
41 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
42 |
43 |
44 |
--------------------------------------------------------------------------------
/project/proj.android/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
12 |
13 |
14 |
16 |
17 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/project/proj.android/ant.properties:
--------------------------------------------------------------------------------
1 | # This file is used to override default values used by the Ant build system.
2 | #
3 | # This file must be checked into Version Control Systems, as it is
4 | # integral to the build system of your project.
5 |
6 | # This file is only used by the Ant script.
7 |
8 | # You can use this to override default values such as
9 | # 'source.dir' for the location of your java source folder and
10 | # 'out.dir' for the location of your output folder.
11 |
12 | # You can also use it define how the release builds are signed by declaring
13 | # the following properties:
14 | # 'key.store' for the location of your keystore and
15 | # 'key.alias' for the name of the key to use.
16 | # The password will be asked during the build when you use the 'release' target.
17 |
18 |
--------------------------------------------------------------------------------
/project/proj.android/build-cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "ndk_module_path" :[
3 | "../../../..",
4 | "../../../../cocos",
5 | "../../../../external"
6 | ],
7 | "copy_resources": [
8 | {
9 | "from": "../../src",
10 | "to": "src"
11 | },
12 | {
13 | "from": "../../res",
14 | "to": "res"
15 | },
16 | {
17 | "from": "../../../../cocos/scripting/lua-bindings/script/",
18 | "to": "src/cocos"
19 | }
20 | ]
21 | }
22 |
--------------------------------------------------------------------------------
/project/proj.android/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
29 |
30 |
31 |
40 |
41 |
42 |
43 |
47 |
48 |
60 |
61 |
62 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/project/proj.android/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | include $(CLEAR_VARS)
4 |
5 | LOCAL_MODULE := lua_empty_test_shared
6 |
7 | LOCAL_MODULE_FILENAME := liblua_empty_test
8 |
9 | LOCAL_ARM_MODE := arm
10 |
11 | LOCAL_SRC_FILES := main.cpp \
12 | ../../Classes/AppDelegate.cpp
13 |
14 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
15 | $(LOCAL_PATH)/../../../../../external/lua/tolua \
16 |
17 | LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
18 |
19 | include $(BUILD_SHARED_LIBRARY)
20 |
21 | $(call import-module,scripting/lua-bindings/proj.android)
22 |
--------------------------------------------------------------------------------
/project/proj.android/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_STL := gnustl_static
2 |
3 | APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
4 | APP_LDFLAGS := -latomic
5 | APP_ABI := armeabi
6 | APP_SHORT_COMMANDS := true
7 |
8 |
9 | ifeq ($(NDK_DEBUG),1)
10 | APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
11 | APP_OPTIM := debug
12 | else
13 | APP_CPPFLAGS += -DNDEBUG
14 | APP_OPTIM := release
15 | endif
16 |
--------------------------------------------------------------------------------
/project/proj.android/jni/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 |
6 | #include "AppDelegate.h"
7 |
8 | #define LOG_TAG "main"
9 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
10 |
11 | namespace {
12 | std::unique_ptr appDelegate;
13 | }
14 |
15 | void cocos_android_app_init(JNIEnv* env) {
16 | LOGD("cocos_android_app_init");
17 | appDelegate.reset(new AppDelegate());
18 | }
19 |
--------------------------------------------------------------------------------
/project/proj.android/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/project/proj.android/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-13
12 |
13 | android.library.reference.1=../../../../cocos/platform/android/java
14 |
--------------------------------------------------------------------------------
/project/proj.android/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.android/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/project/proj.android/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.android/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/project/proj.android/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.android/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/project/proj.android/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | LuaEmptyTest
4 |
5 |
--------------------------------------------------------------------------------
/project/proj.android/src/org/cocos2dx/lua_empty_test/AppActivity.java:
--------------------------------------------------------------------------------
1 | package org.cocos2dx.lua_empty_test;
2 |
3 | import org.cocos2dx.lib.Cocos2dxActivity;
4 |
5 | public class AppActivity extends Cocos2dxActivity {
6 | }
7 |
--------------------------------------------------------------------------------
/project/proj.ios/AppController.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | Copyright (c) 2010 cocos2d-x.org
3 |
4 | http://www.cocos2d-x.org
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | ****************************************************************************/
24 |
25 | @class RootViewController;
26 |
27 | @interface AppController : NSObject {
28 | UIWindow *window;
29 | RootViewController *viewController;
30 | }
31 |
32 | @end
33 |
34 |
--------------------------------------------------------------------------------
/project/proj.ios/AppController.mm:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | Copyright (c) 2010 cocos2d-x.org
3 |
4 | http://www.cocos2d-x.org
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | ****************************************************************************/
24 | #import
25 | #import "AppController.h"
26 | #import "cocos2d.h"
27 | #import "platform/ios/CCEAGLView-ios.h"
28 | #import "AppDelegate.h"
29 |
30 | #import "RootViewController.h"
31 |
32 | @implementation AppController
33 |
34 | #pragma mark -
35 | #pragma mark Application lifecycle
36 |
37 | // cocos2d application instance
38 | static AppDelegate s_sharedApplication;
39 |
40 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
41 |
42 | cocos2d::Application *app = cocos2d::Application::getInstance();
43 | app->initGLContextAttrs();
44 | cocos2d::GLViewImpl::convertAttrs();
45 | // Override point for customization after application launch.
46 |
47 | // Add the view controller's view to the window and display.
48 | window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
49 | CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds]
50 | pixelFormat: (NSString*)cocos2d::GLViewImpl::_pixelFormat
51 | depthFormat: cocos2d::GLViewImpl::_depthFormat
52 | preserveBackbuffer: NO
53 | sharegroup: nil
54 | multiSampling: NO
55 | numberOfSamples: 0 ];
56 |
57 | // Use RootViewController manage CCEAGLView
58 | viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
59 | viewController.wantsFullScreenLayout = YES;
60 | viewController.view = eaglView;
61 |
62 | // Set RootViewController to window
63 | if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
64 | {
65 | // warning: addSubView doesn't work on iOS6
66 | [window addSubview: viewController.view];
67 | }
68 | else
69 | {
70 | // use this method on ios6
71 | [window setRootViewController:viewController];
72 | }
73 |
74 | [window makeKeyAndVisible];
75 |
76 | [[UIApplication sharedApplication] setStatusBarHidden: YES];
77 |
78 | // IMPORTANT: Setting the GLView should be done after creating the RootViewController
79 | cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView);
80 | cocos2d::Director::getInstance()->setOpenGLView(glview);
81 |
82 | app->run();
83 | return YES;
84 | }
85 |
86 |
87 | - (void)applicationWillResignActive:(UIApplication *)application {
88 | /*
89 | 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.
90 | 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.
91 | */
92 | cocos2d::Director::getInstance()->pause();
93 | }
94 |
95 | - (void)applicationDidBecomeActive:(UIApplication *)application {
96 | /*
97 | 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.
98 | */
99 | cocos2d::Director::getInstance()->resume();
100 | }
101 |
102 | - (void)applicationDidEnterBackground:(UIApplication *)application {
103 | /*
104 | 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.
105 | If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
106 | */
107 | cocos2d::Application::getInstance()->applicationDidEnterBackground();
108 | }
109 |
110 | - (void)applicationWillEnterForeground:(UIApplication *)application {
111 | /*
112 | 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.
113 | */
114 | cocos2d::Application::getInstance()->applicationWillEnterForeground();
115 | }
116 |
117 | - (void)applicationWillTerminate:(UIApplication *)application {
118 | /*
119 | Called when the application is about to terminate.
120 | See also applicationDidEnterBackground:.
121 | */
122 | }
123 |
124 |
125 | #pragma mark -
126 | #pragma mark Memory management
127 |
128 | - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
129 | /*
130 | Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
131 | */
132 | }
133 |
134 |
135 | - (void)dealloc {
136 | [super dealloc];
137 | }
138 |
139 |
140 | @end
141 |
142 |
--------------------------------------------------------------------------------
/project/proj.ios/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.ios/Default-568h@2x.png
--------------------------------------------------------------------------------
/project/proj.ios/Default-667h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.ios/Default-667h@2x.png
--------------------------------------------------------------------------------
/project/proj.ios/Default-736h@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.ios/Default-736h@3x.png
--------------------------------------------------------------------------------
/project/proj.ios/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.ios/Default.png
--------------------------------------------------------------------------------
/project/proj.ios/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.ios/Default@2x.png
--------------------------------------------------------------------------------
/project/proj.ios/HelloLua_Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'HelloLua' target in the 'HelloLua' project
3 | //
4 |
5 | #ifdef __OBJC__
6 | #import
7 | #import
8 | #endif
9 |
--------------------------------------------------------------------------------
/project/proj.ios/Icon-114.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.ios/Icon-114.png
--------------------------------------------------------------------------------
/project/proj.ios/Icon-120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.ios/Icon-120.png
--------------------------------------------------------------------------------
/project/proj.ios/Icon-144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.ios/Icon-144.png
--------------------------------------------------------------------------------
/project/proj.ios/Icon-152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.ios/Icon-152.png
--------------------------------------------------------------------------------
/project/proj.ios/Icon-57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.ios/Icon-57.png
--------------------------------------------------------------------------------
/project/proj.ios/Icon-72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.ios/Icon-72.png
--------------------------------------------------------------------------------
/project/proj.ios/Icon-76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.ios/Icon-76.png
--------------------------------------------------------------------------------
/project/proj.ios/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 | Icon-57.png
13 | CFBundleIcons
14 |
15 | CFBundlePrimaryIcon
16 |
17 | CFBundleIconFiles
18 |
19 |
20 | Icon.png
21 | Icon-57.png
22 | Icon-114.png
23 | Icon-72.png
24 | Icon-144.png
25 |
26 | UIPrerenderedIcon
27 |
28 |
29 |
30 | CFBundleIdentifier
31 | $(PRODUCT_BUNDLE_IDENTIFIER)
32 | CFBundleInfoDictionaryVersion
33 | 6.0
34 | CFBundleName
35 | ${PRODUCT_NAME}
36 | CFBundlePackageType
37 | APPL
38 | CFBundleSignature
39 | ????
40 | CFBundleVersion
41 | 1.0
42 | LSRequiresIPhoneOS
43 |
44 | UILaunchImages
45 |
46 |
47 | UILaunchImageMinimumOSVersion
48 | 8.0
49 | UILaunchImageName
50 | Default
51 | UILaunchImageOrientation
52 | Portrait
53 | UILaunchImageSize
54 | {320, 480}
55 |
56 |
57 | UILaunchImageMinimumOSVersion
58 | 8.0
59 | UILaunchImageName
60 | Default
61 | UILaunchImageOrientation
62 | Landscape
63 | UILaunchImageSize
64 | {320, 480}
65 |
66 |
67 | UILaunchImageMinimumOSVersion
68 | 8.0
69 | UILaunchImageName
70 | Default-568h
71 | UILaunchImageOrientation
72 | Portrait
73 | UILaunchImageSize
74 | {320, 568}
75 |
76 |
77 | UILaunchImageMinimumOSVersion
78 | 8.0
79 | UILaunchImageName
80 | Default-568h
81 | UILaunchImageOrientation
82 | Landscape
83 | UILaunchImageSize
84 | {320, 568}
85 |
86 |
87 | UILaunchImageMinimumOSVersion
88 | 8.0
89 | UILaunchImageName
90 | Default-667h
91 | UILaunchImageOrientation
92 | Portrait
93 | UILaunchImageSize
94 | {375, 667}
95 |
96 |
97 | UILaunchImageMinimumOSVersion
98 | 8.0
99 | UILaunchImageName
100 | Default-667h
101 | UILaunchImageOrientation
102 | Landscape
103 | UILaunchImageSize
104 | {375, 667}
105 |
106 |
107 | UILaunchImageMinimumOSVersion
108 | 8.0
109 | UILaunchImageName
110 | Default-736h
111 | UILaunchImageOrientation
112 | Portrait
113 | UILaunchImageSize
114 | {414, 736}
115 |
116 |
117 | UILaunchImageMinimumOSVersion
118 | 8.0
119 | UILaunchImageName
120 | Default-736h
121 | UILaunchImageOrientation
122 | Landscape
123 | UILaunchImageSize
124 | {414, 736}
125 |
126 |
127 | UIPrerenderedIcon
128 |
129 | UIRequiredDeviceCapabilities
130 |
131 | accelerometer
132 |
133 | opengles-1
134 |
135 |
136 | UIStatusBarHidden
137 |
138 | UISupportedInterfaceOrientations
139 |
140 | UIInterfaceOrientationLandscapeRight
141 | UIInterfaceOrientationLandscapeLeft
142 |
143 |
144 |
145 |
--------------------------------------------------------------------------------
/project/proj.ios/RootViewController.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | Copyright (c) 2010-2011 cocos2d-x.org
3 | Copyright (c) 2010 Ricardo Quesada
4 |
5 | http://www.cocos2d-x.org
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in
15 | all copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | THE SOFTWARE.
24 | ****************************************************************************/
25 |
26 | #import
27 |
28 |
29 | @interface RootViewController : UIViewController {
30 |
31 | }
32 | - (BOOL)prefersStatusBarHidden;
33 | @end
34 |
--------------------------------------------------------------------------------
/project/proj.ios/RootViewController.mm:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | Copyright (c) 2010-2011 cocos2d-x.org
3 | Copyright (c) 2010 Ricardo Quesada
4 |
5 | http://www.cocos2d-x.org
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in
15 | all copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | THE SOFTWARE.
24 | ****************************************************************************/
25 |
26 | #import "RootViewController.h"
27 |
28 |
29 | @implementation RootViewController
30 |
31 | /*
32 | // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
33 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
34 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
35 | // Custom initialization
36 | }
37 | return self;
38 | }
39 | */
40 |
41 | /*
42 | // Implement loadView to create a view hierarchy programmatically, without using a nib.
43 | - (void)loadView {
44 | }
45 | */
46 |
47 | /*
48 | // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
49 | - (void)viewDidLoad {
50 | [super viewDidLoad];
51 | }
52 |
53 | */
54 | // Override to allow orientations other than the default portrait orientation.
55 | // This method is deprecated on ios6
56 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
57 | return UIInterfaceOrientationIsLandscape( interfaceOrientation );
58 | }
59 |
60 | // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
61 | - (NSUInteger) supportedInterfaceOrientations{
62 | #ifdef __IPHONE_6_0
63 | return UIInterfaceOrientationMaskAllButUpsideDown;
64 | #endif
65 | }
66 |
67 | - (BOOL) shouldAutorotate {
68 | return YES;
69 | }
70 |
71 | //fix not hide status on ios7
72 | - (BOOL)prefersStatusBarHidden
73 | {
74 | return YES;
75 | }
76 |
77 | - (void)didReceiveMemoryWarning {
78 | // Releases the view if it doesn't have a superview.
79 | [super didReceiveMemoryWarning];
80 |
81 | // Release any cached data, images, etc that aren't in use.
82 | }
83 |
84 | - (void)viewDidUnload {
85 | [super viewDidUnload];
86 | // Release any retained subviews of the main view.
87 | // e.g. self.myOutlet = nil;
88 | }
89 |
90 |
91 | - (void)dealloc {
92 | [super dealloc];
93 | }
94 |
95 |
96 | @end
97 |
--------------------------------------------------------------------------------
/project/proj.ios/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // HelloLua
4 | //
5 | // Created by Walzer on 11-6-15.
6 | // Copyright __MyCompanyName__ 2011. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | int main(int argc, char *argv[]) {
12 | NSAutoreleasePool *pool = [NSAutoreleasePool new];
13 | int retVal = UIApplicationMain(argc, argv, nil, @"AppController");
14 | [pool release];
15 | return retVal;
16 | }
17 |
--------------------------------------------------------------------------------
/project/proj.linux/main.cpp:
--------------------------------------------------------------------------------
1 | #include "../Classes/AppDelegate.h"
2 | #include "cocos2d.h"
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | USING_NS_CC;
10 |
11 | int main(int argc, char **argv)
12 | {
13 | // create the application instance
14 | AppDelegate app;
15 | return Application::getInstance()->run();
16 | }
17 |
--------------------------------------------------------------------------------
/project/proj.mac/HelloLua_Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'Paralaxer' target in the 'Paralaxer' project
3 | //
4 |
5 | #ifdef __OBJC__
6 | #import
7 | #endif
8 |
--------------------------------------------------------------------------------
/project/proj.mac/Icon.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.mac/Icon.icns
--------------------------------------------------------------------------------
/project/proj.mac/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIconFile
10 | Icon
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSMinimumSystemVersion
26 | ${MACOSX_DEPLOYMENT_TARGET}
27 | NSHumanReadableCopyright
28 | Copyright © 2012. All rights reserved.
29 | NSMainNibFile
30 | MainMenu
31 | NSPrincipalClass
32 | NSApplication
33 |
34 |
35 |
--------------------------------------------------------------------------------
/project/proj.mac/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/project/proj.mac/main.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | Copyright (c) 2010 cocos2d-x.org
3 |
4 | http://www.cocos2d-x.org
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | ****************************************************************************/
24 |
25 | #include "AppDelegate.h"
26 | #include "cocos2d.h"
27 |
28 | USING_NS_CC;
29 |
30 | int main(int argc, char *argv[])
31 | {
32 | AppDelegate app;
33 | return Application::getInstance()->run();
34 | }
35 |
--------------------------------------------------------------------------------
/project/proj.tizen/.exportMap:
--------------------------------------------------------------------------------
1 | {
2 | global: main;
3 | local: *;
4 | };
5 |
--------------------------------------------------------------------------------
/project/proj.tizen/.gitignore:
--------------------------------------------------------------------------------
1 | /SA_Report
2 | /.sign
3 | /crash-info
4 | .checkers
5 | .sdk_delta.info
6 |
7 | /Emulator
8 | /Debug
9 |
--------------------------------------------------------------------------------
/project/proj.tizen/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | lua-empty-test
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
15 | full,incremental,
16 |
17 |
18 |
19 |
20 | org.tizen.nativecore.apichecker.core.builder
21 |
22 |
23 |
24 |
25 |
26 | org.eclipse.cdt.core.cnature
27 | org.eclipse.cdt.core.ccnature
28 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
29 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
30 | org.tizen.nativecore.apichecker.core.tizenCppNature
31 |
32 |
33 |
34 | Classes
35 | 2
36 | PARENT-1-PROJECT_LOC/Classes
37 |
38 |
39 |
40 |
41 | 1426053993877
42 |
43 | 26
44 |
45 | org.eclipse.ui.ide.multiFilter
46 | 1.0-projectRelativePath-matches-false-false-*/.tpk
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/project/proj.tizen/.tproject:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | mobile-2.4
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/project/proj.tizen/Build/appendix.mk:
--------------------------------------------------------------------------------
1 | # Appendix
2 |
--------------------------------------------------------------------------------
/project/proj.tizen/Build/basedef.mk:
--------------------------------------------------------------------------------
1 | # Add inputs and outputs from these tool invocations to the build variables
2 |
3 |
4 | OS_NAME := $(shell $(UNAME))
5 |
6 |
7 | #ifeq ($(origin BUILD_CONFIG), undefined)
8 | BUILD_CONFIG ?= Debug
9 | #endif
10 |
11 | #ifeq ($(origin ARCH), undefined)
12 | ARCH ?= i386
13 | #endif
14 |
15 | #ifeq ($(origin PROJPATH), undefined)
16 | PROJPATH ?= .
17 | #endif
18 |
19 |
20 | #ifeq ($(origin PROJ_PATH), undefined)
21 | PROJ_PATH ?= $(PROJPATH)
22 | #endif
23 |
24 | #ifeq ($(strip $(OUTPUT_DIR)),)
25 | OUTPUT_DIR ?= $(PROJ_PATH)/$(BUILD_CONFIG)
26 | #endif
27 |
28 | ifeq ($(strip $(ARCH)), armel)
29 | BUILD_ARCH = arm
30 | else
31 | BUILD_ARCH = x86
32 | endif
33 |
34 | #ifeq ($(strip $(ENVENTOR_PATH)),)
35 | ENVENTOR_PATH ?= $(SDK_TOOLPATH)/enventor
36 | #endif
37 |
--------------------------------------------------------------------------------
/project/proj.tizen/Build/build_c.mk:
--------------------------------------------------------------------------------
1 | # C/C++ build script
2 |
3 |
4 | _FUNC_EXT2O = $(patsubst %.$(3),$(1)/%.o,$(2))
5 | _FUNC_C2O = $(call _FUNC_EXT2O,$(1),$(2),c)
6 | _FUNC_CPP2O = $(call _FUNC_EXT2O,$(1),$(2),cpp)
7 |
8 |
9 | # parameter :
10 | # $(1) - C/C++ soruce file
11 | # $(2) - output path
12 | # $(3) - .ext
13 | CONVERT_ESC_EXT_TO_O = $(addprefix $(2)/,$(call CONVERT_4MAKE_TO_OUT,$(patsubst %.$(3),%.o,$(1))))
14 |
15 | CONVERT_ESC_C_TO_O = $(call CONVERT_ESC_EXT_TO_O,$(1),$(2),c)
16 | CONVERT_ESC_CPP_TO_O = $(call CONVERT_ESC_EXT_TO_O,$(1),$(2),cpp)
17 |
18 |
19 | # parameter :
20 | # $(1) - encoded one C/C++ soruce file
21 | # $(2) - output path
22 | # $(3) - ext title (C/C++)
23 | # $(4) - ext (c/cpp)
24 | # $(5) - compiler ($(CC)/$(CXX))
25 | # $(6) - build opt
26 | # $(7) - build opt file
27 | # output :
28 | # $(8) - output files list
29 | define C_BUILD_PROC_RAW
30 | $(call CONVERT_ESC_EXT_TO_O,$(1),$(2),$(4)) : $(call DECODE_4MAKE,$(1)) $(7)
31 | @echo ' Building file: $$<'
32 | @echo ' Invoking: $(3) Compiler'
33 | $$(call MAKEDIRS,$$(@D))
34 | $(5) -c "$$<" -o "$$@" $(6) @$(7)
35 | @echo ' Finished building: $$<'
36 | $(8) += $(call CONVERT_ESC_EXT_TO_O,$(1),$(2),$(4))
37 | endef
38 |
39 |
40 | # parameter :
41 | # $(1) - output paths
42 | # $(2) - src paths
43 | # $(3) - inc paths
44 | # $(4) - inc files
45 | # $(5) - Defs
46 | # $(6) - UnDefs
47 | # $(7) - compiler opt
48 | # $(8) - compiler opt file
49 | # $(9) - ext title (C/C++)
50 | # $(10) - ext (c/cpp)
51 | # $(11) - compiler ($(CC)/$(CXX))
52 | # output :
53 | # $(12) - OBJS
54 | # return :
55 | # none
56 | define C_PROC_RAW
57 |
58 | _OUTPUT_DIR := $$(strip $(1))#
59 | _SRCS := $(2)#
60 | _INCS := $(3)#
61 | _INC_FILES := $(4)#
62 | _DEFS := $(5)#
63 | _UNDEFS := $(6)#
64 |
65 | _OPT := $(7)
66 | _OPT_FILE := $(8)
67 |
68 | _EXT_TITLE := $(9)
69 | _EXT := $(10)
70 | _COMPILER := $(11)
71 |
72 | #_OUTPUT_FILES := $(12)
73 |
74 | _ENC_SRCS := $$(call ENCODE_4MAKE,$$(_SRCS))
75 | _ENC_SRCS := $$(filter %.$$(_EXT),$$(_ENC_SRCS))
76 |
77 | ifneq ($$(strip $$(_SRCS)),)
78 |
79 | _NORMAL_SRCS := $$(filter-out %*.$$(_EXT),$$(_ENC_SRCS))
80 | _WIDLCARD_SRCS := $$(filter %*.$$(_EXT),$$(_ENC_SRCS))
81 |
82 | _ALL_SRCS := $$(call DECODE_4MAKE,$$(_NORMAL_SRCS)) \
83 | $$(foreach var,$$(_WIDLCARD_SRCS),$$(call FIND_FILES_4MAKE,$$(call DECODE_4MAKE,$$(var))))
84 |
85 | ifneq ($$(strip $$(_ALL_SRCS)),)
86 |
87 | _ENC_SRCS := $$(call ENCODE_4MAKE,$$(_ALL_SRCS))
88 |
89 | _CDEFS := $$(CDEFS)
90 | _CDEFS += $$(addprefix -D,$$(_DEFS))
91 | _CDEFS += $$(addprefix -U,$$(_UNDEFS))
92 |
93 | _ENC_C_INCS := $$(call ENCODE_4MAKE,$$(_INCS))
94 | _ENC_C_INCS := $$(addprefix -I,$$(_ENC_C_INCS))
95 |
96 | _ENC_INC_FILES := $$(call ENCODE_4MAKE,$$(_INC_FILES))
97 | _ENC_INC_FILES += $$(addprefix -include,$$(_ENC_INC_FILES))
98 |
99 | _C_INCS := $$(call DECODE_4MAKE,$$(_ENC_C_INCS) $$(_ENC_C_INC_FILES))
100 |
101 | _DEFS := $$(_CDEFS) $$(_C_INCS) -I"pch" $$(_OPT)
102 |
103 | $$(foreach var,$$(_ENC_SRCS),$$(eval $$(call C_BUILD_PROC_RAW,$$(var),$$(_OUTPUT_DIR),$$(_EXT_TITLE),$$(_EXT),$$(_COMPILER),$$(_DEFS),$$(_OPT_FILE),$(12))))
104 |
105 | endif # (_(strip _(_ALL_SRCS)),)
106 |
107 | endif # (_(strip _(_SRCS)),)
108 |
109 |
110 | endef
111 |
--------------------------------------------------------------------------------
/project/proj.tizen/Build/build_edc.mk:
--------------------------------------------------------------------------------
1 | # EDC build script
2 |
3 |
4 | FUNC_EDC2EDJ = $(patsubst %.edc,$(2)/%.edj,$(1))
5 |
6 | # parameter :
7 | # $(1) - C/C++ soruce file
8 | # $(2) - output path
9 | CONVERT_ESC_EDC_TO_EDJ = $(call CONVERT_4MAKE_TO_OUT,$(call FUNC_EDC2EDJ,$(1),$(2)))
10 |
11 |
12 | # parameter :
13 | # $(1) - encoded one C/C++ soruce file
14 | # $(2) - output path
15 | # $(3) - build opt
16 | # output :
17 | # $(4) - output files list
18 | define EDJ_BUILD_PROC_RAW
19 | $(call CONVERT_ESC_EDC_TO_EDJ,$(1),$(2)) : $(call DECODE_4MAKE,$(1))
20 | @echo ' Building file: $$<'
21 | @echo ' Invoking: EDC Resource Compiler'
22 | $$(call MAKEDIRS,$$(@D))
23 | $$(EDJE_CC) $(3) "$$<" "$$@"
24 | @echo ' Finished building: $$<'
25 | $(4) += $(call CONVERT_ESC_EDC_TO_EDJ,$(1),$(2))
26 | endef
27 |
28 |
29 | # parameter :
30 | # $(1) - output paths
31 | # $(2) - src paths
32 | # $(3) - image inc paths
33 | # $(4) - sound inc paths
34 | # $(5) - font inc paths
35 | # output :
36 | # $(6) - OBJS
37 | # return :
38 | # none
39 | define EDJ_PROC_RAW
40 |
41 | _OUTPUT_DIR := $$(strip $(1))#
42 | _SRCS := $(2)#
43 | _IMAGE_DIRS := $(3)#
44 | _SOUND_DIRS := $(4)#
45 | _FONT_DIRS := $(5)#
46 |
47 | ifneq ($$(strip $$(_SRCS)),)
48 |
49 | _ENC_SRCS := $$(call ENCODE_4MAKE,$$(_SRCS))
50 |
51 | _NORMAL_SRCS := $$(filter-out %*.edc,$$(_ENC_SRCS))
52 | _WIDLCARD_SRCS := $$(filter %*.edc,$$(_ENC_SRCS))
53 |
54 | _ALL_SRCS := $$(call DECODE_4MAKE,$$(_NORMAL_SRCS)) \
55 | $$(foreach var,$$(_WIDLCARD_SRCS),$$(call FIND_FILES_4MAKE,$$(call DECODE_4MAKE,$$(var))))
56 |
57 | ifneq ($$(strip $$(_ALL_SRCS)),)
58 |
59 | _ENC_SRCS := $$(call ENCODE_4MAKE,$$(_ALL_SRCS))
60 |
61 | _COMPILER_FLAGS := -id "$$(ENVENTOR_SHARED_RES_PATH)/images"
62 | _COMPILER_FLAGS += -sd "$$(ENVENTOR_SHARED_RES_PATH)/sounds"
63 | _COMPILER_FLAGS += -fd "$$(ENVENTOR_SHARED_RES_PATH)/fonts"
64 |
65 | ifneq ($$(strip $$(_IMAGE_DIRS)),)
66 | _COMPILER_FLAGS += $$(addprefix -id ,$$(_IMAGE_DIRS))
67 | endif
68 | ifneq ($$(strip $$(_SOUND_DIRS)),)
69 | _COMPILER_FLAGS += $$(addprefix -sd ,$$(_SOUND_DIRS))
70 | endif
71 | ifneq ($$(strip $$(_FONT_DIRS)),)
72 | _COMPILER_FLAGS += $$(addprefix -fd ,$$(_FONT_DIRS))
73 | endif
74 |
75 | $$(foreach var,$$(_ENC_SRCS),$$(eval $$(call EDJ_BUILD_PROC_RAW,$$(var),$$(_OUTPUT_DIR),$$(_COMPILER_FLAGS),$(6))))
76 |
77 | endif # (_(strip _(_ALL_SRCS)),)
78 |
79 | endif # (_(strip _(_SRCS)),)
80 |
81 | endef
82 |
--------------------------------------------------------------------------------
/project/proj.tizen/Build/build_po.mk:
--------------------------------------------------------------------------------
1 | # PO build script
2 |
3 |
4 | _FUNC_PO2MO = $(patsubst %.po,$(2)/res/locale/%/LC_MESSAGES/$(3).mo,$(notdir $(1)))
5 |
6 |
7 | # parameter :
8 | # $(1) - C/C++ soruce file
9 | # $(2) - output path
10 | # $(3) - app name
11 | CONVERT_ESC_PO_TO_MO = $(call CONVERT_4MAKE_TO_OUT,$(call _FUNC_PO2MO,$(1),$(2),$(3)))
12 |
13 |
14 | # parameter :
15 | # $(1) - encoded one C/C++ soruce file
16 | # $(2) - output path
17 | # $(3) - app name
18 | # output :
19 | # $(4) - output files list
20 | define MO_BUILD_PROC_RAW
21 | $(call CONVERT_ESC_PO_TO_MO,$(1),$(2),$(3)) : $(call DECODE_4MAKE,$(1))
22 | @echo ' Building file: $$<'
23 | @echo ' Invoking: msgfmt String Formatter'
24 | $$(call MAKEDIRS,$$(@D))
25 | $$(MSGFMT) -o "$$@" "$$<"
26 | @echo ' Finished building: $$<'
27 | $(4) += $(call CONVERT_ESC_PO_TO_MO,$(1),$(2),$(3))
28 | endef
29 |
30 |
31 | # parameter :
32 | # $(1) - output dir
33 | # $(2) - src paths
34 | # $(3) - app name
35 | # output :
36 | # $(4) - OBJS
37 |
38 | define MO_PROC_RAW
39 |
40 | _PROJ_ROOT := $(1)
41 | _SRCS := $(2)
42 | _APPNAME := $(3)
43 |
44 | ifneq ($$(strip $$(_SRCS)),)
45 |
46 | _ENC_SRCS := $$(call ENCODE_4MAKE,$$(_SRCS))
47 |
48 | _NORMAL_SRCS := $$(filter-out %*.po,$$(_ENC_SRCS))
49 | _WIDLCARD_SRCS := $$(filter %*.po,$$(_ENC_SRCS))
50 |
51 | _ALL_SRCS := $$(call DECODE_4MAKE,$$(_NORMAL_SRCS)) \
52 | $$(foreach var,$$(_WIDLCARD_SRCS),$$(call FIND_FILES_4MAKE,$$(call DECODE_4MAKE,$$(var))))
53 |
54 | ifneq ($$(strip $$(_ALL_SRCS)),)
55 |
56 | _ENC_SRCS := $$(call ENCODE_4MAKE,$$(_ALL_SRCS))
57 |
58 | $$(foreach var,$$(_ENC_SRCS),$$(eval $$(call MO_BUILD_PROC_RAW,$$(var),$$(_OUTPUT_DIR),$$(_APPNAME),$(4))))
59 |
60 | endif # (_(strip _(_ALL_SRCS)),)
61 |
62 | endif # (_(strip _(_SRCS)),)
63 |
64 | endef
65 |
--------------------------------------------------------------------------------
/project/proj.tizen/Build/flags.mk:
--------------------------------------------------------------------------------
1 | # Add tools flags defines
2 |
3 | ifeq ($(strip $(BUILD_CONFIG)),Debug)
4 | OPTIMIZATION_OP := -O0
5 | DEBUG_OP := -g3 -D_DEBUG
6 | CPP_OPTIMIZATION_OP := -O0
7 | CPP_DEBUG_OP := -g3 -D_DEBUG
8 | LINK_OP :=
9 | else
10 | ifeq ($(strip $(BUILD_CONFIG)),Release)
11 | OPTIMIZATION_OP := -O3
12 | DEBUG_OP :=
13 | CPP_OPTIMIZATION_OP := -O3
14 | CPP_DEBUG_OP :=
15 | LINK_OP := -s
16 | endif
17 | endif
18 |
19 | COMPILE_FLAGS = $(DEBUG_OP) $(OPTIMIZATION_OP) -Wall -c -fmessage-length=0
20 |
21 | CPP_COMPILE_FLAGS = $(CPP_DEBUG_OP) $(CPP_OPTIMIZATION_OP) -Wall -p -pg -c -fmessage-length=0 -std=c++11
22 |
23 | LINK_FLAGS = -L"$(PROJ_PATH)/lib" -Wl,--no-undefined $(LINK_OP)
24 |
25 | AR_FLAGS =
26 |
27 | EDC_COMPILE_FLAGS = -id "$(PROJ_PATH)/edje/images" -sd "$(PROJ_PATH)/edje/sounds" -fd "$(PROJ_PATH)/edje/fonts"
28 |
--------------------------------------------------------------------------------
/project/proj.tizen/Build/funcs.mk:
--------------------------------------------------------------------------------
1 |
2 | BSLASH := \\#
3 | NULL_CHAR := #
4 | SPACE := \ #
5 | COLON := :#
6 | DOTDOT := ..#
7 | SPACE_ESC := &sp;#
8 | COLON_ESC := &co;#
9 | SPACE_OUT := ~sp~#
10 | COLON_OUT := ~co~#
11 | DOTDOT_OUT := ~dtdt~#
12 |
13 | BSLASH2SLASH = $(subst $(BSLASH),/,$(1))
14 |
15 | REMOVE_TAIL = $(patsubst %/,%,$(1))
16 |
17 | #LOWER_CASE = $(shell echo translit($(1),[A-Z],[a-z])|$(M4))
18 | LOWER_CASE = $(shell echo $(1)|$(TR) [A-Z] [a-z])
19 |
20 | #ifneq ($(findstring Windows,$(OS)),)
21 | # ...
22 | #endif
23 |
24 | FIND_FILES = $(shell $(FIND) $(1)/$(2) | $(SED) 's/^$(subst /,$(BSLASH)/,$(1))$(BSLASH)///')
25 | FIND_FILES_ESC = $(shell $(FIND) $(1)/$(2) | $(SED) 's/^$(subst /,$(BSLASH)/,$(1))$(BSLASH)///' -e 's/:/$(BSLASH)&co;/g' -e 's/$(BSLASH) /$(BSLASH)&sp;/g')
26 | FIND_FILES_4MAKE = $(shell $(FIND) $(1)/$(2) | $(SED) 's/^$(subst /,$(BSLASH)/,$(1))$(BSLASH)///')
27 |
28 | FIND_FILES_ABS = $(shell $(FIND) $(1))
29 | FIND_FILES_ABS_4MAKE = $(shell $(FIND) $(1) -e 's/$(BSLASH) /$(BSLASH)&sp;/g')
30 | FIND_FILES_ABS_ESC = $(shell $(FIND) $(1) -e 's/:/$(BSLASH)&co;/g' -e 's/$(BSLASH) /$(BSLASH)&sp;/g')
31 |
32 | FIND_FILES_4MAKE = $(shell $(FIND) $(1) | $(SED) 's/ /\\\ /g')
33 |
34 | #ENCODE_ESC = $(shell echo $(1) | $(SED) -e 's/:/$(BSLASH)&co;/g' -e 's/$(BSLASH) /$(BSLASH)&sp;/g')
35 | #DECODE_ESC = $(shell echo $(1) | $(SED) -e 's/$(BSLASH)&co;/:/g' -e 's/$(BSLASH)&sp;/$(BSLASH) / g')
36 | ENCODE_ESC = $(subst $(SPACE),$(SPACE_ESC),$(subst $(COLON),$(COLON_ESC),$(1)))
37 | DECODE_ESC = $(subst $(COLON_ESC),$(COLON),$(subst $(SPACE_ESC),$(SPACE),$(1)))
38 | ENCODE_4MAKE = $(subst $(SPACE),$(SPACE_ESC),$(1))
39 | DECODE_4MAKE = $(subst $(SPACE_ESC),$(SPACE),$(1))
40 |
41 | CONVERT_TO_OUT = $(subst $(DOTDOT),$(DOTDOT_OUT),$(subst $(COLON),$(COLON_OUT),$(subst $(SPACE),$(SPACE_OUT),$(1))))
42 | CONVERT_ESC_TO_OUT = $(subst $(DOTDOT),$(DOTDOT_OUT),$(subst $(COLON_ESC),$(COLON_OUT),$(subst $(SPACE_ESC),$(SPACE_OUT),$(1))))
43 | CONVERT_4MAKE_TO_OUT = $(subst $(DOTDOT),$(DOTDOT_OUT),$(subst $(COLON),$(COLON_OUT),$(subst $(SPACE_ESC),$(SPACE_OUT),$(1))))
44 |
45 | PROC_NO_EXIST = $(if $(wildcard $(1)),,$(call $(2),$(1)))
46 | define MAKEDIRS0
47 | @echo ' Building directory: $(1)'
48 | @$(MKDIR) $(MKDIR_OP) $(subst $(BSLASH),/,$(1))
49 | endef
50 | MAKEDIRS = $(call PROC_NO_EXIST,$(1),MAKEDIRS0)
51 |
--------------------------------------------------------------------------------
/project/proj.tizen/Build/makefile:
--------------------------------------------------------------------------------
1 | #
2 | # Usege : make -f /Build/makefile -C
3 | #
4 |
5 | BUILD_SCRIPT_VERSION := 1.1.0
6 |
7 | .PHONY : app_version app_build app_clean build_version
8 |
9 |
10 | all : app_build
11 |
12 | clean : app_clean
13 |
14 | version : build_version
15 |
16 | #PROJ_ROOT = .
17 | BUILD_ROOT := $(PROJ_PATH)/Build#
18 |
19 | ifeq ($(MAKE_NAME),mingw32-make)
20 | ifneq ($(SHELL),)
21 | OPTIONS += --eval="SHELL=$(SHELL)"
22 | endif
23 | endif
24 |
25 | app_build :
26 | @echo $(MAKE) -f "$(BUILD_ROOT)/makefile.mk"
27 | @$(MAKE) -f "$(BUILD_ROOT)/makefile.mk" -C "$(PROJ_PATH)" $(OPTIONS)
28 |
29 | app_clean :
30 | @$(MAKE) -f "$(BUILD_ROOT)/makefile.mk" -C "$(PROJ_PATH)" $(OPTIONS) clean
31 |
32 | build_version :
33 | @echo makefile : $(BUILD_SCRIPT_VERSION)
34 | @$(MAKE) -f "$(BUILD_ROOT)/makefile.mk" -C "$(PROJ_PATH)" $(OPTIONS) version
35 |
--------------------------------------------------------------------------------
/project/proj.tizen/Build/platform.mk:
--------------------------------------------------------------------------------
1 | # Add inputs and outputs from these tool invocations to the build variables
2 |
3 | SYSROOT = $(SBI_SYSROOT)
4 |
5 | USR_INCS := $(addprefix -I $(SYSROOT),$(PLATFORM_INCS_EX))
6 |
7 | ifeq ($(strip $(PLATFORM_LIB_PATHS)),)
8 | RS_LIB_PATHS := "$(SYSROOT)/usr/lib"
9 | else
10 | RS_LIB_PATHS := $(addprefix -L$(SYSROOT),$(PLATFORM_LIB_PATHS))
11 | endif
12 |
13 | RS_LIBRARIES := $(addprefix -l,$(RS_LIBRARIES_EX))
14 |
15 | PLATFORM_INCS = $(USR_INCS) -I"$(SDK_PATH)/library"
16 |
--------------------------------------------------------------------------------
/project/proj.tizen/Build/tooldef.mk:
--------------------------------------------------------------------------------
1 | # Add inputs and outputs from these tool invocations to the build variables
2 |
3 | ifneq ($(strip $(SHELL_BIN)),)
4 | SHELL = $(SHELL_BIN)
5 | else
6 | SHELL = sh
7 | endif
8 |
9 | ifneq ($(strip $(MKDIR_BIN)),)
10 | MKDIR = $(MKDIR_BIN)
11 | MKDIR_OP = -p
12 | else
13 | MKDIR = mkdir
14 | MKDIR_OP = -p
15 | endif
16 |
17 | ifneq ($(strip $(UNAME_BIN)),)
18 | UNAME = $(UNAME_BIN)
19 | else
20 | UNAME = uname
21 | endif
22 |
23 | ifneq ($(strip $(M4_BIN)),)
24 | M4 = $(M4_BIN)
25 | else
26 | M4 = m4
27 | endif
28 |
29 | ifneq ($(strip $(TR_BIN)),)
30 | TR = $(TR_BIN)
31 | else
32 | TR = tr
33 | endif
34 |
35 | ifneq ($(strip $(FIND_BIN)),)
36 | FIND = $(FIND_BIN)
37 | else
38 | FIND = find
39 | endif
40 |
41 | ifneq ($(strip $(SED_BIN)),)
42 | SED = $(SED_BIN)
43 | else
44 | SED = sed
45 | endif
46 |
47 | ifneq ($(strip $(GREP_BIN)),)
48 | GREP = $(GREP_BIN)
49 | else
50 | GREP = grep
51 | endif
52 |
53 | ifneq ($(strip $(EDJE_CC_BIN)),)
54 | EDJE_CC = $(EDJE_CC_BIN)
55 | else
56 | EDJE_CC = edje_cc
57 | endif
58 |
59 | ifneq ($(strip $(MSGFMT_BIN)),)
60 | MSGFMT = $(MSGFMT_BIN)
61 | else
62 | MSGFMT = msgfmt
63 | endif
64 |
--------------------------------------------------------------------------------
/project/proj.tizen/build-cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "copy_resources": [
3 | {
4 | "from": "../../src",
5 | "to": "src",
6 | "exclude": [
7 | ".gitignore",
8 | ".Ds_Store"
9 | ]
10 | },
11 | {
12 | "from": "../../res",
13 | "to": "res"
14 | },
15 | {
16 | "from": "../../../../cocos/scripting/lua-bindings/script/",
17 | "to": "src/cocos"
18 | }
19 | ],
20 | "depend_projs": [
21 | "../../../../build/tizen",
22 | "../../../../cocos/scripting/lua-bindings/proj.tizen"
23 | ]
24 | }
25 |
--------------------------------------------------------------------------------
/project/proj.tizen/copy_resource.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cp -r ../../../res/* ../res/
4 | cp -r ../../../src/* ../res/src/
5 | mkdir -p ../res/src/cocos/
6 | cp -r ../../../../../cocos/scripting/lua-bindings/script/* ../res/src/cocos/
7 |
8 |
--------------------------------------------------------------------------------
/project/proj.tizen/project_def.prop:
--------------------------------------------------------------------------------
1 |
2 | # Project Name
3 | APPNAME = lua-empty-test
4 |
5 | # Project Type
6 | type = app
7 |
8 | # Project Profile
9 | profile = mobile-2.4
10 |
11 | # C/CPP Sources
12 | USER_SRCS = src/main.cpp \
13 | ../Classes/AppDelegate.cpp
14 |
15 | # EDC Sources
16 | USER_EDCS =
17 |
18 | # PO Sources
19 | USER_POS =
20 |
21 | # User Defines
22 | USER_DEFS =
23 | USER_CPP_DEFS = TIZEN CC_ENABLE_BULLET_INTEGRATION CC_USE_3D_PHYSICS COCOS2D_DEBUG=1
24 |
25 | # User Undefines
26 | USER_UNDEFS =
27 | USER_CPP_UNDEFS =
28 |
29 | # User Libraries
30 | USER_LIBS = luacocos2d cocos2dx websockets chipmunk png jpeg tiff webp
31 |
32 | # User Objects
33 | USER_OBJS =
34 |
35 | # User Includes
36 | ## C Compiler
37 | USER_C_INC_DIRS =
38 | USER_INC_FILES =
39 |
40 | ## C++ Compiler
41 | USER_CPP_INC_DIRS = ../Classes \
42 | ../../../../cocos \
43 | ../../../../cocos/editor-support \
44 | ../../../../cocos/platform \
45 | ../../../../extensions \
46 | ../../../../external \
47 | ../../../../external/Box2D \
48 | ../../../../external/ConvertUTF \
49 | ../../../../external/bullet \
50 | ../../../../external/chipmunk/include/ \
51 | ../../../../external/chipmunk/include/chipmunk \
52 | ../../../../external/edtaa3func \
53 | ../../../../external/jpeg/include/tizen \
54 | ../../../../external/json \
55 | ../../../../external/lua \
56 | ../../../../external/lua/lua \
57 | ../../../../external/lua/luajit/include \
58 | ../../../../external/lua/luasocket \
59 | ../../../../external/lua/tolua \
60 | ../../../../external/png/include/tizen \
61 | ../../../../external/tiff/include/tizen \
62 | ../../../../external/tinyxml2 \
63 | ../../../../external/unzip \
64 | ../../../../external/webp/include/tizen \
65 | ../../../../external/websockets/include/tizen \
66 | ../../../../external/xxhash \
67 | ../../../../external/xxtea
68 |
69 | USER_CPP_INC_FILES =
70 |
71 | USER_INC_DIRS = $(USER_C_INC_DIRS) $(USER_CPP_INC_DIRS)
72 |
73 | # User Library Path
74 | USER_LIB_DIRS = ${PROJ_PATH}/../../../../build/tizen/${BUILD_CONFIG}/${BUILD_ARCH} \
75 | ${PROJ_PATH}/../../../../cocos/scripting/lua-bindings/proj.tizen/${BUILD_CONFIG}/${BUILD_ARCH} \
76 | ${PROJ_PATH}/../../../../external/chipmunk/prebuilt/tizen/${BUILD_ARCH} \
77 | ${PROJ_PATH}/../../../../external/jpeg/prebuilt/tizen/${BUILD_ARCH} \
78 | ${PROJ_PATH}/../../../../external/png/prebuilt/tizen/${BUILD_ARCH} \
79 | ${PROJ_PATH}/../../../../external/tiff/prebuilt/tizen/${BUILD_ARCH} \
80 | ${PROJ_PATH}/../../../../external/webp/prebuilt/tizen/${BUILD_ARCH} \
81 | ${PROJ_PATH}/../../../../external/websockets/prebuilt/tizen/${BUILD_ARCH}
82 |
83 | # EDC Resource Path
84 | USER_EDCS_IMAGE_DIRS = ${OUTPUT_DIR}
85 | USER_EDCS_SOUND_DIRS = ${OUTPUT_DIR}
86 | USER_EDCS_FONT_DIRS = ${OUTPUT_DIR}
87 |
88 | # EDC Flags
89 | USER_EXT_EDC_KEYS =
90 |
91 | # Resource Filter
92 | USER_RES_INCLUDE =
93 | USER_RES_EXCLUDE =
94 |
--------------------------------------------------------------------------------
/project/proj.tizen/res/.gitignore:
--------------------------------------------------------------------------------
1 | #Do now ignore Marmalade icf files
2 | !*.icf
3 |
--------------------------------------------------------------------------------
/project/proj.tizen/res/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.tizen/res/.gitkeep
--------------------------------------------------------------------------------
/project/proj.tizen/shared/res/lua-empty-test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/project/proj.tizen/shared/res/lua-empty-test.png
--------------------------------------------------------------------------------
/project/proj.tizen/src/main.cpp:
--------------------------------------------------------------------------------
1 | #include "../../Classes/AppDelegate.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | USING_NS_CC;
10 |
11 | int main(int argc, char **argv)
12 | {
13 | // create the application instance
14 | AppDelegate app;
15 | #ifdef TIZEN
16 | Application::getInstance()->setMainArgs(argc, argv);//For Tizen 2.4, we need these two arguments.
17 | #endif
18 | Application::getInstance()->setDeviceOrientation(APP_DEVICE_ORIENTATION_90);
19 | return Application::getInstance()->run();
20 | }
21 |
--------------------------------------------------------------------------------
/project/proj.tizen/tizen-manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | lua-empty-test.png
7 |
8 |
9 |
--------------------------------------------------------------------------------
/project/proj.win32/build-cfg.json:
--------------------------------------------------------------------------------
1 | {
2 | "copy_resources": [
3 | {
4 | "from": "../../src",
5 | "to": "src"
6 | },
7 | {
8 | "from": "../../res",
9 | "to": "res"
10 | },
11 | {
12 | "from": "../../../../cocos/scripting/lua-bindings/script",
13 | "to": "src/cocos"
14 | },
15 | {
16 | "from": "../../../../external/lua/luasocket",
17 | "to": "",
18 | "include": [
19 | "*.lua"
20 | ]
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/project/proj.win32/lua-empty-test.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {83371666-be62-4e91-b8cc-395730853621}
6 |
7 |
8 | {917fb40f-fc6d-4ee9-9a20-26debabe41aa}
9 |
10 |
11 |
12 |
13 | Classes
14 |
15 |
16 | win32
17 |
18 |
19 |
20 |
21 | Classes
22 |
23 |
24 | win32
25 |
26 |
27 | Classes
28 |
29 |
30 |
--------------------------------------------------------------------------------
/project/proj.win32/lua-empty-test.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(ProjectDir)..\..
5 | WindowsLocalDebugger
6 |
7 |
8 | $(ProjectDir)..\..
9 | WindowsLocalDebugger
10 |
11 |
--------------------------------------------------------------------------------
/project/proj.win32/main.cpp:
--------------------------------------------------------------------------------
1 | #include "main.h"
2 | #include "AppDelegate.h"
3 |
4 | USING_NS_CC;
5 |
6 | // uncomment below line, open debug console
7 | #define USE_WIN32_CONSOLE
8 |
9 | int APIENTRY _tWinMain(HINSTANCE hInstance,
10 | HINSTANCE hPrevInstance,
11 | LPTSTR lpCmdLine,
12 | int nCmdShow)
13 | {
14 | UNREFERENCED_PARAMETER(hPrevInstance);
15 | UNREFERENCED_PARAMETER(lpCmdLine);
16 |
17 | #ifdef USE_WIN32_CONSOLE
18 | AllocConsole();
19 | freopen("CONIN$", "r", stdin);
20 | freopen("CONOUT$", "w", stdout);
21 | freopen("CONOUT$", "w", stderr);
22 | #endif
23 |
24 | // create the application instance
25 | AppDelegate app;
26 | int ret = Application::getInstance()->run();
27 |
28 | #ifdef USE_WIN32_CONSOLE
29 | FreeConsole();
30 | #endif
31 |
32 | return ret;
33 | }
34 |
--------------------------------------------------------------------------------
/project/proj.win32/main.h:
--------------------------------------------------------------------------------
1 | #ifndef __MAIN_H__
2 | #define __MAIN_H__
3 |
4 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
5 |
6 | // Windows Header Files:
7 | #include
8 | #include
9 |
10 | // C RunTime Header Files
11 | #include "platform/CCStdC.h"
12 |
13 | #endif // __MAIN_H__
14 |
--------------------------------------------------------------------------------
/res/.gitignore:
--------------------------------------------------------------------------------
1 | #Do now ignore Marmalade icf files
2 | !*.icf
3 |
--------------------------------------------------------------------------------
/res/Fight_NormalIco_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/Fight_NormalIco_01.png
--------------------------------------------------------------------------------
/res/Fight_NormalIco_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/Fight_NormalIco_02.png
--------------------------------------------------------------------------------
/res/background.caf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/background.caf
--------------------------------------------------------------------------------
/res/background.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/background.mp3
--------------------------------------------------------------------------------
/res/background.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/background.ogg
--------------------------------------------------------------------------------
/res/crop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/crop.png
--------------------------------------------------------------------------------
/res/dog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/dog.png
--------------------------------------------------------------------------------
/res/effect1.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/effect1.wav
--------------------------------------------------------------------------------
/res/farm.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/farm.jpg
--------------------------------------------------------------------------------
/res/fonts/Marker Felt.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/fonts/Marker Felt.ttf
--------------------------------------------------------------------------------
/res/land.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/land.png
--------------------------------------------------------------------------------
/res/menu1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/menu1.png
--------------------------------------------------------------------------------
/res/menu2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/menu2.png
--------------------------------------------------------------------------------
/res/rocker/plate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/rocker/plate.png
--------------------------------------------------------------------------------
/res/rocker/stick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/res/rocker/stick.png
--------------------------------------------------------------------------------
/sqlite3.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/sqlite3.dll
--------------------------------------------------------------------------------
/src/ball.lua:
--------------------------------------------------------------------------------
1 | local util = require("util")
2 | local config = require("config")
3 | local M = {}
4 |
5 | local ball = {}
6 | ball.__index = ball
7 |
8 | function M.new(scene,userID,ballID,pos,color,r,velocitys)
9 | local o = {}
10 | o = setmetatable(o,ball)
11 | o.userID = userID
12 | o.id = ballID
13 | o.pos = {x = pos.x,y = pos.y}
14 | o.color = color
15 | o.r = r
16 | o.targetR = r
17 | o.scene = scene
18 | if velocitys and #velocitys > 0 then
19 | o.velocitys = {}
20 | for k,v in pairs(velocitys) do
21 | local v0 = util.vector2D.new(v.v.x , v.v.y)
22 | local v1 = util.vector2D.new(v.targetV.x , v.targetV.y)
23 | table.insert(o.velocitys,util.velocity.new(v0 , v1 , v.accRemain , v.duration))
24 | end
25 | end
26 | return o
27 | end
28 |
29 | function ball:UpdatePosition(averageV,elapse)
30 | self.pos.x = self.pos.x + averageV.x * elapse
31 | self.pos.y = self.pos.y + averageV.y * elapse
32 | local bottomLeft = {x = 0, y = 0}
33 | local topRight = {x = config.mapWidth, y = config.mapWidth}
34 | local R = self.r * math.sin(util.PI/4)
35 | self.pos.x = util.max(R + bottomLeft.x,self.pos.x)
36 | self.pos.x = util.min(topRight.x - R,self.pos.x)
37 | self.pos.y = util.max(R + bottomLeft.y,self.pos.y)
38 | self.pos.y = util.min(topRight.y - R,self.pos.y)
39 | end
40 |
41 | function ball:UpdateR()
42 | if self.targetR and self.r ~= self.targetR then
43 | if math.abs(self.r - self.targetR) < math.abs(self.rChange) then
44 | self.r = self.targetR
45 | else
46 | self.r = self.r + self.rChange
47 | end
48 | end
49 | end
50 |
51 | function ball:Update(elapse)
52 | self:UpdateR()
53 | if self.v then
54 | if self.v.duration <= 0 then
55 | if nil == self.predictV then
56 | return
57 | end
58 |
59 | if util.vector2D.new(self.predictV.x , self.predictV.y):mag() <= 0 then
60 | self.predictV = nil
61 | return
62 | end
63 |
64 | --运动量已经用完,使用预测速度移动
65 | self.v = util.velocity.new(util.vector2D.new(self.predictV.x , self.predictV.y))
66 |
67 | end
68 | local v = self.v:Update(elapse)
69 | self:UpdatePosition(v,elapse/1000)
70 | elseif self.velocitys then
71 | local v = util.vector2D.new(0,0)
72 | for kk,vv in pairs(self.velocitys) do
73 | v = v + vv:Update(elapse)
74 | if vv.duration <= 0 then
75 | self.velocitys[kk] = nil
76 | end
77 | end
78 | self:UpdatePosition(v,elapse/1000)
79 | end
80 | end
81 |
82 | function ball:OnBallUpdate(msg,ballInfo,timestamp)
83 | self.velocitys = nil
84 | self.targetR = ballInfo.r
85 |
86 | if math.abs(self.targetR - self.r) > 3 then
87 | --改变超过3个像素需要渐变
88 | self.rChange = (self.targetR - self.r)/10
89 | else
90 | self.r = self.targetR
91 | end
92 | local doSetPos --= true
93 | if not doSetPos then
94 | local delay = self.scene:GetServerTick() - timestamp
95 | local elapse = msg.elapse - delay
96 | if elapse <= 0 then
97 | --延迟太严重无法平滑处理,直接拖拽
98 | self.predictV = ballInfo.v
99 | if self.predictV then
100 | local v = util.vector2D.new(self.predictV.x , self.predictV.y)
101 | self.v = util.velocity.new(util.vector2D.new(self.predictV.x , self.predictV.y))
102 | end
103 | cclog("set pos tick:%d,delay:%d,ballInfo.elapse:%d,userID:%d,distance:%d",self.scene:GetServerTick(),delay,msg.elapse,self.userID,util.point2D.distance(self.pos,ballInfo.pos))
104 | self.pos.x = ballInfo.pos.x
105 | self.pos.y = ballInfo.pos.y
106 | return
107 | end
108 |
109 | self.predictV = ballInfo.v
110 | --计算速度
111 | local v = util.vector2D.new(ballInfo.pos.x - self.pos.x, ballInfo.pos.y - self.pos.y)/(elapse/1000)
112 | self.v = util.velocity.new(v,nil,nil,elapse)
113 | else
114 | self.pos = ballInfo.pos
115 | self.reqDir = ballInfo.reqDir
116 | end
117 | end
118 |
119 | return M
120 |
--------------------------------------------------------------------------------
/src/cocos/3d/3dConstants.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.Terrain then
2 | return
3 | end
4 |
5 | cc.Terrain.CrackFixedType =
6 | {
7 | SKIRT = 0,
8 | INCREASE_LOWER = 1,
9 | }
10 |
11 | cc.Animate3DQuality =
12 | {
13 | QUALITY_NONE = 0,
14 | QUALITY_LOW = 1,
15 | QUALITY_HIGH = 2,
16 | }
17 |
--------------------------------------------------------------------------------
/src/cocos/cocos2d/bitExtend.lua:
--------------------------------------------------------------------------------
1 | -- bit operation
2 |
3 | bit = bit or {}
4 | bit.data32 = {}
5 |
6 | for i=1,32 do
7 | bit.data32[i]=2^(32-i)
8 | end
9 |
10 | function bit._b2d(arg)
11 | local nr=0
12 | for i=1,32 do
13 | if arg[i] ==1 then
14 | nr=nr+bit.data32[i]
15 | end
16 | end
17 | return nr
18 | end
19 |
20 | function bit._d2b(arg)
21 | arg = arg >= 0 and arg or (0xFFFFFFFF + arg + 1)
22 | local tr={}
23 | for i=1,32 do
24 | if arg >= bit.data32[i] then
25 | tr[i]=1
26 | arg=arg-bit.data32[i]
27 | else
28 | tr[i]=0
29 | end
30 | end
31 | return tr
32 | end
33 |
34 | function bit._and(a,b)
35 | local op1=bit._d2b(a)
36 | local op2=bit._d2b(b)
37 | local r={}
38 |
39 | for i=1,32 do
40 | if op1[i]==1 and op2[i]==1 then
41 | r[i]=1
42 | else
43 | r[i]=0
44 | end
45 | end
46 | return bit._b2d(r)
47 |
48 | end
49 |
50 | function bit._rshift(a,n)
51 | local op1=bit._d2b(a)
52 | n = n <= 32 and n or 32
53 | n = n >= 0 and n or 0
54 |
55 | for i=32, n+1, -1 do
56 | op1[i] = op1[i-n]
57 | end
58 | for i=1, n do
59 | op1[i] = 0
60 | end
61 |
62 | return bit._b2d(op1)
63 | end
64 |
65 | function bit._not(a)
66 | local op1=bit._d2b(a)
67 | local r={}
68 |
69 | for i=1,32 do
70 | if op1[i]==1 then
71 | r[i]=0
72 | else
73 | r[i]=1
74 | end
75 | end
76 | return bit._b2d(r)
77 | end
78 |
79 | function bit._or(a,b)
80 | local op1=bit._d2b(a)
81 | local op2=bit._d2b(b)
82 | local r={}
83 |
84 | for i=1,32 do
85 | if op1[i]==1 or op2[i]==1 then
86 | r[i]=1
87 | else
88 | r[i]=0
89 | end
90 | end
91 | return bit._b2d(r)
92 | end
93 |
94 | bit.band = bit.band or bit._and
95 | bit.rshift = bit.rshift or bit._rshift
96 | bit.bnot = bit.bnot or bit._not
97 |
--------------------------------------------------------------------------------
/src/cocos/cocos2d/deprecated.lua:
--------------------------------------------------------------------------------
1 |
2 | function schedule(node, callback, delay)
3 | local delay = cc.DelayTime:create(delay)
4 | local sequence = cc.Sequence:create(delay, cc.CallFunc:create(callback))
5 | local action = cc.RepeatForever:create(sequence)
6 | node:runAction(action)
7 | return action
8 | end
9 |
10 | function performWithDelay(node, callback, delay)
11 | local delay = cc.DelayTime:create(delay)
12 | local sequence = cc.Sequence:create(delay, cc.CallFunc:create(callback))
13 | node:runAction(sequence)
14 | return sequence
15 | end
16 |
--------------------------------------------------------------------------------
/src/cocos/cocos2d/luaj.lua:
--------------------------------------------------------------------------------
1 |
2 | local luaj = {}
3 |
4 | local callJavaStaticMethod = LuaJavaBridge.callStaticMethod
5 |
6 | local function checkArguments(args, sig)
7 | if type(args) ~= "table" then args = {} end
8 | if sig then return args, sig end
9 |
10 | sig = {"("}
11 | for i, v in ipairs(args) do
12 | local t = type(v)
13 | if t == "number" then
14 | sig[#sig + 1] = "F"
15 | elseif t == "boolean" then
16 | sig[#sig + 1] = "Z"
17 | elseif t == "function" then
18 | sig[#sig + 1] = "I"
19 | else
20 | sig[#sig + 1] = "Ljava/lang/String;"
21 | end
22 | end
23 | sig[#sig + 1] = ")V"
24 |
25 | return args, table.concat(sig)
26 | end
27 |
28 | function luaj.callStaticMethod(className, methodName, args, sig)
29 | local args, sig = checkArguments(args, sig)
30 | --echoInfo("luaj.callStaticMethod(\"%s\",\n\t\"%s\",\n\targs,\n\t\"%s\"", className, methodName, sig)
31 | return callJavaStaticMethod(className, methodName, args, sig)
32 | end
33 |
34 | return luaj
35 |
--------------------------------------------------------------------------------
/src/cocos/cocos2d/luaoc.lua:
--------------------------------------------------------------------------------
1 |
2 | local luaoc = {}
3 |
4 | local callStaticMethod = LuaObjcBridge.callStaticMethod
5 |
6 | function luaoc.callStaticMethod(className, methodName, args)
7 | local ok, ret = callStaticMethod(className, methodName, args)
8 | if not ok then
9 | local msg = string.format("luaoc.callStaticMethod(\"%s\", \"%s\", \"%s\") - error: [%s] ",
10 | className, methodName, tostring(args), tostring(ret))
11 | if ret == -1 then
12 | print(msg .. "INVALID PARAMETERS")
13 | elseif ret == -2 then
14 | print(msg .. "CLASS NOT FOUND")
15 | elseif ret == -3 then
16 | print(msg .. "METHOD NOT FOUND")
17 | elseif ret == -4 then
18 | print(msg .. "EXCEPTION OCCURRED")
19 | elseif ret == -5 then
20 | print(msg .. "INVALID METHOD SIGNATURE")
21 | else
22 | print(msg .. "UNKNOWN")
23 | end
24 | end
25 | return ok, ret
26 | end
27 |
28 | return luaoc
29 |
--------------------------------------------------------------------------------
/src/cocos/cocosbuilder/CCBReaderLoad.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.CCBReader then
2 | return
3 | end
4 |
5 | ccb = ccb or {}
6 |
7 | function CCBReaderLoad(strFilePath,proxy,owner)
8 | if nil == proxy then
9 | return nil
10 | end
11 |
12 | local ccbReader = proxy:createCCBReader()
13 | local node = ccbReader:load(strFilePath)
14 | local rootName = ""
15 | --owner set in readCCBFromFile is proxy
16 | if nil ~= owner then
17 | --Callbacks
18 | local ownerCallbackNames = ccbReader:getOwnerCallbackNames()
19 | local ownerCallbackNodes = ccbReader:getOwnerCallbackNodes()
20 | local ownerCallbackControlEvents = ccbReader:getOwnerCallbackControlEvents()
21 | local i = 1
22 | for i = 1,table.getn(ownerCallbackNames) do
23 | local callbackName = ownerCallbackNames[i]
24 | local callbackNode = tolua.cast(ownerCallbackNodes[i],"cc.Node")
25 |
26 | if "function" == type(owner[callbackName]) then
27 | proxy:setCallback(callbackNode, owner[callbackName], ownerCallbackControlEvents[i])
28 | else
29 | print("Warning: Cannot find owner's lua function:" .. ":" .. callbackName .. " for ownerVar selector")
30 | end
31 |
32 | end
33 |
34 | --Variables
35 | local ownerOutletNames = ccbReader:getOwnerOutletNames()
36 | local ownerOutletNodes = ccbReader:getOwnerOutletNodes()
37 |
38 | for i = 1, table.getn(ownerOutletNames) do
39 | local outletName = ownerOutletNames[i]
40 | local outletNode = tolua.cast(ownerOutletNodes[i],"cc.Node")
41 | owner[outletName] = outletNode
42 | end
43 | end
44 |
45 | local nodesWithAnimationManagers = ccbReader:getNodesWithAnimationManagers()
46 | local animationManagersForNodes = ccbReader:getAnimationManagersForNodes()
47 |
48 | for i = 1 , table.getn(nodesWithAnimationManagers) do
49 | local innerNode = tolua.cast(nodesWithAnimationManagers[i], "cc.Node")
50 | local animationManager = tolua.cast(animationManagersForNodes[i], "cc.CCBAnimationManager")
51 | local documentControllerName = animationManager:getDocumentControllerName()
52 | if "" == documentControllerName then
53 |
54 | end
55 | if nil ~= ccb[documentControllerName] then
56 | ccb[documentControllerName]["mAnimationManager"] = animationManager
57 | end
58 |
59 | --Callbacks
60 | local documentCallbackNames = animationManager:getDocumentCallbackNames()
61 | local documentCallbackNodes = animationManager:getDocumentCallbackNodes()
62 | local documentCallbackControlEvents = animationManager:getDocumentCallbackControlEvents()
63 |
64 | for i = 1,table.getn(documentCallbackNames) do
65 | local callbackName = documentCallbackNames[i]
66 | local callbackNode = tolua.cast(documentCallbackNodes[i],"cc.Node")
67 | if "" ~= documentControllerName and nil ~= ccb[documentControllerName] then
68 | if "function" == type(ccb[documentControllerName][callbackName]) then
69 | proxy:setCallback(callbackNode, ccb[documentControllerName][callbackName], documentCallbackControlEvents[i])
70 | else
71 | print("Warning: Cannot found lua function [" .. documentControllerName .. ":" .. callbackName .. "] for docRoot selector")
72 | end
73 | end
74 | end
75 |
76 | --Variables
77 | local documentOutletNames = animationManager:getDocumentOutletNames()
78 | local documentOutletNodes = animationManager:getDocumentOutletNodes()
79 |
80 | for i = 1, table.getn(documentOutletNames) do
81 | local outletName = documentOutletNames[i]
82 | local outletNode = tolua.cast(documentOutletNodes[i],"cc.Node")
83 |
84 | if nil ~= ccb[documentControllerName] then
85 | ccb[documentControllerName][outletName] = tolua.cast(outletNode, proxy:getNodeTypeName(outletNode))
86 | end
87 | end
88 | --[[
89 | if (typeof(controller.onDidLoadFromCCB) == "function")
90 | controller.onDidLoadFromCCB();
91 | ]]--
92 | --Setup timeline callbacks
93 | local keyframeCallbacks = animationManager:getKeyframeCallbacks()
94 |
95 | for i = 1 , table.getn(keyframeCallbacks) do
96 | local callbackCombine = keyframeCallbacks[i]
97 | local beignIndex,endIndex = string.find(callbackCombine,":")
98 | local callbackType = tonumber(string.sub(callbackCombine,1,beignIndex - 1))
99 | local callbackName = string.sub(callbackCombine,endIndex + 1, -1)
100 | --Document callback
101 |
102 | if 1 == callbackType and nil ~= ccb[documentControllerName] then
103 | local callfunc = cc.CallFunc:create(ccb[documentControllerName][callbackName])
104 | animationManager:setCallFuncForLuaCallbackNamed(callfunc, callbackCombine);
105 | elseif 2 == callbackType and nil ~= owner then --Owner callback
106 | local callfunc = cc.CallFunc:create(owner[callbackName])--need check
107 | animationManager:setCallFuncForLuaCallbackNamed(callfunc, callbackCombine)
108 | end
109 | end
110 | --start animation
111 | local autoPlaySeqId = animationManager:getAutoPlaySequenceId()
112 | if -1 ~= autoPlaySeqId then
113 | animationManager:runAnimationsForSequenceIdTweenDuration(autoPlaySeqId, 0)
114 | end
115 | end
116 |
117 | return node
118 | end
119 |
120 |
121 | local function CCBuilderReaderLoad(strFilePath,proxy,owner)
122 | print("\n********** \n".."CCBuilderReaderLoad(strFilePath,proxy,owner)".." was deprecated please use ".. "CCBReaderLoad(strFilePath,proxy,owner)" .. " instead.\n**********")
123 | return CCBReaderLoad(strFilePath,proxy,owner)
124 | end
125 | rawset(_G,"CCBuilderReaderLoad",CCBuilderReaderLoad)
--------------------------------------------------------------------------------
/src/cocos/cocosbuilder/DeprecatedCocosBuilderClass.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.CCBProxy then
2 | return
3 | end
4 | -- This is the DeprecatedCocosBuilderClass
5 |
6 | DeprecatedCocosBuilderClass = {} or DeprecatedCocosBuilderClass
7 |
8 | --tip
9 | local function deprecatedTip(old_name,new_name)
10 | print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")
11 | end
12 |
13 | --CCBReader class will be Deprecated,begin
14 | function DeprecatedCocosBuilderClass.CCBReader()
15 | deprecatedTip("CCBReader","cc.BReader")
16 | return cc.BReader
17 | end
18 | _G["CCBReader"] = DeprecatedCocosBuilderClass.CCBReader()
19 | --CCBReader class will be Deprecated,end
20 |
21 | --CCBAnimationManager class will be Deprecated,begin
22 | function DeprecatedCocosBuilderClass.CCBAnimationManager()
23 | deprecatedTip("CCBAnimationManager","cc.BAnimationManager")
24 | return cc.BAnimationManager
25 | end
26 | _G["CCBAnimationManager"] = DeprecatedCocosBuilderClass.CCBAnimationManager()
27 | --CCBAnimationManager class will be Deprecated,end
28 |
29 | --CCBProxy class will be Deprecated,begin
30 | function DeprecatedCocosBuilderClass.CCBProxy()
31 | deprecatedTip("CCBProxy","cc.CCBProxy")
32 | return cc.CCBProxy
33 | end
34 | _G["CCBProxy"] = DeprecatedCocosBuilderClass.CCBProxy()
35 | --CCBProxy class will be Deprecated,end
36 |
--------------------------------------------------------------------------------
/src/cocos/cocosdenshion/AudioEngine.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.SimpleAudioEngine then
2 | return
3 | end
4 | --Encapsulate SimpleAudioEngine to AudioEngine,Play music and sound effects.
5 | local M = {}
6 |
7 | function M.stopAllEffects()
8 | cc.SimpleAudioEngine:getInstance():stopAllEffects()
9 | end
10 |
11 | function M.getMusicVolume()
12 | return cc.SimpleAudioEngine:getInstance():getMusicVolume()
13 | end
14 |
15 | function M.isMusicPlaying()
16 | return cc.SimpleAudioEngine:getInstance():isMusicPlaying()
17 | end
18 |
19 | function M.getEffectsVolume()
20 | return cc.SimpleAudioEngine:getInstance():getEffectsVolume()
21 | end
22 |
23 | function M.setMusicVolume(volume)
24 | cc.SimpleAudioEngine:getInstance():setMusicVolume(volume)
25 | end
26 |
27 | function M.stopEffect(handle)
28 | cc.SimpleAudioEngine:getInstance():stopEffect(handle)
29 | end
30 |
31 | function M.stopMusic(isReleaseData)
32 | local releaseDataValue = false
33 | if nil ~= isReleaseData then
34 | releaseDataValue = isReleaseData
35 | end
36 | cc.SimpleAudioEngine:getInstance():stopMusic(releaseDataValue)
37 | end
38 |
39 | function M.playMusic(filename, isLoop)
40 | local loopValue = false
41 | if nil ~= isLoop then
42 | loopValue = isLoop
43 | end
44 | cc.SimpleAudioEngine:getInstance():playMusic(filename, loopValue)
45 | end
46 |
47 | function M.pauseAllEffects()
48 | cc.SimpleAudioEngine:getInstance():pauseAllEffects()
49 | end
50 |
51 | function M.preloadMusic(filename)
52 | cc.SimpleAudioEngine:getInstance():preloadMusic(filename)
53 | end
54 |
55 | function M.resumeMusic()
56 | cc.SimpleAudioEngine:getInstance():resumeMusic()
57 | end
58 |
59 | function M.playEffect(filename, isLoop)
60 | local loopValue = false
61 | if nil ~= isLoop then
62 | loopValue = isLoop
63 | end
64 | return cc.SimpleAudioEngine:getInstance():playEffect(filename, loopValue)
65 | end
66 |
67 | function M.rewindMusic()
68 | cc.SimpleAudioEngine:getInstance():rewindMusic()
69 | end
70 |
71 | function M.willPlayMusic()
72 | return cc.SimpleAudioEngine:getInstance():willPlayMusic()
73 | end
74 |
75 | function M.unloadEffect(filename)
76 | cc.SimpleAudioEngine:getInstance():unloadEffect(filename)
77 | end
78 |
79 | function M.preloadEffect(filename)
80 | cc.SimpleAudioEngine:getInstance():preloadEffect(filename)
81 | end
82 |
83 | function M.setEffectsVolume(volume)
84 | cc.SimpleAudioEngine:getInstance():setEffectsVolume(volume)
85 | end
86 |
87 | function M.pauseEffect(handle)
88 | cc.SimpleAudioEngine:getInstance():pauseEffect(handle)
89 | end
90 |
91 | function M.resumeAllEffects(handle)
92 | cc.SimpleAudioEngine:getInstance():resumeAllEffects()
93 | end
94 |
95 | function M.pauseMusic()
96 | cc.SimpleAudioEngine:getInstance():pauseMusic()
97 | end
98 |
99 | function M.resumeEffect(handle)
100 | cc.SimpleAudioEngine:getInstance():resumeEffect(handle)
101 | end
102 |
103 | function M.getInstance()
104 | return cc.SimpleAudioEngine:getInstance()
105 | end
106 |
107 | function M.destroyInstance()
108 | return cc.SimpleAudioEngine:destroyInstance()
109 | end
110 |
111 | AudioEngine = M
112 |
--------------------------------------------------------------------------------
/src/cocos/cocosdenshion/DeprecatedCocosDenshionClass.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.SimpleAudioEngine then
2 | return
3 | end
4 | -- This is the DeprecatedCocosDenshionClass
5 |
6 | DeprecatedCocosDenshionClass = {} or DeprecatedCocosDenshionClass
7 |
8 | --tip
9 | local function deprecatedTip(old_name,new_name)
10 | print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")
11 | end
12 |
13 | --SimpleAudioEngine class will be Deprecated,begin
14 | function DeprecatedCocosDenshionClass.SimpleAudioEngine()
15 | deprecatedTip("SimpleAudioEngine","cc.SimpleAudioEngine")
16 | return cc.SimpleAudioEngine
17 | end
18 | _G["SimpleAudioEngine"] = DeprecatedCocosDenshionClass.SimpleAudioEngine()
19 | --SimpleAudioEngine class will be Deprecated,end
20 |
--------------------------------------------------------------------------------
/src/cocos/cocosdenshion/DeprecatedCocosDenshionFunc.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.SimpleAudioEngine then
2 | return
3 | end
4 | --tip
5 | local function deprecatedTip(old_name,new_name)
6 | print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")
7 | end
8 |
9 | --functions of SimpleAudioEngine will be deprecated begin
10 | local SimpleAudioEngineDeprecated = { }
11 | function SimpleAudioEngineDeprecated.sharedEngine()
12 | deprecatedTip("SimpleAudioEngine:sharedEngine","SimpleAudioEngine:getInstance")
13 | return cc.SimpleAudioEngine:getInstance()
14 | end
15 | SimpleAudioEngine.sharedEngine = SimpleAudioEngineDeprecated.sharedEngine
16 |
17 | function SimpleAudioEngineDeprecated.playBackgroundMusic(self,...)
18 | deprecatedTip("SimpleAudioEngine:playBackgroundMusic","SimpleAudioEngine:playMusic")
19 | return self:playMusic(...)
20 | end
21 | SimpleAudioEngine.playBackgroundMusic = SimpleAudioEngineDeprecated.playBackgroundMusic
22 | --functions of SimpleAudioEngine will be deprecated end
23 |
--------------------------------------------------------------------------------
/src/cocos/cocostudio/DeprecatedCocoStudioFunc.lua:
--------------------------------------------------------------------------------
1 | if nil == ccs then
2 | return
3 | end
4 |
5 | --tip
6 | local function deprecatedTip(old_name,new_name)
7 | print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")
8 | end
9 |
10 | --functions of GUIReader will be deprecated begin
11 | local GUIReaderDeprecated = { }
12 | function GUIReaderDeprecated.shareReader()
13 | deprecatedTip("GUIReader:shareReader","ccs.GUIReader:getInstance")
14 | return ccs.GUIReader:getInstance()
15 | end
16 | GUIReader.shareReader = GUIReaderDeprecated.shareReader
17 |
18 | function GUIReaderDeprecated.purgeGUIReader()
19 | deprecatedTip("GUIReader:purgeGUIReader","ccs.GUIReader:destroyInstance")
20 | return ccs.GUIReader:destroyInstance()
21 | end
22 | GUIReader.purgeGUIReader = GUIReaderDeprecated.purgeGUIReader
23 | --functions of GUIReader will be deprecated end
24 |
25 | --functions of SceneReader will be deprecated begin
26 | local SceneReaderDeprecated = { }
27 | function SceneReaderDeprecated.sharedSceneReader()
28 | deprecatedTip("SceneReader:sharedSceneReader","ccs.SceneReader:getInstance")
29 | return ccs.SceneReader:getInstance()
30 | end
31 | SceneReader.sharedSceneReader = SceneReaderDeprecated.sharedSceneReader
32 |
33 | function SceneReaderDeprecated.purgeSceneReader(self)
34 | deprecatedTip("SceneReader:purgeSceneReader","ccs.SceneReader:destroyInstance")
35 | return self:destroyInstance()
36 | end
37 | SceneReader.purgeSceneReader = SceneReaderDeprecated.purgeSceneReader
38 | --functions of SceneReader will be deprecated end
39 |
40 |
41 | --functions of ccs.GUIReader will be deprecated begin
42 | local CCSGUIReaderDeprecated = { }
43 | function CCSGUIReaderDeprecated.purgeGUIReader()
44 | deprecatedTip("ccs.GUIReader:purgeGUIReader","ccs.GUIReader:destroyInstance")
45 | return ccs.GUIReader:destroyInstance()
46 | end
47 | ccs.GUIReader.purgeGUIReader = CCSGUIReaderDeprecated.purgeGUIReader
48 | --functions of ccs.GUIReader will be deprecated end
49 |
50 | --functions of ccs.ActionManagerEx will be deprecated begin
51 | local CCSActionManagerExDeprecated = { }
52 | function CCSActionManagerExDeprecated.destroyActionManager()
53 | deprecatedTip("ccs.ActionManagerEx:destroyActionManager","ccs.ActionManagerEx:destroyInstance")
54 | return ccs.ActionManagerEx:destroyInstance()
55 | end
56 | ccs.ActionManagerEx.destroyActionManager = CCSActionManagerExDeprecated.destroyActionManager
57 | --functions of ccs.ActionManagerEx will be deprecated end
58 |
59 | --functions of ccs.SceneReader will be deprecated begin
60 | local CCSSceneReaderDeprecated = { }
61 | function CCSSceneReaderDeprecated.destroySceneReader(self)
62 | deprecatedTip("ccs.SceneReader:destroySceneReader","ccs.SceneReader:destroyInstance")
63 | return self:destroyInstance()
64 | end
65 | ccs.SceneReader.destroySceneReader = CCSSceneReaderDeprecated.destroySceneReader
66 | --functions of ccs.SceneReader will be deprecated end
67 |
68 | --functions of CCArmatureDataManager will be deprecated begin
69 | local CCArmatureDataManagerDeprecated = { }
70 | function CCArmatureDataManagerDeprecated.sharedArmatureDataManager()
71 | deprecatedTip("CCArmatureDataManager:sharedArmatureDataManager","ccs.ArmatureDataManager:getInstance")
72 | return ccs.ArmatureDataManager:getInstance()
73 | end
74 | CCArmatureDataManager.sharedArmatureDataManager = CCArmatureDataManagerDeprecated.sharedArmatureDataManager
75 |
76 | function CCArmatureDataManagerDeprecated.purge()
77 | deprecatedTip("CCArmatureDataManager:purge","ccs.ArmatureDataManager:destoryInstance")
78 | return ccs.ArmatureDataManager:destoryInstance()
79 | end
80 | CCArmatureDataManager.purge = CCArmatureDataManagerDeprecated.purge
81 | --functions of CCArmatureDataManager will be deprecated end
82 |
--------------------------------------------------------------------------------
/src/cocos/cocostudio/StudioConstants.lua:
--------------------------------------------------------------------------------
1 | if nil == ccs then
2 | return
3 | end
4 |
5 | ccs.MovementEventType = {
6 | start = 0,
7 | complete = 1,
8 | loopComplete = 2,
9 | }
10 |
11 | ccs.InnerActionType = {
12 | LoopAction = 0,
13 | NoLoopAction = 1,
14 | SingleFrame = 2,
15 | }
16 |
--------------------------------------------------------------------------------
/src/cocos/controller/ControllerConstants.lua:
--------------------------------------------------------------------------------
1 |
2 | cc = cc or {}
3 |
4 | cc.ControllerKey =
5 | {
6 | JOYSTICK_LEFT_X = 1000,
7 | JOYSTICK_LEFT_Y = 1001,
8 | JOYSTICK_RIGHT_X = 1002,
9 | JOYSTICK_RIGHT_Y = 1003,
10 |
11 | BUTTON_A = 1004,
12 | BUTTON_B = 1005,
13 | BUTTON_C = 1006,
14 | BUTTON_X = 1007,
15 | BUTTON_Y = 1008,
16 | BUTTON_Z = 1009,
17 |
18 | BUTTON_DPAD_UP = 1010,
19 | BUTTON_DPAD_DOWN = 1011,
20 | BUTTON_DPAD_LEFT = 1012,
21 | BUTTON_DPAD_RIGHT = 1013,
22 | BUTTON_DPAD_CENTER = 1014,
23 |
24 | BUTTON_LEFT_SHOULDER = 1015,
25 | BUTTON_RIGHT_SHOULDER = 1016,
26 |
27 | AXIS_LEFT_TRIGGER = 1017,
28 | AXIS_RIGHT_TRIGGER = 1018,
29 |
30 | BUTTON_LEFT_THUMBSTICK = 1019,
31 | BUTTON_RIGHT_THUMBSTICK = 1020,
32 |
33 | BUTTON_START = 1021,
34 | BUTTON_SELECT = 1022,
35 |
36 | BUTTON_PAUSE = 1023,
37 | KEY_MAX = 1024,
38 | }
39 |
--------------------------------------------------------------------------------
/src/cocos/extension/DeprecatedExtensionClass.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.Control then
2 | return
3 | end
4 |
5 | -- This is the DeprecatedExtensionClass
6 | DeprecatedExtensionClass = {} or DeprecatedExtensionClass
7 |
8 | --tip
9 | local function deprecatedTip(old_name,new_name)
10 | print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")
11 | end
12 |
13 | --CCControl class will be Deprecated,begin
14 | function DeprecatedExtensionClass.CCControl()
15 | deprecatedTip("CCControl","cc.Control")
16 | return cc.Control
17 | end
18 | _G["CCControl"] = DeprecatedExtensionClass.CCControl()
19 | --CCControl class will be Deprecated,end
20 |
21 | --CCScrollView class will be Deprecated,begin
22 | function DeprecatedExtensionClass.CCScrollView()
23 | deprecatedTip("CCScrollView","cc.ScrollView")
24 | return cc.ScrollView
25 | end
26 | _G["CCScrollView"] = DeprecatedExtensionClass.CCScrollView()
27 | --CCScrollView class will be Deprecated,end
28 |
29 | --CCTableView class will be Deprecated,begin
30 | function DeprecatedExtensionClass.CCTableView()
31 | deprecatedTip("CCTableView","cc.TableView")
32 | return cc.TableView
33 | end
34 | _G["CCTableView"] = DeprecatedExtensionClass.CCTableView()
35 | --CCTableView class will be Deprecated,end
36 |
37 | --CCControlPotentiometer class will be Deprecated,begin
38 | function DeprecatedExtensionClass.CCControlPotentiometer()
39 | deprecatedTip("CCControlPotentiometer","cc.ControlPotentiometer")
40 | return cc.ControlPotentiometer
41 | end
42 | _G["CCControlPotentiometer"] = DeprecatedExtensionClass.CCControlPotentiometer()
43 | --CCControlPotentiometer class will be Deprecated,end
44 |
45 | --CCControlStepper class will be Deprecated,begin
46 | function DeprecatedExtensionClass.CCControlStepper()
47 | deprecatedTip("CCControlStepper","cc.ControlStepper")
48 | return cc.ControlStepper
49 | end
50 | _G["CCControlStepper"] = DeprecatedExtensionClass.CCControlStepper()
51 | --CCControlStepper class will be Deprecated,end
52 |
53 | --CCControlHuePicker class will be Deprecated,begin
54 | function DeprecatedExtensionClass.CCControlHuePicker()
55 | deprecatedTip("CCControlHuePicker","cc.ControlHuePicker")
56 | return cc.ControlHuePicker
57 | end
58 | _G["CCControlHuePicker"] = DeprecatedExtensionClass.CCControlHuePicker()
59 | --CCControlHuePicker class will be Deprecated,end
60 |
61 | --CCControlSlider class will be Deprecated,begin
62 | function DeprecatedExtensionClass.CCControlSlider()
63 | deprecatedTip("CCControlSlider","cc.ControlSlider")
64 | return cc.ControlSlider
65 | end
66 | _G["CCControlSlider"] = DeprecatedExtensionClass.CCControlSlider()
67 | --CCControlSlider class will be Deprecated,end
68 |
69 | --CCControlSaturationBrightnessPicker class will be Deprecated,begin
70 | function DeprecatedExtensionClass.CCControlSaturationBrightnessPicker()
71 | deprecatedTip("CCControlSaturationBrightnessPicker","cc.ControlSaturationBrightnessPicker")
72 | return cc.ControlSaturationBrightnessPicker
73 | end
74 | _G["CCControlSaturationBrightnessPicker"] = DeprecatedExtensionClass.CCControlSaturationBrightnessPicker()
75 | --CCControlSaturationBrightnessPicker class will be Deprecated,end
76 |
77 | --CCControlSwitch class will be Deprecated,begin
78 | function DeprecatedExtensionClass.CCControlSwitch()
79 | deprecatedTip("CCControlSwitch","cc.ControlSwitch")
80 | return cc.ControlSwitch
81 | end
82 | _G["CCControlSwitch"] = DeprecatedExtensionClass.CCControlSwitch()
83 | --CCControlSwitch class will be Deprecated,end
84 |
85 | --CCControlButton class will be Deprecated,begin
86 | function DeprecatedExtensionClass.CCControlButton()
87 | deprecatedTip("CCControlButton","cc.ControlButton")
88 | return cc.ControlButton
89 | end
90 | _G["CCControlButton"] = DeprecatedExtensionClass.CCControlButton()
91 | --CCControlButton class will be Deprecated,end
92 |
93 | --CCControlColourPicker class will be Deprecated,begin
94 | function DeprecatedExtensionClass.CCControlColourPicker()
95 | deprecatedTip("CCControlColourPicker","cc.ControlColourPicker")
96 | return cc.ControlColourPicker
97 | end
98 | _G["CCControlColourPicker"] = DeprecatedExtensionClass.CCControlColourPicker()
99 | --CCControlColourPicker class will be Deprecated,end
100 |
101 |
102 | if nil == ccui then
103 | return
104 | end
105 |
106 | --CCEditBox class will be Deprecated,begin
107 | function DeprecatedExtensionClass.CCEditBox()
108 | deprecatedTip("CCEditBox","ccui.EditBox")
109 | return ccui.EditBox
110 | end
111 | _G["CCEditBox"] = DeprecatedExtensionClass.CCEditBox()
112 |
113 | function DeprecatedExtensionClass.CCUIEditBox()
114 | deprecatedTip("cc.EditBox","ccui.EditBox")
115 | return ccui.EditBox
116 | end
117 | _G["cc"]["EditBox"] = DeprecatedExtensionClass.CCUIEditBox()
118 |
119 | --CCEditBox class will be Deprecated,end
120 |
121 | --CCScale9Sprite class will be Deprecated,begin
122 | function DeprecatedExtensionClass.CCScale9Sprite()
123 | deprecatedTip("CCScale9Sprite","ccui.Scale9Sprite")
124 | return ccui.Scale9Sprite
125 | end
126 | _G["CCScale9Sprite"] = DeprecatedExtensionClass.CCScale9Sprite()
127 |
128 | function DeprecatedExtensionClass.UIScale9Sprite()
129 | deprecatedTip("cc.Scale9Sprite","ccui.Scale9Sprite")
130 | return ccui.Scale9Sprite
131 | end
132 | _G["cc"]["Scale9Sprite"] = DeprecatedExtensionClass.UIScale9Sprite()
133 | --CCScale9Sprite class will be Deprecated,end
134 |
135 |
--------------------------------------------------------------------------------
/src/cocos/extension/DeprecatedExtensionEnum.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.Control then
2 | return
3 | end
4 |
5 | _G.kCCControlStepperPartMinus = cc.CONTROL_STEPPER_PART_MINUS
6 | _G.kCCControlStepperPartPlus = cc.CONTROL_STEPPER_PART_PLUS
7 | _G.kCCControlStepperPartNone = cc.CONTROL_STEPPER_PART_NONE
8 |
9 | _G.CCControlEventTouchDown = cc.CONTROL_EVENTTYPE_TOUCH_DOWN
10 | _G.CCControlEventTouchDragInside = cc.CONTROL_EVENTTYPE_DRAG_INSIDE
11 | _G.CCControlEventTouchDragOutside = cc.CONTROL_EVENTTYPE_DRAG_OUTSIDE
12 | _G.CCControlEventTouchDragEnter = cc.CONTROL_EVENTTYPE_DRAG_ENTER
13 | _G.CCControlEventTouchDragExit = cc.CONTROL_EVENTTYPE_DRAG_EXIT
14 | _G.CCControlEventTouchUpInside = cc.CONTROL_EVENTTYPE_TOUCH_UP_INSIDE
15 | _G.CCControlEventTouchUpOutside = cc.CONTROL_EVENTTYPE_TOUCH_UP_OUTSIDE
16 | _G.CCControlEventTouchCancel = cc.CONTROL_EVENTTYPE_TOUCH_CANCEL
17 | _G.CCControlEventValueChanged = cc.CONTROL_EVENTTYPE_VALUE_CHANGED
18 | _G.CCControlStateNormal = cc.CONTROL_STATE_NORMAL
19 | _G.CCControlStateHighlighted = cc.CONTROL_STATE_HIGH_LIGHTED
20 | _G.CCControlStateDisabled = cc.CONTROL_STATE_DISABLED
21 | _G.CCControlStateSelected = cc.CONTROL_STATE_SELECTED
22 |
23 | _G.kCCScrollViewDirectionHorizontal = cc.SCROLLVIEW_DIRECTION_HORIZONTAL
24 | _G.kCCScrollViewDirectionVertical = cc.SCROLLVIEW_DIRECTION_VERTICAL
25 | _G.kCCTableViewFillTopDown = cc.TABLEVIEW_FILL_TOPDOWN
26 | _G.kCCTableViewFillBottomUp = cc.TABLEVIEW_FILL_BOTTOMUP
27 |
--------------------------------------------------------------------------------
/src/cocos/extension/DeprecatedExtensionFunc.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.Control then
2 | return
3 | end
4 |
5 | --tip
6 | local function deprecatedTip(old_name,new_name)
7 | print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")
8 | end
9 |
10 | --functions of CCControl will be deprecated end
11 | local CCControlDeprecated = { }
12 | function CCControlDeprecated.addHandleOfControlEvent(self,func,controlEvent)
13 | deprecatedTip("addHandleOfControlEvent","registerControlEventHandler")
14 | print("come in addHandleOfControlEvent")
15 | self:registerControlEventHandler(func,controlEvent)
16 | end
17 | CCControl.addHandleOfControlEvent = CCControlDeprecated.addHandleOfControlEvent
18 | --functions of CCControl will be deprecated end
19 |
20 | --Enums of CCTableView will be deprecated begin
21 | CCTableView.kTableViewScroll = cc.SCROLLVIEW_SCRIPT_SCROLL
22 | CCTableView.kTableViewZoom = cc.SCROLLVIEW_SCRIPT_ZOOM
23 | CCTableView.kTableCellTouched = cc.TABLECELL_TOUCHED
24 | CCTableView.kTableCellSizeForIndex = cc.TABLECELL_SIZE_FOR_INDEX
25 | CCTableView.kTableCellSizeAtIndex = cc.TABLECELL_SIZE_AT_INDEX
26 | CCTableView.kNumberOfCellsInTableView = cc.NUMBER_OF_CELLS_IN_TABLEVIEW
27 | --Enums of CCTableView will be deprecated end
28 |
29 | --Enums of CCScrollView will be deprecated begin
30 | CCScrollView.kScrollViewScroll = cc.SCROLLVIEW_SCRIPT_SCROLL
31 | CCScrollView.kScrollViewZoom = cc.SCROLLVIEW_SCRIPT_ZOOM
32 | --Enums of CCScrollView will be deprecated end
33 |
--------------------------------------------------------------------------------
/src/cocos/extension/ExtensionConstants.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.Control then
2 | return
3 | end
4 |
5 | cc.CONTROL_STATE_NORMAL = 1
6 | cc.CONTROL_STATE_HIGH_LIGHTED = 2
7 | cc.CONTROL_STATE_DISABLED = 4
8 | cc.CONTROL_STATE_SELECTED = 8
9 |
10 | cc.CONTROL_STEPPER_PART_MINUS = 0
11 | cc.CONTROL_STEPPER_PART_PLUS = 1
12 | cc.CONTROL_STEPPER_PART_NONE = 2
13 |
14 | cc.TABLEVIEW_FILL_TOPDOWN = 0
15 | cc.TABLEVIEW_FILL_BOTTOMUP = 1
16 |
17 | cc.SCROLLVIEW_SCRIPT_SCROLL = 0
18 | cc.SCROLLVIEW_SCRIPT_ZOOM = 1
19 | cc.TABLECELL_TOUCHED = 2
20 | cc.TABLECELL_HIGH_LIGHT = 3
21 | cc.TABLECELL_UNHIGH_LIGHT = 4
22 | cc.TABLECELL_WILL_RECYCLE = 5
23 | cc.TABLECELL_SIZE_FOR_INDEX = 6
24 | cc.TABLECELL_SIZE_AT_INDEX = 7
25 | cc.NUMBER_OF_CELLS_IN_TABLEVIEW = 8
26 |
27 | cc.SCROLLVIEW_DIRECTION_NONE = -1
28 | cc.SCROLLVIEW_DIRECTION_HORIZONTAL = 0
29 | cc.SCROLLVIEW_DIRECTION_VERTICAL = 1
30 | cc.SCROLLVIEW_DIRECTION_BOTH = 2
31 |
32 | cc.CONTROL_EVENTTYPE_TOUCH_DOWN = 1
33 | cc.CONTROL_EVENTTYPE_DRAG_INSIDE = 2
34 | cc.CONTROL_EVENTTYPE_DRAG_OUTSIDE = 4
35 | cc.CONTROL_EVENTTYPE_DRAG_ENTER = 8
36 | cc.CONTROL_EVENTTYPE_DRAG_EXIT = 16
37 | cc.CONTROL_EVENTTYPE_TOUCH_UP_INSIDE = 32
38 | cc.CONTROL_EVENTTYPE_TOUCH_UP_OUTSIDE = 64
39 | cc.CONTROL_EVENTTYPE_TOUCH_CANCEL = 128
40 | cc.CONTROL_EVENTTYPE_VALUE_CHANGED = 256
41 |
42 | cc.EDITBOX_INPUT_MODE_ANY = 0
43 | cc.EDITBOX_INPUT_MODE_EMAILADDR = 1
44 | cc.EDITBOX_INPUT_MODE_NUMERIC = 2
45 | cc.EDITBOX_INPUT_MODE_PHONENUMBER = 3
46 | cc.EDITBOX_INPUT_MODE_URL = 4
47 | cc.EDITBOX_INPUT_MODE_DECIMAL = 5
48 | cc.EDITBOX_INPUT_MODE_SINGLELINE = 6
49 |
50 | cc.EDITBOX_INPUT_FLAG_PASSWORD = 0
51 | cc.EDITBOX_INPUT_FLAG_SENSITIVE = 1
52 | cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD = 2
53 | cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_SENTENCE = 3
54 | cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS = 4
55 |
56 | cc.KEYBOARD_RETURNTYPE_DEFAULT = 0
57 | cc.KEYBOARD_RETURNTYPE_DONE = 1
58 | cc.KEYBOARD_RETURNTYPE_SEND = 2
59 | cc.KEYBOARD_RETURNTYPE_SEARCH = 3
60 | cc.KEYBOARD_RETURNTYPE_GO = 4
61 |
62 | cc.ASSETSMANAGER_CREATE_FILE = 0
63 | cc.ASSETSMANAGER_NETWORK = 1
64 | cc.ASSETSMANAGER_NO_NEW_VERSION = 2
65 | cc.ASSETSMANAGER_UNCOMPRESS = 3
66 |
67 | cc.ASSETSMANAGER_PROTOCOL_PROGRESS = 0
68 | cc.ASSETSMANAGER_PROTOCOL_SUCCESS = 1
69 | cc.ASSETSMANAGER_PROTOCOL_ERROR = 2
70 |
71 |
--------------------------------------------------------------------------------
/src/cocos/framework/audio.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | Copyright (c) 2014-2017 Chukong Technologies Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
23 | ]]
24 |
25 | local audio = {}
26 |
27 | local engine = cc.SimpleAudioEngine:getInstance()
28 |
29 | function audio.getMusicVolume()
30 | local volume = engine:getMusicVolume()
31 | if DEBUG > 1 then
32 | printf("[audio] getMusicVolume() - volume: %0.2f", volume)
33 | end
34 | return volume
35 | end
36 |
37 | function audio.setMusicVolume(volume)
38 | volume = checknumber(volume)
39 | if DEBUG > 1 then
40 | printf("[audio] setMusicVolume() - volume: %0.2f", volume)
41 | end
42 | engine:setMusicVolume(volume)
43 | end
44 |
45 | function audio.preloadMusic(filename)
46 | assert(filename, "audio.preloadMusic() - invalid filename")
47 | if DEBUG > 1 then
48 | printf("[audio] preloadMusic() - filename: %s", tostring(filename))
49 | end
50 | engine:preloadMusic(filename)
51 | end
52 |
53 | function audio.playMusic(filename, isLoop)
54 | assert(filename, "audio.playMusic() - invalid filename")
55 | if type(isLoop) ~= "boolean" then isLoop = true end
56 |
57 | audio.stopMusic()
58 | if DEBUG > 1 then
59 | printf("[audio] playMusic() - filename: %s, isLoop: %s", tostring(filename), tostring(isLoop))
60 | end
61 | engine:playMusic(filename, isLoop)
62 | end
63 |
64 | function audio.stopMusic(isReleaseData)
65 | isReleaseData = checkbool(isReleaseData)
66 | if DEBUG > 1 then
67 | printf("[audio] stopMusic() - isReleaseData: %s", tostring(isReleaseData))
68 | end
69 | engine:stopMusic(isReleaseData)
70 | end
71 |
72 | function audio.pauseMusic()
73 | if DEBUG > 1 then
74 | printf("[audio] pauseMusic()")
75 | end
76 | engine:pauseMusic()
77 | end
78 |
79 | function audio.resumeMusic()
80 | if DEBUG > 1 then
81 | printf("[audio] resumeMusic()")
82 | end
83 | engine:resumeMusic()
84 | end
85 |
86 | function audio.rewindMusic()
87 | if DEBUG > 1 then
88 | printf("[audio] rewindMusic()")
89 | end
90 | engine:rewindMusic()
91 | end
92 |
93 | function audio.isMusicPlaying()
94 | local ret = engine:isMusicPlaying()
95 | if DEBUG > 1 then
96 | printf("[audio] isMusicPlaying() - ret: %s", tostring(ret))
97 | end
98 | return ret
99 | end
100 |
101 | function audio.getSoundsVolume()
102 | local volume = engine:getEffectsVolume()
103 | if DEBUG > 1 then
104 | printf("[audio] getSoundsVolume() - volume: %0.1f", volume)
105 | end
106 | return volume
107 | end
108 |
109 | function audio.setSoundsVolume(volume)
110 | volume = checknumber(volume)
111 | if DEBUG > 1 then
112 | printf("[audio] setSoundsVolume() - volume: %0.1f", volume)
113 | end
114 | engine:setEffectsVolume(volume)
115 | end
116 |
117 | function audio.playSound(filename, isLoop)
118 | if not filename then
119 | printError("audio.playSound() - invalid filename")
120 | return
121 | end
122 | if type(isLoop) ~= "boolean" then isLoop = false end
123 | if DEBUG > 1 then
124 | printf("[audio] playSound() - filename: %s, isLoop: %s", tostring(filename), tostring(isLoop))
125 | end
126 | return engine:playEffect(filename, isLoop)
127 | end
128 |
129 | function audio.pauseSound(handle)
130 | if not handle then
131 | printError("audio.pauseSound() - invalid handle")
132 | return
133 | end
134 | if DEBUG > 1 then
135 | printf("[audio] pauseSound() - handle: %s", tostring(handle))
136 | end
137 | engine:pauseEffect(handle)
138 | end
139 |
140 | function audio.pauseAllSounds()
141 | if DEBUG > 1 then
142 | printf("[audio] pauseAllSounds()")
143 | end
144 | engine:pauseAllEffects()
145 | end
146 |
147 | function audio.resumeSound(handle)
148 | if not handle then
149 | printError("audio.resumeSound() - invalid handle")
150 | return
151 | end
152 | if DEBUG > 1 then
153 | printf("[audio] resumeSound() - handle: %s", tostring(handle))
154 | end
155 | engine:resumeEffect(handle)
156 | end
157 |
158 | function audio.resumeAllSounds()
159 | if DEBUG > 1 then
160 | printf("[audio] resumeAllSounds()")
161 | end
162 | engine:resumeAllEffects()
163 | end
164 |
165 | function audio.stopSound(handle)
166 | if not handle then
167 | printError("audio.stopSound() - invalid handle")
168 | return
169 | end
170 | if DEBUG > 1 then
171 | printf("[audio] stopSound() - handle: %s", tostring(handle))
172 | end
173 | engine:stopEffect(handle)
174 | end
175 |
176 | function audio.stopAllSounds()
177 | if DEBUG > 1 then
178 | printf("[audio] stopAllSounds()")
179 | end
180 | engine:stopAllEffects()
181 | end
182 | audio.stopAllEffects = audio.stopAllSounds
183 |
184 | function audio.preloadSound(filename)
185 | if not filename then
186 | printError("audio.preloadSound() - invalid filename")
187 | return
188 | end
189 | if DEBUG > 1 then
190 | printf("[audio] preloadSound() - filename: %s", tostring(filename))
191 | end
192 | engine:preloadEffect(filename)
193 | end
194 |
195 | function audio.unloadSound(filename)
196 | if not filename then
197 | printError("audio.unloadSound() - invalid filename")
198 | return
199 | end
200 | if DEBUG > 1 then
201 | printf("[audio] unloadSound() - filename: %s", tostring(filename))
202 | end
203 | engine:unloadEffect(filename)
204 | end
205 |
206 | return audio
207 |
--------------------------------------------------------------------------------
/src/cocos/framework/components/event.lua:
--------------------------------------------------------------------------------
1 |
2 | local Event = class("Event")
3 |
4 | local EXPORTED_METHODS = {
5 | "addEventListener",
6 | "dispatchEvent",
7 | "removeEventListener",
8 | "removeEventListenersByTag",
9 | "removeEventListenersByEvent",
10 | "removeAllEventListeners",
11 | "hasEventListener",
12 | "dumpAllEventListeners",
13 | }
14 |
15 | function Event:init_()
16 | self.target_ = nil
17 | self.listeners_ = {}
18 | self.nextListenerHandleIndex_ = 0
19 | end
20 |
21 | function Event:bind(target)
22 | self:init_()
23 | cc.setmethods(target, self, EXPORTED_METHODS)
24 | self.target_ = target
25 | end
26 |
27 | function Event:unbind(target)
28 | cc.unsetmethods(target, EXPORTED_METHODS)
29 | self:init_()
30 | end
31 |
32 | function Event:on(eventName, listener, tag)
33 | assert(type(eventName) == "string" and eventName ~= "",
34 | "Event:addEventListener() - invalid eventName")
35 | eventName = string.upper(eventName)
36 | if self.listeners_[eventName] == nil then
37 | self.listeners_[eventName] = {}
38 | end
39 |
40 | self.nextListenerHandleIndex_ = self.nextListenerHandleIndex_ + 1
41 | local handle = tostring(self.nextListenerHandleIndex_)
42 | tag = tag or ""
43 | self.listeners_[eventName][handle] = {listener, tag}
44 |
45 | if DEBUG > 1 then
46 | printInfo("%s [Event] addEventListener() - event: %s, handle: %s, tag: \"%s\"",
47 | tostring(self.target_), eventName, handle, tostring(tag))
48 | end
49 |
50 | return self.target_, handle
51 | end
52 |
53 | Event.addEventListener = Event.on
54 |
55 | function Event:dispatchEvent(event)
56 | event.name = string.upper(tostring(event.name))
57 | local eventName = event.name
58 | if DEBUG > 1 then
59 | printInfo("%s [Event] dispatchEvent() - event %s", tostring(self.target_), eventName)
60 | end
61 |
62 | if self.listeners_[eventName] == nil then return end
63 | event.target = self.target_
64 | event.stop_ = false
65 | event.stop = function(self)
66 | self.stop_ = true
67 | end
68 |
69 | for handle, listener in pairs(self.listeners_[eventName]) do
70 | if DEBUG > 1 then
71 | printInfo("%s [Event] dispatchEvent() - dispatching event %s to listener %s", tostring(self.target_), eventName, handle)
72 | end
73 | -- listener[1] = listener
74 | -- listener[2] = tag
75 | event.tag = listener[2]
76 | listener[1](event)
77 | if event.stop_ then
78 | if DEBUG > 1 then
79 | printInfo("%s [Event] dispatchEvent() - break dispatching for event %s", tostring(self.target_), eventName)
80 | end
81 | break
82 | end
83 | end
84 |
85 | return self.target_
86 | end
87 |
88 | function Event:removeEventListener(handleToRemove)
89 | for eventName, listenersForEvent in pairs(self.listeners_) do
90 | for handle, _ in pairs(listenersForEvent) do
91 | if handle == handleToRemove then
92 | listenersForEvent[handle] = nil
93 | if DEBUG > 1 then
94 | printInfo("%s [Event] removeEventListener() - remove listener [%s] for event %s", tostring(self.target_), handle, eventName)
95 | end
96 | return self.target_
97 | end
98 | end
99 | end
100 |
101 | return self.target_
102 | end
103 |
104 | function Event:removeEventListenersByTag(tagToRemove)
105 | for eventName, listenersForEvent in pairs(self.listeners_) do
106 | for handle, listener in pairs(listenersForEvent) do
107 | -- listener[1] = listener
108 | -- listener[2] = tag
109 | if listener[2] == tagToRemove then
110 | listenersForEvent[handle] = nil
111 | if DEBUG > 1 then
112 | printInfo("%s [Event] removeEventListener() - remove listener [%s] for event %s", tostring(self.target_), handle, eventName)
113 | end
114 | end
115 | end
116 | end
117 |
118 | return self.target_
119 | end
120 |
121 | function Event:removeEventListenersByEvent(eventName)
122 | self.listeners_[string.upper(eventName)] = nil
123 | if DEBUG > 1 then
124 | printInfo("%s [Event] removeAllEventListenersForEvent() - remove all listeners for event %s", tostring(self.target_), eventName)
125 | end
126 | return self.target_
127 | end
128 |
129 | function Event:removeAllEventListeners()
130 | self.listeners_ = {}
131 | if DEBUG > 1 then
132 | printInfo("%s [Event] removeAllEventListeners() - remove all listeners", tostring(self.target_))
133 | end
134 | return self.target_
135 | end
136 |
137 | function Event:hasEventListener(eventName)
138 | eventName = string.upper(tostring(eventName))
139 | local t = self.listeners_[eventName]
140 | for _, __ in pairs(t) do
141 | return true
142 | end
143 | return false
144 | end
145 |
146 | function Event:dumpAllEventListeners()
147 | print("---- Event:dumpAllEventListeners() ----")
148 | for name, listeners in pairs(self.listeners_) do
149 | printf("-- event: %s", name)
150 | for handle, listener in pairs(listeners) do
151 | printf("-- listener: %s, handle: %s", tostring(listener[1]), tostring(handle))
152 | end
153 | end
154 | return self.target_
155 | end
156 |
157 | return Event
158 |
--------------------------------------------------------------------------------
/src/cocos/framework/device.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | Copyright (c) 2014-2017 Chukong Technologies Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
23 | ]]
24 |
25 | local device = {}
26 |
27 | device.platform = "unknown"
28 | device.model = "unknown"
29 |
30 | local app = cc.Application:getInstance()
31 | local target = app:getTargetPlatform()
32 | if target == cc.PLATFORM_OS_WINDOWS then
33 | device.platform = "windows"
34 | elseif target == cc.PLATFORM_OS_MAC then
35 | device.platform = "mac"
36 | elseif target == cc.PLATFORM_OS_ANDROID then
37 | device.platform = "android"
38 | elseif target == cc.PLATFORM_OS_IPHONE or target == cc.PLATFORM_OS_IPAD then
39 | device.platform = "ios"
40 | local director = cc.Director:getInstance()
41 | local view = director:getOpenGLView()
42 | local framesize = view:getFrameSize()
43 | local w, h = framesize.width, framesize.height
44 | if w == 640 and h == 960 then
45 | device.model = "iphone 4"
46 | elseif w == 640 and h == 1136 then
47 | device.model = "iphone 5"
48 | elseif w == 750 and h == 1334 then
49 | device.model = "iphone 6"
50 | elseif w == 1242 and h == 2208 then
51 | device.model = "iphone 6 plus"
52 | elseif w == 768 and h == 1024 then
53 | device.model = "ipad"
54 | elseif w == 1536 and h == 2048 then
55 | device.model = "ipad retina"
56 | end
57 | elseif target == cc.PLATFORM_OS_WINRT then
58 | device.platform = "winrt"
59 | elseif target == cc.PLATFORM_OS_WP8 then
60 | device.platform = "wp8"
61 | end
62 |
63 | local language_ = app:getCurrentLanguage()
64 | if language_ == cc.LANGUAGE_CHINESE then
65 | language_ = "cn"
66 | elseif language_ == cc.LANGUAGE_FRENCH then
67 | language_ = "fr"
68 | elseif language_ == cc.LANGUAGE_ITALIAN then
69 | language_ = "it"
70 | elseif language_ == cc.LANGUAGE_GERMAN then
71 | language_ = "gr"
72 | elseif language_ == cc.LANGUAGE_SPANISH then
73 | language_ = "sp"
74 | elseif language_ == cc.LANGUAGE_RUSSIAN then
75 | language_ = "ru"
76 | elseif language_ == cc.LANGUAGE_KOREAN then
77 | language_ = "kr"
78 | elseif language_ == cc.LANGUAGE_JAPANESE then
79 | language_ = "jp"
80 | elseif language_ == cc.LANGUAGE_HUNGARIAN then
81 | language_ = "hu"
82 | elseif language_ == cc.LANGUAGE_PORTUGUESE then
83 | language_ = "pt"
84 | elseif language_ == cc.LANGUAGE_ARABIC then
85 | language_ = "ar"
86 | else
87 | language_ = "en"
88 | end
89 |
90 | device.language = language_
91 | device.writablePath = cc.FileUtils:getInstance():getWritablePath()
92 | device.directorySeparator = "/"
93 | device.pathSeparator = ":"
94 | if device.platform == "windows" then
95 | device.directorySeparator = "\\"
96 | device.pathSeparator = ";"
97 | end
98 |
99 | printInfo("# device.platform = " .. device.platform)
100 | printInfo("# device.model = " .. device.model)
101 | printInfo("# device.language = " .. device.language)
102 | printInfo("# device.writablePath = " .. device.writablePath)
103 | printInfo("# device.directorySeparator = " .. device.directorySeparator)
104 | printInfo("# device.pathSeparator = " .. device.pathSeparator)
105 | printInfo("#")
106 |
107 | return device
108 |
--------------------------------------------------------------------------------
/src/cocos/framework/extends/LayerEx.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | Copyright (c) 2014-2017 Chukong Technologies Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
23 | ]]
24 |
25 | local Layer = cc.Layer
26 |
27 | function Layer:onTouch(callback, isMultiTouches, swallowTouches)
28 | if type(isMultiTouches) ~= "boolean" then isMultiTouches = false end
29 | if type(swallowTouches) ~= "boolean" then swallowTouches = false end
30 |
31 | self:registerScriptTouchHandler(function(state, ...)
32 | local args = {...}
33 | local event = {name = state}
34 | if isMultiTouches then
35 | args = args[1]
36 | local points = {}
37 | for i = 1, #args, 3 do
38 | local x, y, id = args[i], args[i + 1], args[i + 2]
39 | points[id] = {x = x, y = y, id = id}
40 | end
41 | event.points = points
42 | else
43 | event.x = args[1]
44 | event.y = args[2]
45 | end
46 | return callback( event )
47 | end, isMultiTouches, 0, swallowTouches)
48 | self:setTouchEnabled(true)
49 | return self
50 | end
51 |
52 | function Layer:removeTouch()
53 | self:unregisterScriptTouchHandler()
54 | self:setTouchEnabled(false)
55 | return self
56 | end
57 |
58 | function Layer:onKeypad(callback)
59 | self:registerScriptKeypadHandler(callback)
60 | self:setKeyboardEnabled(true)
61 | return self
62 | end
63 |
64 | function Layer:removeKeypad()
65 | self:unregisterScriptKeypadHandler()
66 | self:setKeyboardEnabled(false)
67 | return self
68 | end
69 |
70 | function Layer:onAccelerate(callback)
71 | self:registerScriptAccelerateHandler(callback)
72 | self:setAccelerometerEnabled(true)
73 | return self
74 | end
75 |
76 | function Layer:removeAccelerate()
77 | self:unregisterScriptAccelerateHandler()
78 | self:setAccelerometerEnabled(false)
79 | return self
80 | end
81 |
--------------------------------------------------------------------------------
/src/cocos/framework/extends/MenuEx.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | Copyright (c) 2014-2017 Chukong Technologies Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
23 | ]]
24 |
25 | local Menu = cc.Menu
26 | local MenuItem = cc.MenuItem
27 |
28 | function MenuItem:onClicked(callback)
29 | self:registerScriptTapHandler(callback)
30 | return self
31 | end
32 |
--------------------------------------------------------------------------------
/src/cocos/framework/extends/NodeEx.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | Copyright (c) 2014-2017 Chukong Technologies Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
23 | ]]
24 |
25 | local Node = cc.Node
26 |
27 | function Node:add(child, zorder, tag)
28 | if tag then
29 | self:addChild(child, zorder, tag)
30 | elseif zorder then
31 | self:addChild(child, zorder)
32 | else
33 | self:addChild(child)
34 | end
35 | return self
36 | end
37 |
38 | function Node:addTo(parent, zorder, tag)
39 | if tag then
40 | parent:addChild(self, zorder, tag)
41 | elseif zorder then
42 | parent:addChild(self, zorder)
43 | else
44 | parent:addChild(self)
45 | end
46 | return self
47 | end
48 |
49 | function Node:removeSelf()
50 | self:removeFromParent()
51 | return self
52 | end
53 |
54 | function Node:align(anchorPoint, x, y)
55 | self:setAnchorPoint(anchorPoint)
56 | return self:move(x, y)
57 | end
58 |
59 | function Node:show()
60 | self:setVisible(true)
61 | return self
62 | end
63 |
64 | function Node:hide()
65 | self:setVisible(false)
66 | return self
67 | end
68 |
69 | function Node:move(x, y)
70 | if y then
71 | self:setPosition(x, y)
72 | else
73 | self:setPosition(x)
74 | end
75 | return self
76 | end
77 |
78 | function Node:moveTo(args)
79 | transition.moveTo(self, args)
80 | return self
81 | end
82 |
83 | function Node:moveBy(args)
84 | transition.moveBy(self, args)
85 | return self
86 | end
87 |
88 | function Node:fadeIn(args)
89 | transition.fadeIn(self, args)
90 | return self
91 | end
92 |
93 | function Node:fadeOut(args)
94 | transition.fadeOut(self, args)
95 | return self
96 | end
97 |
98 | function Node:fadeTo(args)
99 | transition.fadeTo(self, args)
100 | return self
101 | end
102 |
103 | function Node:rotate(rotation)
104 | self:setRotation(rotation)
105 | return self
106 | end
107 |
108 | function Node:rotateTo(args)
109 | transition.rotateTo(self, args)
110 | return self
111 | end
112 |
113 | function Node:rotateBy(args)
114 | transition.rotateBy(self, args)
115 | return self
116 | end
117 |
118 | function Node:scaleTo(args)
119 | transition.scaleTo(self, args)
120 | return self
121 | end
122 |
123 | function Node:onUpdate(callback)
124 | self:scheduleUpdateWithPriorityLua(callback, 0)
125 | return self
126 | end
127 |
128 | Node.scheduleUpdate = Node.onUpdate
129 |
130 | function Node:onNodeEvent(eventName, callback)
131 | if "enter" == eventName then
132 | self.onEnterCallback_ = callback
133 | elseif "exit" == eventName then
134 | self.onExitCallback_ = callback
135 | elseif "enterTransitionFinish" == eventName then
136 | self.onEnterTransitionFinishCallback_ = callback
137 | elseif "exitTransitionStart" == eventName then
138 | self.onExitTransitionStartCallback_ = callback
139 | elseif "cleanup" == eventName then
140 | self.onCleanupCallback_ = callback
141 | end
142 | self:enableNodeEvents()
143 | end
144 |
145 | function Node:enableNodeEvents()
146 | if self.isNodeEventEnabled_ then
147 | return self
148 | end
149 |
150 | self:registerScriptHandler(function(state)
151 | if state == "enter" then
152 | self:onEnter_()
153 | elseif state == "exit" then
154 | self:onExit_()
155 | elseif state == "enterTransitionFinish" then
156 | self:onEnterTransitionFinish_()
157 | elseif state == "exitTransitionStart" then
158 | self:onExitTransitionStart_()
159 | elseif state == "cleanup" then
160 | self:onCleanup_()
161 | end
162 | end)
163 | self.isNodeEventEnabled_ = true
164 |
165 | return self
166 | end
167 |
168 | function Node:disableNodeEvents()
169 | self:unregisterScriptHandler()
170 | self.isNodeEventEnabled_ = false
171 | return self
172 | end
173 |
174 |
175 | function Node:onEnter()
176 | end
177 |
178 | function Node:onExit()
179 | end
180 |
181 | function Node:onEnterTransitionFinish()
182 | end
183 |
184 | function Node:onExitTransitionStart()
185 | end
186 |
187 | function Node:onCleanup()
188 | end
189 |
190 | function Node:onEnter_()
191 | self:onEnter()
192 | if not self.onEnterCallback_ then
193 | return
194 | end
195 | self:onEnterCallback_()
196 | end
197 |
198 | function Node:onExit_()
199 | self:onExit()
200 | if not self.onExitCallback_ then
201 | return
202 | end
203 | self:onExitCallback_()
204 | end
205 |
206 | function Node:onEnterTransitionFinish_()
207 | self:onEnterTransitionFinish()
208 | if not self.onEnterTransitionFinishCallback_ then
209 | return
210 | end
211 | self:onEnterTransitionFinishCallback_()
212 | end
213 |
214 | function Node:onExitTransitionStart_()
215 | self:onExitTransitionStart()
216 | if not self.onExitTransitionStartCallback_ then
217 | return
218 | end
219 | self:onExitTransitionStartCallback_()
220 | end
221 |
222 | function Node:onCleanup_()
223 | self:onCleanup()
224 | if not self.onCleanupCallback_ then
225 | return
226 | end
227 | self:onCleanupCallback_()
228 | end
229 |
--------------------------------------------------------------------------------
/src/cocos/framework/extends/SpriteEx.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | Copyright (c) 2014-2017 Chukong Technologies Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
23 | ]]
24 |
25 | local Sprite = cc.Sprite
26 |
27 | function Sprite:playAnimationOnce(animation, args)
28 | local actions = {}
29 |
30 | local showDelay = args.showDelay or 0
31 | if showDelay then
32 | self:setVisible(false)
33 | actions[#actions + 1] = cc.DelayTime:create(showDelay)
34 | actions[#actions + 1] = cc.Show:create()
35 | end
36 |
37 | local delay = args.delay or 0
38 | if delay > 0 then
39 | actions[#actions + 1] = cc.DelayTime:create(delay)
40 | end
41 |
42 | actions[#actions + 1] = cc.Animate:create(animation)
43 |
44 | if args.removeSelf then
45 | actions[#actions + 1] = cc.RemoveSelf:create()
46 | end
47 |
48 | if args.onComplete then
49 | actions[#actions + 1] = cc.CallFunc:create(args.onComplete)
50 | end
51 |
52 | local action
53 | if #actions > 1 then
54 | action = cc.Sequence:create(actions)
55 | else
56 | action = actions[1]
57 | end
58 | self:runAction(action)
59 | return action
60 | end
61 |
62 | function Sprite:playAnimationForever(animation)
63 | local animate = cc.Animate:create(animation)
64 | local action = cc.RepeatForever:create(animate)
65 | self:runAction(action)
66 | return action
67 | end
68 |
--------------------------------------------------------------------------------
/src/cocos/framework/extends/UICheckBox.lua:
--------------------------------------------------------------------------------
1 |
2 | --[[
3 |
4 | Copyright (c) 2014-2017 Chukong Technologies Inc.
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
24 | ]]
25 |
26 | local CheckBox = ccui.CheckBox
27 |
28 | function CheckBox:onEvent(callback)
29 | self:addEventListener(function(sender, eventType)
30 | local event = {}
31 | if eventType == 0 then
32 | event.name = "selected"
33 | else
34 | event.name = "unselected"
35 | end
36 | event.target = sender
37 | callback(event)
38 | end)
39 | return self
40 | end
41 |
--------------------------------------------------------------------------------
/src/cocos/framework/extends/UIEditBox.lua:
--------------------------------------------------------------------------------
1 |
2 | --[[
3 |
4 | Copyright (c) 2014-2017 Chukong Technologies Inc.
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
24 | ]]
25 |
26 | local EditBox = ccui.EditBox
27 |
28 | function EditBox:onEditHandler(callback)
29 | self:registerScriptEditBoxHandler(function(name, sender)
30 | local event = {}
31 | event.name = name
32 | event.target = sender
33 | callback(event)
34 | end)
35 | return self
36 | end
37 |
38 | function EditBox:removeEditHandler()
39 | self:unregisterScriptEditBoxHandler()
40 | return self
41 | end
42 |
--------------------------------------------------------------------------------
/src/cocos/framework/extends/UIListView.lua:
--------------------------------------------------------------------------------
1 |
2 | --[[
3 |
4 | Copyright (c) 2014-2017 Chukong Technologies Inc.
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
24 | ]]
25 |
26 | local ListView = ccui.ListView
27 |
28 | function ListView:onEvent(callback)
29 | self:addEventListener(function(sender, eventType)
30 | local event = {}
31 | if eventType == 0 then
32 | event.name = "ON_SELECTED_ITEM_START"
33 | else
34 | event.name = "ON_SELECTED_ITEM_END"
35 | end
36 | event.target = sender
37 | callback(event)
38 | end)
39 | return self
40 | end
41 |
42 | function ListView:onScroll(callback)
43 | self:addScrollViewEventListener(function(sender, eventType)
44 | local event = {}
45 | if eventType == 0 then
46 | event.name = "SCROLL_TO_TOP"
47 | elseif eventType == 1 then
48 | event.name = "SCROLL_TO_BOTTOM"
49 | elseif eventType == 2 then
50 | event.name = "SCROLL_TO_LEFT"
51 | elseif eventType == 3 then
52 | event.name = "SCROLL_TO_RIGHT"
53 | elseif eventType == 4 then
54 | event.name = "SCROLLING"
55 | elseif eventType == 5 then
56 | event.name = "BOUNCE_TOP"
57 | elseif eventType == 6 then
58 | event.name = "BOUNCE_BOTTOM"
59 | elseif eventType == 7 then
60 | event.name = "BOUNCE_LEFT"
61 | elseif eventType == 8 then
62 | event.name = "BOUNCE_RIGHT"
63 | elseif eventType == 9 then
64 | event.name = "CONTAINER_MOVED"
65 | elseif eventType == 10 then
66 | event.name = "AUTOSCROLL_ENDED"
67 | end
68 | event.target = sender
69 | callback(event)
70 | end)
71 | return self
72 | end
73 |
--------------------------------------------------------------------------------
/src/cocos/framework/extends/UIPageView.lua:
--------------------------------------------------------------------------------
1 |
2 | --[[
3 |
4 | Copyright (c) 2014-2017 Chukong Technologies Inc.
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
24 | ]]
25 |
26 | local PageView = ccui.PageView
27 |
28 | function PageView:onEvent(callback)
29 | self:addEventListener(function(sender, eventType)
30 | local event = {}
31 | if eventType == 0 then
32 | event.name = "TURNING"
33 | end
34 | event.target = sender
35 | callback(event)
36 | end)
37 | return self
38 | end
39 |
--------------------------------------------------------------------------------
/src/cocos/framework/extends/UIScrollView.lua:
--------------------------------------------------------------------------------
1 |
2 | --[[
3 |
4 | Copyright (c) 2014-2017 Chukong Technologies Inc.
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
24 | ]]
25 |
26 | local ScrollView = ccui.ScrollView
27 |
28 | function ScrollView:onEvent(callback)
29 | self:addEventListener(function(sender, eventType)
30 | local event = {}
31 | if eventType == 0 then
32 | event.name = "SCROLL_TO_TOP"
33 | elseif eventType == 1 then
34 | event.name = "SCROLL_TO_BOTTOM"
35 | elseif eventType == 2 then
36 | event.name = "SCROLL_TO_LEFT"
37 | elseif eventType == 3 then
38 | event.name = "SCROLL_TO_RIGHT"
39 | elseif eventType == 4 then
40 | event.name = "SCROLLING"
41 | elseif eventType == 5 then
42 | event.name = "BOUNCE_TOP"
43 | elseif eventType == 6 then
44 | event.name = "BOUNCE_BOTTOM"
45 | elseif eventType == 7 then
46 | event.name = "BOUNCE_LEFT"
47 | elseif eventType == 8 then
48 | event.name = "BOUNCE_RIGHT"
49 | elseif eventType == 9 then
50 | event.name = "CONTAINER_MOVED"
51 | elseif eventType == 10 then
52 | event.name = "AUTOSCROLL_ENDED"
53 | end
54 | event.target = sender
55 | callback(event)
56 | end)
57 | return self
58 | end
59 |
60 | ScrollView.onScroll = ScrollView.onEvent
61 |
--------------------------------------------------------------------------------
/src/cocos/framework/extends/UISlider.lua:
--------------------------------------------------------------------------------
1 |
2 | --[[
3 |
4 | Copyright (c) 2014-2017 Chukong Technologies Inc.
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
24 | ]]
25 |
26 | local Slider = ccui.Slider
27 |
28 | function Slider:onEvent(callback)
29 | self:addEventListener(function(sender, eventType)
30 | local event = {}
31 | if eventType == 0 then
32 | event.name = "ON_PERCENTAGE_CHANGED"
33 | end
34 | event.target = sender
35 | callback(event)
36 | end)
37 | return self
38 | end
39 |
--------------------------------------------------------------------------------
/src/cocos/framework/extends/UITextField.lua:
--------------------------------------------------------------------------------
1 |
2 | --[[
3 |
4 | Copyright (c) 2014-2017 Chukong Technologies Inc.
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
24 | ]]
25 |
26 | local TextField = ccui.TextField
27 |
28 | function TextField:onEvent(callback)
29 | self:addEventListener(function(sender, eventType)
30 | local event = {}
31 | if eventType == 0 then
32 | event.name = "ATTACH_WITH_IME"
33 | elseif eventType == 1 then
34 | event.name = "DETACH_WITH_IME"
35 | elseif eventType == 2 then
36 | event.name = "INSERT_TEXT"
37 | elseif eventType == 3 then
38 | event.name = "DELETE_BACKWARD"
39 | end
40 | event.target = sender
41 | callback(event)
42 | end)
43 | return self
44 | end
45 |
--------------------------------------------------------------------------------
/src/cocos/framework/extends/UIWidget.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | Copyright (c) 2014-2017 Chukong Technologies Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
23 | ]]
24 |
25 | local Widget = ccui.Widget
26 |
27 | function Widget:onTouch(callback)
28 | self:addTouchEventListener(function(sender, state)
29 | local event = {x = 0, y = 0}
30 | if state == 0 then
31 | event.name = "began"
32 | elseif state == 1 then
33 | event.name = "moved"
34 | elseif state == 2 then
35 | event.name = "ended"
36 | else
37 | event.name = "cancelled"
38 | end
39 | event.target = sender
40 | callback(event)
41 | end)
42 | return self
43 | end
44 |
--------------------------------------------------------------------------------
/src/cocos/framework/init.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | Copyright (c) 2014-2017 Chukong Technologies Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
23 | ]]
24 |
25 | if type(DEBUG) ~= "number" then DEBUG = 0 end
26 |
27 | -- load framework
28 | printInfo("")
29 | printInfo("# DEBUG = " .. DEBUG)
30 | printInfo("#")
31 |
32 | device = require("cocos.framework.device")
33 | display = require("cocos.framework.display")
34 | audio = require("cocos.framework.audio")
35 | transition = require("cocos.framework.transition")
36 |
37 | require("cocos.framework.extends.NodeEx")
38 | require("cocos.framework.extends.SpriteEx")
39 | require("cocos.framework.extends.LayerEx")
40 | require("cocos.framework.extends.MenuEx")
41 |
42 | if ccui then
43 | require("cocos.framework.extends.UIWidget")
44 | require("cocos.framework.extends.UICheckBox")
45 | require("cocos.framework.extends.UIEditBox")
46 | require("cocos.framework.extends.UIListView")
47 | require("cocos.framework.extends.UIPageView")
48 | require("cocos.framework.extends.UIScrollView")
49 | require("cocos.framework.extends.UISlider")
50 | require("cocos.framework.extends.UITextField")
51 | end
52 |
53 | require("cocos.framework.package_support")
54 |
55 | -- register the build-in packages
56 | cc.register("event", require("cocos.framework.components.event"))
57 |
58 | -- export global variable
59 | local __g = _G
60 | cc.exports = {}
61 | setmetatable(cc.exports, {
62 | __newindex = function(_, name, value)
63 | rawset(__g, name, value)
64 | end,
65 |
66 | __index = function(_, name)
67 | return rawget(__g, name)
68 | end
69 | })
70 |
71 | -- disable create unexpected global variable
72 | function cc.disable_global()
73 | setmetatable(__g, {
74 | __newindex = function(_, name, value)
75 | error(string.format("USE \" cc.exports.%s = value \" INSTEAD OF SET GLOBAL VARIABLE", name), 0)
76 | end
77 | })
78 | end
79 |
80 | if CC_DISABLE_GLOBAL then
81 | cc.disable_global()
82 | end
83 |
--------------------------------------------------------------------------------
/src/cocos/framework/package_support.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | Copyright (c) 2014-2017 Chukong Technologies Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
23 | ]]
24 |
25 | -- Cocos2d-Lua core functions
26 | cc.loaded_packages = {}
27 | local loaded_packages = cc.loaded_packages
28 |
29 | function cc.register(name, package)
30 | cc.loaded_packages[name] = package
31 | end
32 |
33 | function cc.load(...)
34 | local names = {...}
35 | assert(#names > 0, "cc.load() - invalid package names")
36 |
37 | local packages = {}
38 | for _, name in ipairs(names) do
39 | assert(type(name) == "string", string.format("cc.load() - invalid package name \"%s\"", tostring(name)))
40 | if not loaded_packages[name] then
41 | local packageName = string.format("packages.%s.init", name)
42 | local cls = require(packageName)
43 | assert(cls, string.format("cc.load() - package class \"%s\" load failed", packageName))
44 | loaded_packages[name] = cls
45 |
46 | if DEBUG > 1 then
47 | printInfo("cc.load() - load module \"packages.%s.init\"", name)
48 | end
49 | end
50 | packages[#packages + 1] = loaded_packages[name]
51 | end
52 | return unpack(packages)
53 | end
54 |
55 | local load_ = cc.load
56 | local bind_
57 | bind_ = function(target, ...)
58 | local t = type(target)
59 | assert(t == "table" or t == "userdata", string.format("cc.bind() - invalid target, expected is object, actual is %s", t))
60 | local names = {...}
61 | assert(#names > 0, "cc.bind() - package names expected")
62 |
63 | load_(...)
64 | if not target.components_ then target.components_ = {} end
65 | for _, name in ipairs(names) do
66 | assert(type(name) == "string" and name ~= "", string.format("cc.bind() - invalid package name \"%s\"", name))
67 | if not target.components_[name] then
68 | local cls = loaded_packages[name]
69 | for __, depend in ipairs(cls.depends or {}) do
70 | if not target.components_[depend] then
71 | bind_(target, depend)
72 | end
73 | end
74 | local component = cls:create()
75 | target.components_[name] = component
76 | component:bind(target)
77 | end
78 | end
79 |
80 | return target
81 | end
82 | cc.bind = bind_
83 |
84 | function cc.unbind(target, ...)
85 | if not target.components_ then return end
86 |
87 | local names = {...}
88 | assert(#names > 0, "cc.unbind() - invalid package names")
89 |
90 | for _, name in ipairs(names) do
91 | assert(type(name) == "string" and name ~= "", string.format("cc.unbind() - invalid package name \"%s\"", name))
92 | local component = target.components_[name]
93 | assert(component, string.format("cc.unbind() - component \"%s\" not found", tostring(name)))
94 | component:unbind(target)
95 | target.components_[name] = nil
96 | end
97 | return target
98 | end
99 |
100 | function cc.setmethods(target, component, methods)
101 | for _, name in ipairs(methods) do
102 | local method = component[name]
103 | target[name] = function(__, ...)
104 | return method(component, ...)
105 | end
106 | end
107 | end
108 |
109 | function cc.unsetmethods(target, methods)
110 | for _, name in ipairs(methods) do
111 | target[name] = nil
112 | end
113 | end
114 |
--------------------------------------------------------------------------------
/src/cocos/init.lua:
--------------------------------------------------------------------------------
1 | --[[
2 |
3 | Copyright (c) 2014-2017 Chukong Technologies Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
23 | ]]
24 |
25 | require "cocos.cocos2d.Cocos2d"
26 | require "cocos.cocos2d.Cocos2dConstants"
27 | require "cocos.cocos2d.functions"
28 |
29 | __G__TRACKBACK__ = function(msg)
30 | local msg = debug.traceback(msg, 3)
31 | print(msg)
32 | return msg
33 | end
34 |
35 | -- opengl
36 | require "cocos.cocos2d.Opengl"
37 | require "cocos.cocos2d.OpenglConstants"
38 | -- audio
39 | require "cocos.cocosdenshion.AudioEngine"
40 | -- cocosstudio
41 | if nil ~= ccs then
42 | require "cocos.cocostudio.CocoStudio"
43 | end
44 | -- ui
45 | if nil ~= ccui then
46 | require "cocos.ui.GuiConstants"
47 | require "cocos.ui.experimentalUIConstants"
48 | end
49 |
50 | -- extensions
51 | require "cocos.extension.ExtensionConstants"
52 | -- network
53 | require "cocos.network.NetworkConstants"
54 | -- Spine
55 | if nil ~= sp then
56 | require "cocos.spine.SpineConstants"
57 | end
58 |
59 | require "cocos.cocos2d.deprecated"
60 | require "cocos.cocos2d.DrawPrimitives"
61 |
62 | -- Lua extensions
63 | require "cocos.cocos2d.bitExtend"
64 |
65 | -- CCLuaEngine
66 | require "cocos.cocos2d.DeprecatedCocos2dClass"
67 | require "cocos.cocos2d.DeprecatedCocos2dEnum"
68 | require "cocos.cocos2d.DeprecatedCocos2dFunc"
69 | require "cocos.cocos2d.DeprecatedOpenglEnum"
70 |
71 | -- register_cocostudio_module
72 | if nil ~= ccs then
73 | require "cocos.cocostudio.DeprecatedCocoStudioClass"
74 | require "cocos.cocostudio.DeprecatedCocoStudioFunc"
75 | end
76 |
77 |
78 | -- register_cocosbuilder_module
79 | require "cocos.cocosbuilder.DeprecatedCocosBuilderClass"
80 |
81 | -- register_cocosdenshion_module
82 | require "cocos.cocosdenshion.DeprecatedCocosDenshionClass"
83 | require "cocos.cocosdenshion.DeprecatedCocosDenshionFunc"
84 |
85 | -- register_extension_module
86 | require "cocos.extension.DeprecatedExtensionClass"
87 | require "cocos.extension.DeprecatedExtensionEnum"
88 | require "cocos.extension.DeprecatedExtensionFunc"
89 |
90 | -- register_network_module
91 | require "cocos.network.DeprecatedNetworkClass"
92 | require "cocos.network.DeprecatedNetworkEnum"
93 | require "cocos.network.DeprecatedNetworkFunc"
94 |
95 | -- register_ui_module
96 | if nil ~= ccui then
97 | require "cocos.ui.DeprecatedUIEnum"
98 | require "cocos.ui.DeprecatedUIFunc"
99 | end
100 |
101 | -- cocosbuilder
102 | require "cocos.cocosbuilder.CCBReaderLoad"
103 |
104 | -- physics3d
105 | require "cocos.physics3d.physics3d-constants"
106 |
107 | if CC_USE_FRAMEWORK then
108 | require "cocos.framework.init"
109 | end
110 |
--------------------------------------------------------------------------------
/src/cocos/network/DeprecatedNetworkClass.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.XMLHttpRequest then
2 | return
3 | end
4 | -- This is the DeprecatedNetworkClass
5 |
6 | DeprecatedNetworkClass = {} or DeprecatedNetworkClass
7 |
8 | --tip
9 | local function deprecatedTip(old_name,new_name)
10 | print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")
11 | end
12 |
13 | --WebSocket class will be Deprecated,begin
14 | function DeprecatedNetworkClass.WebSocket()
15 | deprecatedTip("WebSocket","cc.WebSocket")
16 | return cc.WebSocket
17 | end
18 | _G["WebSocket"] = DeprecatedNetworkClass.WebSocket()
19 | --WebSocket class will be Deprecated,end
20 |
--------------------------------------------------------------------------------
/src/cocos/network/DeprecatedNetworkEnum.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.XMLHttpRequest then
2 | return
3 | end
4 |
5 | _G.kWebSocketScriptHandlerOpen = cc.WEBSOCKET_OPEN
6 | _G.kWebSocketScriptHandlerMessage = cc.WEBSOCKET_MESSAGE
7 | _G.kWebSocketScriptHandlerClose = cc.WEBSOCKET_CLOSE
8 | _G.kWebSocketScriptHandlerError = cc.WEBSOCKET_ERROR
9 |
10 | _G.kStateConnecting = cc.WEBSOCKET_STATE_CONNECTING
11 | _G.kStateOpen = cc.WEBSOCKET_STATE_OPEN
12 | _G.kStateClosing = cc.WEBSOCKET_STATE_CLOSING
13 | _G.kStateClosed = cc.WEBSOCKET_STATE_CLOSED
14 |
--------------------------------------------------------------------------------
/src/cocos/network/DeprecatedNetworkFunc.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.XMLHttpRequest then
2 | return
3 | end
4 |
5 | --tip
6 | local function deprecatedTip(old_name,new_name)
7 | print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")
8 | end
9 |
10 | --functions of WebSocket will be deprecated begin
11 | local targetPlatform = CCApplication:getInstance():getTargetPlatform()
12 | if (kTargetIphone == targetPlatform) or (kTargetIpad == targetPlatform) or (kTargetAndroid == targetPlatform) or (kTargetWindows == targetPlatform) then
13 | local WebSocketDeprecated = { }
14 | function WebSocketDeprecated.sendTextMsg(self, string)
15 | deprecatedTip("WebSocket:sendTextMsg","WebSocket:sendString")
16 | return self:sendString(string)
17 | end
18 | WebSocket.sendTextMsg = WebSocketDeprecated.sendTextMsg
19 |
20 | function WebSocketDeprecated.sendBinaryMsg(self, table,tablesize)
21 | deprecatedTip("WebSocket:sendBinaryMsg","WebSocket:sendString")
22 | string.char(unpack(table))
23 | return self:sendString(string.char(unpack(table)))
24 | end
25 | WebSocket.sendBinaryMsg = WebSocketDeprecated.sendBinaryMsg
26 | end
27 | --functions of WebSocket will be deprecated end
28 |
--------------------------------------------------------------------------------
/src/cocos/network/NetworkConstants.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.XMLHttpRequest then
2 | return
3 | end
4 |
5 | cc.WEBSOCKET_OPEN = 0
6 | cc.WEBSOCKET_MESSAGE = 1
7 | cc.WEBSOCKET_CLOSE = 2
8 | cc.WEBSOCKET_ERROR = 3
9 |
10 | cc.WEBSOCKET_STATE_CONNECTING = 0
11 | cc.WEBSOCKET_STATE_OPEN = 1
12 | cc.WEBSOCKET_STATE_CLOSING = 2
13 | cc.WEBSOCKET_STATE_CLOSED = 3
14 |
15 | cc.XMLHTTPREQUEST_RESPONSE_STRING = 0
16 | cc.XMLHTTPREQUEST_RESPONSE_ARRAY_BUFFER = 1
17 | cc.XMLHTTPREQUEST_RESPONSE_BLOB = 2
18 | cc.XMLHTTPREQUEST_RESPONSE_DOCUMENT = 3
19 | cc.XMLHTTPREQUEST_RESPONSE_JSON = 4
20 |
--------------------------------------------------------------------------------
/src/cocos/physics3d/physics3d-constants.lua:
--------------------------------------------------------------------------------
1 | if nil == cc.Physics3DComponent then
2 | return
3 | end
4 |
5 | cc.Physics3DComponent.PhysicsSyncFlag =
6 | {
7 | NONE = 0,
8 | NODE_TO_PHYSICS = 1,
9 | PHYSICS_TO_NODE = 2,
10 | NODE_AND_NODE = 3,
11 | }
12 |
13 | cc.Physics3DObject.PhysicsObjType =
14 | {
15 | UNKNOWN = 0,
16 | RIGID_BODY = 1,
17 | }
--------------------------------------------------------------------------------
/src/cocos/spine/SpineConstants.lua:
--------------------------------------------------------------------------------
1 | if nil == sp then
2 | return
3 | end
4 |
5 | sp.EventType =
6 | {
7 | ANIMATION_START = 0,
8 | ANIMATION_INTERRUPT = 1,
9 | ANIMATION_END = 2,
10 | ANIMATION_COMPLETE = 3,
11 | ANIMATION_DISPOSE = 4,
12 | ANIMATION_EVENT = 5,
13 | }
14 |
--------------------------------------------------------------------------------
/src/cocos/ui/DeprecatedUIEnum.lua:
--------------------------------------------------------------------------------
1 | if nil == ccui then
2 | return
3 | end
4 |
5 | LAYOUT_COLOR_NONE = ccui.LayoutBackGroundColorType.none
6 | LAYOUT_COLOR_SOLID = ccui.LayoutBackGroundColorType.solid
7 | LAYOUT_COLOR_GRADIENT = ccui.LayoutBackGroundColorType.gradient
8 |
9 | LAYOUT_ABSOLUTE = ccui.LayoutType.ABSOLUTE
10 | LAYOUT_LINEAR_VERTICAL = ccui.LayoutType.VERTICAL
11 | LAYOUT_LINEAR_HORIZONTAL = ccui.LayoutType.HORIZONTAL
12 | LAYOUT_RELATIVE = ccui.LayoutType.RELATIVE
13 |
14 | BRIGHT_NONE = ccui.BrightStyle.none
15 | BRIGHT_NORMAL = ccui.BrightStyle.normal
16 | BRIGHT_HIGHLIGHT = ccui.BrightStyle.highlight
17 |
18 | UI_TEX_TYPE_LOCAL = ccui.TextureResType.localType
19 | UI_TEX_TYPE_PLIST = ccui.TextureResType.plistType
20 |
21 | TOUCH_EVENT_BEGAN = ccui.TouchEventType.began
22 | TOUCH_EVENT_MOVED = ccui.TouchEventType.moved
23 | TOUCH_EVENT_ENDED = ccui.TouchEventType.ended
24 | TOUCH_EVENT_CANCELED = ccui.TouchEventType.canceled
25 |
26 | SIZE_ABSOLUTE = ccui.SizeType.absolute
27 | SIZE_PERCENT = ccui.SizeType.percent
28 |
29 | POSITION_ABSOLUTE = ccui.PositionType.absolute
30 | POSITION_PERCENT = ccui.PositionType.percent
31 |
32 | CHECKBOX_STATE_EVENT_SELECTED = ccui.CheckBoxEventType.selected
33 | CHECKBOX_STATE_EVENT_UNSELECTED = ccui.CheckBoxEventType.unselected
34 |
35 | CHECKBOX_STATE_EVENT_SELECTED = ccui.CheckBoxEventType.selected
36 | CHECKBOX_STATE_EVENT_UNSELECTED = ccui.CheckBoxEventType.unselected
37 |
38 | LoadingBarTypeLeft = ccui.LoadingBarDirection.LEFT
39 | LoadingBarTypeRight = ccui.LoadingBarDirection.RIGHT
40 |
41 | LoadingBarTypeRight = ccui.SliderEventType.percent_changed
42 |
43 | TEXTFIELD_EVENT_ATTACH_WITH_IME = ccui.TextFiledEventType.attach_with_ime
44 | TEXTFIELD_EVENT_DETACH_WITH_IME = ccui.TextFiledEventType.detach_with_ime
45 | TEXTFIELD_EVENT_INSERT_TEXT = ccui.TextFiledEventType.insert_text
46 | TEXTFIELD_EVENT_DELETE_BACKWARD = ccui.TextFiledEventType.delete_backward
47 |
48 | SCROLLVIEW_EVENT_SCROLL_TO_TOP = ccui.ScrollViewDir.none
49 | SCROLLVIEW_DIR_VERTICAL = ccui.ScrollViewDir.vertical
50 | SCROLLVIEW_DIR_HORIZONTAL = ccui.ScrollViewDir.horizontal
51 | SCROLLVIEW_DIR_BOTH = ccui.ScrollViewDir.both
52 |
53 | SCROLLVIEW_EVENT_SCROLL_TO_TOP = ccui.ScrollviewEventType.scrollToTop
54 | SCROLLVIEW_EVENT_SCROLL_TO_BOTTOM = ccui.ScrollviewEventType.scrollToBottom
55 | SCROLLVIEW_EVENT_SCROLL_TO_LEFT = ccui.ScrollviewEventType.scrollToLeft
56 | SCROLLVIEW_EVENT_SCROLL_TO_RIGHT = ccui.ScrollviewEventType.scrollToRight
57 | SCROLLVIEW_EVENT_SCROLLING = ccui.ScrollviewEventType.scrolling
58 | SCROLLVIEW_EVENT_BOUNCE_TOP = ccui.ScrollviewEventType.bounceTop
59 | SCROLLVIEW_EVENT_BOUNCE_BOTTOM = ccui.ScrollviewEventType.bounceBottom
60 | SCROLLVIEW_EVENT_BOUNCE_LEFT = ccui.ScrollviewEventType.bounceLeft
61 | SCROLLVIEW_EVENT_BOUNCE_RIGHT = ccui.ScrollviewEventType.bounceRight
62 | SCROLLVIEW_EVENT_CONTAINER_MOVED = ccui.ScrollviewEventType.containerMoved
63 | SCROLLVIEW_EVENT_AUTOSCROLL_ENDED = ccui.ScrollviewEventType.autoscrollEnded
64 |
65 | PAGEVIEW_EVENT_TURNING = ccui.PageViewEventType.turning
66 |
67 | PAGEVIEW_TOUCHLEFT = ccui.PVTouchDir.touch_left
68 | PAGEVIEW_TOUCHRIGHT = ccui.PVTouchDir.touch_right
69 |
70 | LISTVIEW_DIR_NONE = ccui.ListViewDirection.none
71 | LISTVIEW_DIR_VERTICAL = ccui.ListViewDirection.vertical
72 | LISTVIEW_DIR_HORIZONTAL = ccui.ListViewDirection.horizontal
73 |
74 | LISTVIEW_MOVE_DIR_NONE = ccui.ListViewMoveDirection.none
75 | LISTVIEW_MOVE_DIR_UP = ccui.ListViewMoveDirection.up
76 | LISTVIEW_MOVE_DIR_DOWN = ccui.ListViewMoveDirection.down
77 | LISTVIEW_MOVE_DIR_LEFT = ccui.ListViewMoveDirection.left
78 | LISTVIEW_MOVE_DIR_RIGHT = ccui.ListViewMoveDirection.right
79 |
80 | LISTVIEW_EVENT_INIT_CHILD = ccui.ListViewEventType.init_child
81 | LISTVIEW_EVENT_UPDATE_CHILD = ccui.ListViewEventType.update_child
82 |
83 | LAYOUT_PARAMETER_NONE = ccui.LayoutParameterType.none
84 | LAYOUT_PARAMETER_LINEAR = ccui.LayoutParameterType.linear
85 | LAYOUT_PARAMETER_RELATIVE = ccui.LayoutParameterType.relative
86 |
87 | ccui.LoadingBarType = ccui.LoadingBarDirection
88 | ccui.LoadingBarType.left = ccui.LoadingBarDirection.LEFT
89 | ccui.LoadingBarType.right = ccui.LoadingBarDirection.RIGHT
90 |
91 | ccui.LayoutType.absolute = ccui.LayoutType.ABSOLUTE
92 | ccui.LayoutType.linearVertical = ccui.LayoutType.VERTICAL
93 | ccui.LayoutType.linearHorizontal = ccui.LayoutType.HORIZONTAL
94 | ccui.LayoutType.relative = ccui.LayoutType.RELATIVE
95 |
96 | ccui.ListViewEventType.onsSelectedItem = ccui.ListViewEventType.ONSELECTEDITEM_START
97 |
--------------------------------------------------------------------------------
/src/cocos/ui/GuiConstants.lua:
--------------------------------------------------------------------------------
1 | if nil == ccui then
2 | return
3 | end
4 |
5 | ccui.BrightStyle =
6 | {
7 | none = -1,
8 | normal = 0,
9 | highlight = 1,
10 | }
11 |
12 | ccui.TextureResType =
13 | {
14 | localType = 0,
15 | plistType = 1,
16 | }
17 |
18 | ccui.TouchEventType =
19 | {
20 | began = 0,
21 | moved = 1,
22 | ended = 2,
23 | canceled = 3,
24 | }
25 |
26 | ccui.SizeType =
27 | {
28 | absolute = 0,
29 | percent = 1,
30 | }
31 |
32 | ccui.PositionType = {
33 | absolute = 0,
34 | percent = 1,
35 | }
36 |
37 | ccui.CheckBoxEventType =
38 | {
39 | selected = 0,
40 | unselected = 1,
41 | }
42 |
43 | ccui.RadioButtonEventType=
44 | {
45 | selected = 0,
46 | unselected = 1
47 | }
48 |
49 | ccui.RadioButtonGroupEventType=
50 | {
51 | select_changed = 0
52 | }
53 |
54 | ccui.TextFiledEventType =
55 | {
56 | attach_with_ime = 0,
57 | detach_with_ime = 1,
58 | insert_text = 2,
59 | delete_backward = 3,
60 | }
61 |
62 | ccui.LayoutBackGroundColorType =
63 | {
64 | none = 0,
65 | solid = 1,
66 | gradient = 2,
67 | }
68 |
69 | ccui.LayoutType =
70 | {
71 | ABSOLUTE = 0,
72 | VERTICAL = 1,
73 | HORIZONTAL = 2,
74 | RELATIVE = 3,
75 | }
76 |
77 | ccui.LayoutParameterType =
78 | {
79 | none = 0,
80 | linear = 1,
81 | relative = 2,
82 | }
83 |
84 | ccui.LinearGravity =
85 | {
86 | none = 0,
87 | left = 1,
88 | top = 2,
89 | right = 3,
90 | bottom = 4,
91 | centerVertical = 5,
92 | centerHorizontal = 6,
93 | }
94 |
95 | ccui.RelativeAlign =
96 | {
97 | alignNone = 0,
98 | alignParentTopLeft = 1,
99 | alignParentTopCenterHorizontal = 2,
100 | alignParentTopRight = 3,
101 | alignParentLeftCenterVertical = 4,
102 | centerInParent = 5,
103 | alignParentRightCenterVertical = 6,
104 | alignParentLeftBottom = 7,
105 | alignParentBottomCenterHorizontal = 8,
106 | alignParentRightBottom = 9,
107 | locationAboveLeftAlign = 10,
108 | locationAboveCenter = 11,
109 | locationAboveRightAlign = 12,
110 | locationLeftOfTopAlign = 13,
111 | locationLeftOfCenter = 14,
112 | locationLeftOfBottomAlign = 15,
113 | locationRightOfTopAlign = 16,
114 | locationRightOfCenter = 17,
115 | locationRightOfBottomAlign = 18,
116 | locationBelowLeftAlign = 19,
117 | locationBelowCenter = 20,
118 | locationBelowRightAlign = 21,
119 | }
120 |
121 | ccui.SliderEventType = {
122 | percentChanged = 0,
123 | slideBallDown = 1,
124 | slideBallUp = 2,
125 | slideBallCancel = 3
126 | }
127 |
128 | ccui.LoadingBarDirection = { LEFT = 0, RIGHT = 1}
129 |
130 | ccui.ScrollViewDir = {
131 | none = 0,
132 | vertical = 1,
133 | horizontal = 2,
134 | both = 3,
135 | }
136 |
137 | ccui.ScrollViewMoveDir = {
138 | none = 0,
139 | up = 1,
140 | down = 2,
141 | left = 3,
142 | right = 4,
143 | }
144 |
145 | ccui.ScrollviewEventType = {
146 | scrollToTop = 0,
147 | scrollToBottom = 1,
148 | scrollToLeft = 2,
149 | scrollToRight = 3,
150 | scrolling = 4,
151 | bounceTop = 5,
152 | bounceBottom = 6,
153 | bounceLeft = 7,
154 | bounceRight = 8,
155 | containerMoved = 9,
156 | autoscrollEnded = 10,
157 | }
158 |
159 | ccui.ListViewDirection = {
160 | none = 0,
161 | vertical = 1,
162 | horizontal = 2,
163 | }
164 |
165 | ccui.ListViewMoveDirection = {
166 | none = 0,
167 | up = 1,
168 | down = 2,
169 | left = 3,
170 | right = 4,
171 | }
172 |
173 | ccui.ListViewEventType = {
174 | ONSELECTEDITEM_START = 0,
175 | ONSELECTEDITEM_END = 1,
176 | }
177 |
178 | ccui.PageViewEventType = {
179 | turning = 0,
180 | }
181 |
182 | ccui.PageViewDirection = {
183 | NONE = 0,
184 | VERTICAL = 1,
185 | HORIZONTAL = 2,
186 | BOTH = 3
187 | }
188 |
189 | ccui.PVTouchDir = {
190 | touchLeft = 0,
191 | touchRight = 1,
192 | touchUp = 2,
193 | touchDown = 3
194 | }
195 |
196 | ccui.ListViewGravity = {
197 | left = 0,
198 | right = 1,
199 | centerHorizontal = 2,
200 | top = 3,
201 | bottom = 4 ,
202 | centerVertical = 5,
203 | }
204 |
205 | ccui.TextType = {
206 | SYSTEM = 0,
207 | TTF = 1,
208 | }
209 |
210 | ccui.LayoutComponent.HorizontalEdge = {
211 | None = 0,
212 | Left = 1,
213 | Right = 2,
214 | Center = 3,
215 | }
216 |
217 | ccui.LayoutComponent.VerticalEdge = {
218 | None = 0,
219 | Bottom = 1,
220 | Top = 2,
221 | Center = 3,
222 | }
223 |
--------------------------------------------------------------------------------
/src/cocos/ui/experimentalUIConstants.lua:
--------------------------------------------------------------------------------
1 | if nil == ccexp then
2 | return
3 | end
4 |
5 | ccexp.VideoPlayerEvent = {
6 | PLAYING = 0,
7 | PAUSED = 1,
8 | STOPPED= 2,
9 | COMPLETED =3,
10 | }
11 |
--------------------------------------------------------------------------------
/src/star.lua:
--------------------------------------------------------------------------------
1 | local config = require("config")
2 | local M = {}
3 | M.stars = {}
4 |
5 | local function newStar(starID)
6 | local starConfig = config.stars[starID]
7 | local color = config.colors[starConfig.color]
8 | local star = {}
9 | star.id = starID
10 | star.pos = {x = starConfig.x , y = starConfig.y}
11 | star.color = cc.c4f(color[1],color[2],color[3],color[4])
12 | star.r = 2
13 | return star
14 | end
15 |
16 | function M.OnStars(event)
17 | for k,v in pairs(event.stars) do
18 | local i = k - 1
19 | for j = 0,31 do
20 | if bit.band(bit.lshift(1,j),v) ~= 0 then
21 | local starID = i * 32 + j + 1
22 | M.stars[starID] = newStar(starID)
23 | end
24 | end
25 | end
26 |
27 | --[[ lua53
28 | for k,v in pairs(stars) do
29 | local i = k - 1
30 | for j = 0,31 do
31 | if (1 << j) > 0 then
32 | local starID = i * 32 + j + 1
33 | M.stars[starID] = newStar(starID)
34 | end
35 | end
36 | end
37 | ]]
38 |
39 | end
40 |
41 | function M.OnStarDead(event)
42 | for k,v in pairs(event.stars) do
43 | M.stars[v] = nil
44 | end
45 | --M.stars[event.id] = nil
46 | end
47 |
48 | function M.OnStarRelive(event)
49 | for k,v in pairs(event.stars) do
50 | M.stars[v] = newStar(v)
51 | end
52 | end
53 |
54 | function M.Render(scene)
55 | for k,v in pairs(M.stars) do
56 | local viewPortPos = scene:world2ViewPort(v.pos)
57 | if scene:isInViewPort(viewPortPos) then
58 | local screenPos = scene:viewPort2Screen(viewPortPos)
59 | --只有在屏幕内的星星才渲染
60 | scene.drawer:drawSolidCircle(cc.p(screenPos.x ,screenPos.y), v.r * scene.scaleFactor, math.pi/2, 50, 1.0, 1.0, v.color)
61 | end
62 | end
63 | end
64 |
65 | return M
--------------------------------------------------------------------------------
/src/util.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 | M.point2D = {}
3 | M.vector2D = {}
4 | M.velocity = {}
5 | M.PI = 3.1415926
6 |
7 | function M.min(a,b)
8 | return a < b and a or b
9 | end
10 |
11 | function M.max(a,b)
12 | return a > b and a or b
13 | end
14 |
15 | function M.point2D.new(x,y)
16 | return {x=x,y=y}
17 | end
18 |
19 | function M.point2D.equal(p1,p2)
20 | return p1.x == p2.x and p1.y == p2.y
21 | end
22 |
23 | function M.point2D.distance(p1,p2)
24 | local xx = p1.x - p2.x
25 | local yy = p1.y - p2.y
26 | return math.sqrt(xx * xx + yy * yy)
27 | end
28 |
29 | function M.point2D.distancePow2(p1,p2)
30 | local xx = p1.x - p2.x
31 | local yy = p1.y - p2.y
32 | return xx * xx + yy * yy
33 | end
34 |
35 | function M.point2D.moveto(p,dir,distance,leftBottom,topRight)
36 | local target = {x = p.x , y = p.y}
37 | local rad = M.PI/180*dir
38 | target.x = target.x + distance * math.cos(rad)
39 | target.y = target.y + distance * math.sin(rad)
40 |
41 | if leftBottom then
42 | target.x = math.max(leftBottom.x , target.x)
43 | target.y = math.max(leftBottom.y , target.y)
44 | end
45 |
46 | if topRight then
47 | target.x = math.min(topRight.x , target.x)
48 | target.y = math.min(topRight.y , target.y)
49 | end
50 |
51 | return target
52 | end
53 |
54 | local vector2D = {}
55 | vector2D.__index = vector2D
56 | vector2D.__vector2D = true
57 |
58 | local function isTypeVector2D(o)
59 | return type(o) == "table" and o.__vector2D
60 | end
61 |
62 | vector2D.__add = function (p1,p2)
63 | if isTypeVector2D(p1) and isTypeVector2D(p2) then
64 | return M.vector2D.new(p1.x + p2.x, p1.y + p2.y)
65 | else
66 | return nil
67 | end
68 | end
69 |
70 | vector2D.__sub = function (p1,p2)
71 | if isTypeVector2D(p1) and isTypeVector2D(p2) then
72 | return M.vector2D.new(p1.x - p2.x, p1.y - p2.y)
73 | else
74 | return nil
75 | end
76 | end
77 |
78 | vector2D.__mul = function (p1,p2)
79 | if isTypeVector2D(p1) and type(p2) == "number" then
80 | return M.vector2D.new(p1.x * p2, p1.y * p2)
81 | end
82 | return nil
83 | end
84 |
85 | vector2D.__div = function (p1,p2)
86 | if isTypeVector2D(p1) and type(p2) == "number" then
87 | return M.vector2D.new(p1.x / p2, p1.y / p2)
88 | else
89 | return nil
90 | end
91 | end
92 |
93 | vector2D.__eq = function(p1,p2)
94 | if isTypeVector2D(p1) and isTypeVector2D(p2) then
95 | return p1.x == p2.x and p1.y == p2.y
96 | else
97 | return false
98 | end
99 | end
100 |
101 | function M.vector2D.new(x,y)
102 | local o = {}
103 | o = setmetatable(o,vector2D)
104 | o.x = x
105 | o.y = y
106 | return o
107 | end
108 |
109 | --向量去模
110 | function vector2D:mag()
111 | return math.sqrt(self.x * self.x + self.y * self.y);
112 | end
113 |
114 | --标准化向量
115 | function vector2D:normalize()
116 | local len = math.sqrt(self.x * self.x + self.y * self.y)
117 | return self/len
118 | end
119 |
120 | --向量点乘
121 | function vector2D:dotProduct(other)
122 | return M.vector2D.new(self.x * other.x, self.y * v2.y)
123 | end
124 |
125 | function vector2D:copy()
126 | return M.vector2D.new(self.x,self.y)
127 | end
128 |
129 | function vector2D:getDirAngle()
130 | return math.fmod((((math.atan(self.y,self.x)*180)/M.PI) + 360) , 360)
131 |
132 | end
133 |
134 | local velocity = {}
135 | velocity.__index = velocity
136 |
137 | if not math.maxinteger then
138 | math.maxinteger = 0xffffffff
139 | end
140 |
141 | function M.velocity.new(v0,v1,accelerateTime,duration)
142 | local o = {}
143 | o = setmetatable(o,velocity)
144 | o.runTime = 0
145 | v1 = v1 or v0
146 | accelerateTime = accelerateTime or 0
147 | o.duration = duration or math.maxinteger
148 | o.accRemain = 0
149 | if not (v0 == v1) and accelerateTime > 0 then
150 | --变速运动
151 | o.v = v0:copy()
152 | o.a = (v1 - v0) / (accelerateTime / 1000)
153 | o.targetV = v1:copy()
154 | o.accRemain = accelerateTime
155 | else
156 | --匀速运动
157 | o.targetV = v0:copy()
158 | o.v = v0:copy()
159 | end
160 | o.duration = M.max(o.duration,o.accRemain)
161 | return o
162 | end
163 |
164 | --更新速度分量,并返回当前速度
165 | function velocity:Update(elapse)
166 | if self.duration == 0 then
167 | return M.vector2D.new(0,0)
168 | end
169 | self.runTime = self.runTime + elapse
170 | local deltaAcc = M.min(elapse,self.accRemain)
171 | self.accRemain = self.accRemain - deltaAcc
172 | local delta = M.min(elapse,self.duration)
173 | self.duration = self.duration - delta
174 |
175 | if self.accRemain > 0 then
176 | --变速运动尚未完成
177 | local lastV = self.v:copy()
178 | self.v = self.v + (self.a * deltaAcc/1000)
179 | return (lastV + self.v)/2
180 | else
181 | local backV = self.v:copy()
182 | self.v = self.targetV:copy()
183 | if deltaAcc > 0 then
184 | return (backV + self.targetV) / 2 * (deltaAcc/elapse) + self.targetV * ((delta-deltaAcc)/elapse)
185 | else
186 | return (backV + self.targetV) / 2 * (delta/elapse)
187 | end
188 | end
189 | end
190 |
191 | function velocity:Pack(tt)
192 | local t = {}
193 | t.accRemain = self.accRemain
194 | t.duration = self.duration
195 | t.v = {x = self.v.x , y = self.v.y}
196 | t.targetV = {x = self.targetV.x , y = self.targetV.y}
197 | table.insert(tt,t)
198 | end
199 |
200 | function velocity:Copy()
201 | return M.velocity.new(self.v,self.targetV,self.accRemain,self.duration)
202 | end
203 |
204 | function M.TransformV(direction,v)
205 | direction = math.modf(direction,360.0)
206 | local rad = M.PI/180.0*direction
207 | return M.vector2D.new(math.cos(rad) * v, math.sin(rad) * v)
208 | end
209 |
210 | --[[
211 | for i=0,20 do
212 | print(string.format("{%.02f,%.02f,%.02f,1},",math.random(1,100)/100,math.random(1,100)/100,math.random(1,100)/100))
213 | end
214 | ]]--
215 |
216 | return M
--------------------------------------------------------------------------------
/vccorlib120.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/vccorlib120.dll
--------------------------------------------------------------------------------
/vccorlib120d.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/vccorlib120d.dll
--------------------------------------------------------------------------------
/websockets.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/websockets.dll
--------------------------------------------------------------------------------
/ws2_32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/ws2_32.dll
--------------------------------------------------------------------------------
/zlib1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sniperHW/Agar.io-cocos-lua/73f36ec366deb5b9087b963cf9e7af747aa5c8b7/zlib1.dll
--------------------------------------------------------------------------------