-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hufan
committed
Dec 22, 2017
0 parents
commit 58db01d
Showing
293 changed files
with
42,971 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"engine_type": "prebuilt", | ||
"engine_version": "cocos2d-x-3.10", | ||
"has_native": true, | ||
"project_type": "lua" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>TestLua</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.ccdt.cocosproject</nature> | ||
<nature>org.eclipse.koneki.ldt.nature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"engineVersion": "cocos2d-x-3.10", | ||
"runtimeVersion": "2.0", | ||
"templateVersion": "2.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Solution> | ||
<PropertyGroup Name="TestLua" Version="3.10.0.0" Type="CocosStudio" /> | ||
<SolutionFolder> | ||
<Group ctype="ResourceGroup"> | ||
<RootFolder Name="."> | ||
<Image Name="HelloWorld.png" /> | ||
<Project Name="MainScene.csd" Type="Scene" /> | ||
</RootFolder> | ||
</Group> | ||
</SolutionFolder> | ||
</Solution> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<SolutionConfig Version="3.10.0.0"> | ||
<PublishDirectory Value="res/" /> | ||
<PackageDirectory Value="package/" /> | ||
<PublishType Value="Reference" /> | ||
<SolutionSize Value="960 * 640" /> | ||
<ResolutionName Value="iPhone 4/4S" /> | ||
<DefaultSerializer Value="Serializer_FlatBuffers" /> | ||
<CustomSerializer Value="Serializer_FlatBuffers" /> | ||
<IsNameStandardized Value="False" /> | ||
<CustomProperties> | ||
<Item Key="CCS_CocosPropertis"> | ||
<Value ctype="CocosProperties"> | ||
<SolutionCodeType Value="Complete" /> | ||
<ProgramLanguage Value="lua" /> | ||
<CreateFrameworkVersion Value="cocos2d-x-3.10" /> | ||
<CurrentFrameworkVersion Value="cocos2d-x-3.10" /> | ||
<EngineType Value="Prebuilt" /> | ||
</Value> | ||
</Item> | ||
</CustomProperties> | ||
</SolutionConfig> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<UserData Version="3.10.0.0"> | ||
<Properties> | ||
<Item Key="TabsParamsKey"> | ||
<Value ctype="TabsInfo"> | ||
<OpenedDocuments> | ||
<FilePathData Path="MainScene.csd" /> | ||
</OpenedDocuments> | ||
<ActiveDocument Path="MainScene.csd" /> | ||
</Value> | ||
</Item> | ||
<Item Key="CocosRecentOperation"> | ||
<Value ctype="CocosRecentOperation"> | ||
<LastPublishType Value="Resource" /> | ||
<IsLastPublish Value="True" /> | ||
<LastRunType Value="Windows" /> | ||
</Value> | ||
</Item> | ||
</Properties> | ||
</UserData> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<GameFile> | ||
<PropertyGroup Name="MainScene" Type="Scene" ID="a2ee0952-26b5-49ae-8bf9-4f1d6279b798" Version="3.10.0.0" /> | ||
<Content ctype="GameProjectContent"> | ||
<Content> | ||
<Animation Duration="0" Speed="1.0000" /> | ||
<ObjectData Name="Scene" ctype="GameNodeObjectData"> | ||
<Size X="960.0000" Y="640.0000" /> | ||
<Children> | ||
<AbstractNodeData Name="Default" ActionTag="953446860" Tag="5" IconVisible="False" ObjectIndex="2" ctype="SpriteObjectData"> | ||
<Size X="960.0000" Y="640.0000" /> | ||
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" /> | ||
<Position X="480.0000" Y="320.0000" /> | ||
<Scale ScaleX="1.0000" ScaleY="1.0000" /> | ||
<CColor A="255" R="255" G="255" B="255" /> | ||
<PrePosition X="0.5000" Y="0.5000" /> | ||
<PreSize X="0.0000" Y="0.0000" /> | ||
<FileData Type="Normal" Path="HelloWorld.png" Plist="" /> | ||
<BlendFunc Src="1" Dst="771" /> | ||
</AbstractNodeData> | ||
</Children> | ||
</ObjectData> | ||
</Content> | ||
</Content> | ||
</GameFile> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"init_cfg": { | ||
"isLandscape": true, | ||
"isWindowTop": false, | ||
"name": "TestLua", | ||
"width": 960, | ||
"height": 640, | ||
"entry": "src/main.lua", | ||
"consolePort": 6050, | ||
"uploadPort": 6060 | ||
}, | ||
"simulator_screen_size": [ | ||
{ | ||
"title": "iPhone 3Gs (480x320)", | ||
"width": 480, | ||
"height": 320 | ||
}, | ||
{ | ||
"title": "iPhone 4 (960x640)", | ||
"width": 960, | ||
"height": 640 | ||
}, | ||
{ | ||
"title": "iPhone 5 (1136x640)", | ||
"width": 1136, | ||
"height": 640 | ||
}, | ||
{ | ||
"title": "iPad (1024x768)", | ||
"width": 1024, | ||
"height": 768 | ||
}, | ||
{ | ||
"title": "iPad Retina (2048x1536)", | ||
"width": 2048, | ||
"height": 1536 | ||
}, | ||
{ | ||
"title": "Android (800x480)", | ||
"width": 800, | ||
"height": 480 | ||
}, | ||
{ | ||
"title": "Android (854x480)", | ||
"width": 854, | ||
"height": 480 | ||
}, | ||
{ | ||
"title": "Android (1280x720)", | ||
"width": 1280, | ||
"height": 720 | ||
}, | ||
{ | ||
"title": "Android (1920x1080)", | ||
"width": 1920, | ||
"height": 1080 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
#include "AppDelegate.h" | ||
#include "CCLuaEngine.h" | ||
#include "SimpleAudioEngine.h" | ||
#include "cocos2d.h" | ||
#include "lua_module_register.h" | ||
|
||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_LINUX) | ||
#include "ide-support/CodeIDESupport.h" | ||
#endif | ||
|
||
#if (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0) | ||
#include "runtime/Runtime.h" | ||
#include "ide-support/RuntimeLuaImpl.h" | ||
#endif | ||
|
||
using namespace CocosDenshion; | ||
|
||
USING_NS_CC; | ||
using namespace std; | ||
|
||
AppDelegate::AppDelegate() | ||
{ | ||
} | ||
|
||
AppDelegate::~AppDelegate() | ||
{ | ||
SimpleAudioEngine::end(); | ||
|
||
#if (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0) | ||
// NOTE:Please don't remove this call if you want to debug with Cocos Code IDE | ||
RuntimeEngine::getInstance()->end(); | ||
#endif | ||
|
||
} | ||
|
||
//if you want a different context,just modify the value of glContextAttrs | ||
//it will takes effect on all platforms | ||
void AppDelegate::initGLContextAttrs() | ||
{ | ||
//set OpenGL context attributions,now can only set six attributions: | ||
//red,green,blue,alpha,depth,stencil | ||
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8}; | ||
|
||
GLView::setGLContextAttrs(glContextAttrs); | ||
} | ||
|
||
// If you want to use packages manager to install more packages, | ||
// don't modify or remove this function | ||
static int register_all_packages() | ||
{ | ||
return 0; //flag for packages manager | ||
} | ||
|
||
bool AppDelegate::applicationDidFinishLaunching() | ||
{ | ||
// set default FPS | ||
Director::getInstance()->setAnimationInterval(1.0 / 60.0f); | ||
|
||
// register lua module | ||
auto engine = LuaEngine::getInstance(); | ||
ScriptEngineManager::getInstance()->setScriptEngine(engine); | ||
lua_State* L = engine->getLuaStack()->getLuaState(); | ||
lua_module_register(L); | ||
engine->executeString("print = release_print"); | ||
register_all_packages(); | ||
|
||
LuaStack* stack = engine->getLuaStack(); | ||
stack->setXXTEAKeyAndSign("2dxLua", strlen("2dxLua"), "XXTEA", strlen("XXTEA")); | ||
|
||
//register custom function | ||
//LuaStack* stack = engine->getLuaStack(); | ||
//register_custom_function(stack->getLuaState()); | ||
|
||
#if (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0) | ||
// NOTE:Please don't remove this call if you want to debug with Cocos Code IDE | ||
auto runtimeEngine = RuntimeEngine::getInstance(); | ||
runtimeEngine->addRuntime(RuntimeLuaImpl::create(), kRuntimeEngineLua); | ||
runtimeEngine->start(); | ||
#else | ||
if (engine->executeScriptFile("src/main.lua")) | ||
{ | ||
return false; | ||
} | ||
#endif | ||
|
||
return true; | ||
} | ||
|
||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too | ||
void AppDelegate::applicationDidEnterBackground() | ||
{ | ||
Director::getInstance()->stopAnimation(); | ||
|
||
SimpleAudioEngine::getInstance()->pauseBackgroundMusic(); | ||
} | ||
|
||
// this function will be called when the app is active again | ||
void AppDelegate::applicationWillEnterForeground() | ||
{ | ||
Director::getInstance()->startAnimation(); | ||
|
||
SimpleAudioEngine::getInstance()->resumeBackgroundMusic(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef __APP_DELEGATE_H__ | ||
#define __APP_DELEGATE_H__ | ||
|
||
#include "cocos2d.h" | ||
|
||
/** | ||
@brief The cocos2d Application. | ||
The reason for implement as private inheritance is to hide some interface call by Director. | ||
*/ | ||
class AppDelegate : private cocos2d::Application | ||
{ | ||
public: | ||
AppDelegate(); | ||
virtual ~AppDelegate(); | ||
|
||
virtual void initGLContextAttrs(); | ||
|
||
/** | ||
@brief Implement Director and Scene init code here. | ||
@return true Initialize success, app continue. | ||
@return false Initialize failed, app terminate. | ||
*/ | ||
virtual bool applicationDidFinishLaunching(); | ||
|
||
/** | ||
@brief The function be called when the application enter background | ||
@param the pointer of the application | ||
*/ | ||
virtual void applicationDidEnterBackground(); | ||
|
||
/** | ||
@brief The function be called when the application enter foreground | ||
@param the pointer of the application | ||
*/ | ||
virtual void applicationWillEnterForeground(); | ||
}; | ||
|
||
#endif // __APP_DELEGATE_H__ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef __CODE_IDE_SUPPORT_H__ | ||
#define __CODE_IDE_SUPPORT_H__ | ||
|
||
// define 1 to open Cocos Code IDE support, 0 to disable | ||
#define CC_CODE_IDE_DEBUG_SUPPORT 0 | ||
|
||
#endif /* __CODE_IDE_SUPPORT_H__ */ |
Oops, something went wrong.