mirror of https://github.com/axmolengine/axmol.git
Merge pull request #6893 from cocoscodeide/v3
update template project lua
This commit is contained in:
commit
7c7b1ce125
File diff suppressed because it is too large
Load Diff
|
@ -40,6 +40,21 @@
|
|||
"*.lua"
|
||||
]
|
||||
},
|
||||
{
|
||||
"from": "templates/lua-template-runtime/runtime/rtres",
|
||||
"to": "runtime/mac/PrebuiltRuntimeLua.app/Contents/Resources/rtres",
|
||||
"exclude": []
|
||||
},
|
||||
{
|
||||
"from": "templates/lua-template-runtime/runtime/rtres",
|
||||
"to": "runtime/ios/PrebuiltRuntimeLua.app/rtres",
|
||||
"exclude": []
|
||||
},
|
||||
{
|
||||
"from": "templates/lua-template-runtime/runtime/rtres",
|
||||
"to": "runtime/win32/rtres",
|
||||
"exclude": []
|
||||
},
|
||||
{
|
||||
"from": "cocos/scripting/lua-bindings/script",
|
||||
"to": "runtime/mac/PrebuiltRuntimeLua.app/Contents/Resources",
|
||||
|
|
|
@ -51,6 +51,13 @@ void ConfigParser::readConfig()
|
|||
{
|
||||
_initViewSize.width = objectInitView["width"].GetUint();
|
||||
_initViewSize.height = objectInitView["height"].GetUint();
|
||||
if (_initViewSize.height>_initViewSize.width)
|
||||
{
|
||||
float tmpvalue =_initViewSize.height;
|
||||
_initViewSize.height = _initViewSize.width;
|
||||
_initViewSize.width = tmpvalue;
|
||||
}
|
||||
|
||||
}
|
||||
if (objectInitView.HasMember("name") && objectInitView["name"].IsString())
|
||||
{
|
||||
|
|
|
@ -99,50 +99,114 @@ bool reloadScript(const string& modulefile)
|
|||
class ConnectWaitLayer: public Layer
|
||||
{
|
||||
private:
|
||||
LabelTTF* pLabelUploadFile;
|
||||
Label* _labelUploadFile;
|
||||
public:
|
||||
|
||||
ConnectWaitLayer()
|
||||
{
|
||||
int designWidth = 1280;
|
||||
int designHeight = 800;
|
||||
Director::getInstance()->getOpenGLView()->setDesignResolutionSize(designWidth,designHeight,ResolutionPolicy::EXACT_FIT);
|
||||
string playEnbleFile = "rtres/Play1.png";
|
||||
string shineFile = "rtres/shine.png";
|
||||
string backgroundFile = "rtres/landscape.png";
|
||||
if (!ConfigParser::getInstance()->isLanscape())
|
||||
{
|
||||
backgroundFile = "rtres/portrait.png";
|
||||
Director::getInstance()->getOpenGLView()->setDesignResolutionSize(designHeight,designWidth,ResolutionPolicy::EXACT_FIT);
|
||||
}
|
||||
|
||||
auto background = Sprite::create(backgroundFile.c_str());
|
||||
if (background)
|
||||
{
|
||||
background->setAnchorPoint(Vec2(0,0));
|
||||
addChild(background,9999);
|
||||
}
|
||||
|
||||
auto playSprite = Sprite::create(playEnbleFile.c_str());
|
||||
if (playSprite)
|
||||
{
|
||||
playSprite->setPosition(Vec2(902,400));
|
||||
addChild(playSprite,9999);
|
||||
}else
|
||||
{
|
||||
auto labelPlay = LabelTTF::create("play", "Arial", 108);
|
||||
auto menuItem = MenuItemLabel::create(labelPlay, CC_CALLBACK_1(ConnectWaitLayer::playerCallback, this));
|
||||
auto menu = Menu::create(menuItem, NULL);
|
||||
|
||||
menu->setPosition( Point::ZERO );
|
||||
menuItem->setPosition(Vec2(902,400));
|
||||
if (!ConfigParser::getInstance()->isLanscape()) menuItem->setPosition(Vec2(400,500));
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
||||
auto shineSprite = Sprite::create(shineFile.c_str());
|
||||
if (shineSprite)
|
||||
{
|
||||
shineSprite->setPosition(Vec2(902,400));
|
||||
shineSprite->runAction(RepeatForever::create(Sequence::createWithTwoActions(ScaleBy::create(1.0f, 1.08f),ScaleTo::create(1.0f, 1))));
|
||||
addChild(shineSprite,9999);
|
||||
}
|
||||
|
||||
string strip = getIPAddress();
|
||||
char szIPAddress[512]={0};
|
||||
sprintf(szIPAddress, "LocalIP: %s",strip.c_str());
|
||||
auto label = LabelTTF::create(szIPAddress, "Arial", 24);
|
||||
addChild(label, 9999);
|
||||
label->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 30) );
|
||||
|
||||
string strShowMsg ="";
|
||||
sprintf(szIPAddress, "IP: %s",strip.c_str());
|
||||
auto IPlabel = Label::create(szIPAddress, "Arial", 72);
|
||||
IPlabel->setAnchorPoint(Vec2(0,0));
|
||||
int spaceSizex = 72;
|
||||
int spaceSizey = 200;
|
||||
IPlabel->setPosition( Point(VisibleRect::leftTop().x+spaceSizex, VisibleRect::top().y -spaceSizey) );
|
||||
addChild(IPlabel, 9999);
|
||||
|
||||
string strShowMsg = "waiting for file transfer ...";
|
||||
if (CC_PLATFORM_WIN32 == CC_TARGET_PLATFORM || CC_PLATFORM_MAC == CC_TARGET_PLATFORM)
|
||||
{
|
||||
strShowMsg = "waiting for debugger to connect ...";
|
||||
}else
|
||||
}
|
||||
|
||||
_labelUploadFile = Label::create(strShowMsg.c_str(), "Arial", 36);
|
||||
_labelUploadFile->setAnchorPoint(Vec2(0,0));
|
||||
_labelUploadFile->setPosition( Point(VisibleRect::leftTop().x+spaceSizex, IPlabel->getPositionY()-spaceSizex) );
|
||||
_labelUploadFile->setAlignment(TextHAlignment::LEFT);
|
||||
addChild(_labelUploadFile, 10000);
|
||||
|
||||
if (!ConfigParser::getInstance()->isLanscape())
|
||||
{
|
||||
strShowMsg = "waiting for file transfer ...";
|
||||
}
|
||||
auto labelwait = LabelTTF::create(strShowMsg.c_str(), "Arial", 22);
|
||||
addChild(labelwait, 10000);
|
||||
labelwait->setPosition( Point(VisibleRect::center().x, VisibleRect::center().y) );
|
||||
if (playSprite) playSprite->setPosition(400,500);
|
||||
if (shineSprite) shineSprite->setPosition(400,500);
|
||||
_labelUploadFile->setAlignment(TextHAlignment::LEFT);
|
||||
}
|
||||
|
||||
pLabelUploadFile = LabelTTF::create("", "Arial", 22);
|
||||
addChild(pLabelUploadFile, 10000);
|
||||
pLabelUploadFile->setPosition( Point(VisibleRect::center().x, VisibleRect::top().y - 60) );
|
||||
|
||||
auto labelPlay = LabelTTF::create("play", "Arial", 36);
|
||||
auto menuItem = MenuItemLabel::create(labelPlay, CC_CALLBACK_1(ConnectWaitLayer::playerCallback, this));
|
||||
auto menu = Menu::create(menuItem, NULL);
|
||||
if (playSprite)
|
||||
{
|
||||
auto listener = EventListenerTouchOneByOne::create();
|
||||
listener->onTouchBegan = [](Touch* touch, Event *event)->bool{
|
||||
auto target = static_cast<Sprite*>(event->getCurrentTarget());
|
||||
Vec2 point = target->convertToNodeSpace(Director::getInstance()->convertToGL(touch->getLocationInView()));
|
||||
auto rect = Rect(0, 0, target->getContentSize().width, target->getContentSize().height);
|
||||
if (!rect.containsPoint(point)) return false;
|
||||
target->stopAllActions();
|
||||
target->runAction(Sequence::createWithTwoActions(ScaleBy::create(0.05f, 0.9f),ScaleTo::create(0.125f, 1)));
|
||||
return true;
|
||||
};
|
||||
listener->onTouchEnded = [](Touch* touch, Event *event){
|
||||
auto target = static_cast<Sprite*>(event->getCurrentTarget());
|
||||
Vec2 point = target->convertToNodeSpace(Director::getInstance()->convertToGL(touch->getLocationInView()));
|
||||
auto rect = Rect(0, 0, target->getContentSize().width, target->getContentSize().height);
|
||||
if (!rect.containsPoint(point)) return;
|
||||
startScript("");
|
||||
};
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, playSprite);
|
||||
}
|
||||
|
||||
menu->setPosition( Point::ZERO );
|
||||
menuItem->setPosition( Point( VisibleRect::right().x - 50, VisibleRect::bottom().y + 25) );
|
||||
addChild(menu, 1);
|
||||
}
|
||||
|
||||
|
||||
void playerCallback(Object* sender)
|
||||
{
|
||||
startScript("");
|
||||
}
|
||||
|
||||
void showCurRcvFile(string fileName) {
|
||||
pLabelUploadFile->setString(fileName);
|
||||
_labelUploadFile->setString(fileName);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -30,6 +30,10 @@
|
|||
"from": "../../../config.json",
|
||||
"to": ""
|
||||
},
|
||||
{
|
||||
"from": "../../../runtime/rtres",
|
||||
"to": "rtres"
|
||||
},
|
||||
{
|
||||
"from": "../../cocos2d-x/external/lua/luasocket",
|
||||
"to": "",
|
||||
|
|
|
@ -128,6 +128,8 @@
|
|||
C09BA7E718BC929700A85A3E /* WorkSpaceDialog.xib in Resources */ = {isa = PBXBuildFile; fileRef = C09BA7E418BC929700A85A3E /* WorkSpaceDialog.xib */; };
|
||||
C09BA7E818BC929700A85A3E /* WorkSpaceDialogController.mm in Sources */ = {isa = PBXBuildFile; fileRef = C09BA7E618BC929700A85A3E /* WorkSpaceDialogController.mm */; };
|
||||
C09BA7EE18BCA49600A85A3E /* NSAppSheetAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = C09BA7ED18BCA49600A85A3E /* NSAppSheetAdditions.m */; };
|
||||
C0F9D4BC192F3E6A0066134A /* rtres in Resources */ = {isa = PBXBuildFile; fileRef = C0F9D4BB192F3E6A0066134A /* rtres */; };
|
||||
C0F9D4BD192F3E6A0066134A /* rtres in Resources */ = {isa = PBXBuildFile; fileRef = C0F9D4BB192F3E6A0066134A /* rtres */; };
|
||||
D6B061351803AC000077942B /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6B061341803AC000077942B /* CoreMotion.framework */; };
|
||||
F293B3CD15EB7BE500256477 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3CC15EB7BE500256477 /* QuartzCore.framework */; };
|
||||
F293B3D115EB7BE500256477 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3D015EB7BE500256477 /* OpenAL.framework */; };
|
||||
|
@ -394,6 +396,7 @@
|
|||
C09BA7E618BC929700A85A3E /* WorkSpaceDialogController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WorkSpaceDialogController.mm; sourceTree = "<group>"; };
|
||||
C09BA7EC18BCA49600A85A3E /* NSAppSheetAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSAppSheetAdditions.h; sourceTree = "<group>"; };
|
||||
C09BA7ED18BCA49600A85A3E /* NSAppSheetAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSAppSheetAdditions.m; sourceTree = "<group>"; };
|
||||
C0F9D4BB192F3E6A0066134A /* rtres */ = {isa = PBXFileReference; lastKnownFileType = folder; name = rtres; path = ../../../runtime/rtres; sourceTree = "<group>"; };
|
||||
D6B061341803AC000077942B /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
|
||||
F293B3C815EB7BE500256477 /* HelloLua iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "HelloLua iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F293B3CC15EB7BE500256477 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
|
||||
|
@ -642,6 +645,7 @@
|
|||
F293BC4615EB859D00256477 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C0F9D4BB192F3E6A0066134A /* rtres */,
|
||||
C05D1C111923449100B808A4 /* config.json */,
|
||||
C03781B718BF655400FE4F13 /* res */,
|
||||
C03781B818BF655400FE4F13 /* src */,
|
||||
|
@ -852,6 +856,7 @@
|
|||
C08D5D5D18E567C6009071A4 /* ltn12.lua in Resources */,
|
||||
C03781EC18BF656A00FE4F13 /* luaoc.lua in Resources */,
|
||||
C07828F918B4D72E00BD2287 /* MainMenu.xib in Resources */,
|
||||
C0F9D4BD192F3E6A0066134A /* rtres in Resources */,
|
||||
5023817617EBBE3400990C9B /* Icon.icns in Resources */,
|
||||
C03781D218BF656A00FE4F13 /* CCBReaderLoad.lua in Resources */,
|
||||
C08D5D5F18E567C6009071A4 /* mbox.lua in Resources */,
|
||||
|
@ -894,6 +899,7 @@
|
|||
C03781F118BF656A00FE4F13 /* StudioConstants.lua in Resources */,
|
||||
5023811F17EBBCAC00990C9B /* Icon-152.png in Resources */,
|
||||
C03781D118BF656A00FE4F13 /* CCBReaderLoad.lua in Resources */,
|
||||
C0F9D4BC192F3E6A0066134A /* rtres in Resources */,
|
||||
5023812017EBBCAC00990C9B /* Icon-57.png in Resources */,
|
||||
C03781CF18BF656A00FE4F13 /* AudioEngine.lua in Resources */,
|
||||
C03781B918BF655400FE4F13 /* res in Resources */,
|
||||
|
|
|
@ -98,16 +98,16 @@ std::string getCurAppPath(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if(!g_landscape)
|
||||
{
|
||||
float tmpvalue =width;
|
||||
width = height;
|
||||
height = tmpvalue;
|
||||
}
|
||||
|
||||
g_eglView = GLView::createWithRect([viewName cStringUsingEncoding:NSUTF8StringEncoding],cocos2d::Rect(0.0f,0.0f,width,height),frameZoomFactor);
|
||||
auto director = Director::getInstance();
|
||||
director->setOpenGLView(g_eglView);
|
||||
g_landscape = false;
|
||||
g_screenSize.width = width;
|
||||
g_screenSize.height = height;
|
||||
if (width > height)
|
||||
{
|
||||
g_landscape = true;
|
||||
}
|
||||
|
||||
window = glfwGetCocoaWindow(g_eglView->getWindow());
|
||||
[NSApp setDelegate: self];
|
||||
|
@ -124,12 +124,15 @@ void createSimulator(const char* viewName, float width, float height,bool isLand
|
|||
{
|
||||
if(g_nsAppDelegate)
|
||||
{
|
||||
if((isLandscape && height > width) || (!isLandscape && width > height))
|
||||
g_landscape = isLandscape;
|
||||
if(height > width)
|
||||
{
|
||||
float tmpvalue =width;
|
||||
width = height;
|
||||
height = tmpvalue;
|
||||
}
|
||||
g_screenSize.width = width;
|
||||
g_screenSize.height = height;
|
||||
|
||||
[g_nsAppDelegate createSimulator:[NSString stringWithUTF8String:viewName] viewWidth:width viewHeight:height factor:frameZoomFactor];
|
||||
}
|
||||
|
|
|
@ -109,9 +109,11 @@ if exist "$(OutDir)\Resource" rd /s /q "$(OutDir)\Resource"
|
|||
mkdir "$(OutDir)\Resource"
|
||||
mkdir "$(OutDir)\Resource\src"
|
||||
mkdir "$(OutDir)\Resource\res"
|
||||
mkdir "$(OutDir)\Resource\rtres"
|
||||
xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(OutDir)\Resource" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\..\src" "$(OutDir)\Resource\src" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\..\res" "$(OutDir)\Resource\res" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\..\runtime\rtres" "$(OutDir)\Resource\rtres" /e /Y
|
||||
copy "$(ProjectDir)..\..\..\config.json" "$(OutDir)\Resource\config.json" /Y
|
||||
xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(OutDir)\Resource" /e /Y</Command>
|
||||
<Message>copy files</Message>
|
||||
|
@ -165,9 +167,11 @@ if exist "$(OutDir)\Resource" rd /s /q "$(OutDir)\Resource"
|
|||
mkdir "$(OutDir)\Resource"
|
||||
mkdir "$(OutDir)\Resource\src"
|
||||
mkdir "$(OutDir)\Resource\res"
|
||||
mkdir "$(OutDir)\Resource\rtres"
|
||||
xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\lua-bindings\script" "$(OutDir)\Resource" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\..\src" "$(OutDir)\Resource\src" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\..\res" "$(OutDir)\Resource\res" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\..\runtime\rtres" "$(OutDir)\Resource\rtres" /e /Y
|
||||
copy "$(ProjectDir)..\..\..\config.json" "$(OutDir)\Resource\config.json" /Y
|
||||
xcopy "$(ProjectDir)..\..\cocos2d-x\external\lua\luasocket\*.lua" "$(OutDir)\Resource" /e /Y</Command>
|
||||
<Message>copy files</Message>
|
||||
|
|
|
@ -308,23 +308,26 @@ void createSimulator(const char* viewName, float width, float height, bool isLan
|
|||
return;
|
||||
}
|
||||
|
||||
if((isLandscape && height > width) || (!isLandscape && width > height))
|
||||
g_landscape = isLandscape;
|
||||
if(height > width)
|
||||
{
|
||||
float tmpvalue =width;
|
||||
width = height;
|
||||
height = tmpvalue;
|
||||
}
|
||||
|
||||
g_screenSize.width = width;
|
||||
g_screenSize.height = height;
|
||||
|
||||
if(!g_landscape)
|
||||
{
|
||||
float tmpvalue =width;
|
||||
width = height;
|
||||
height = tmpvalue;
|
||||
}
|
||||
|
||||
g_eglView = GLView::createWithRect(viewName,Rect(0,0,width,height),frameZoomFactor);
|
||||
auto director = Director::getInstance();
|
||||
director->setOpenGLView(g_eglView);
|
||||
g_landscape = false;
|
||||
g_screenSize.width = width;
|
||||
g_screenSize.height = height;
|
||||
if (width > height)
|
||||
{
|
||||
g_landscape = true;
|
||||
}
|
||||
|
||||
HWND hWnd=glfwGetWin32Window(g_eglView->getWindow());
|
||||
HMENU hMenu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_MENU_COCOS));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"version":"v3-lua-runtime-1.1.1",
|
||||
"zip_file_size":"20854899",
|
||||
"version":"v3-lua-runtime-1.1.2",
|
||||
"zip_file_size":"21402175",
|
||||
"repo_name":"cocos-runtime-bin",
|
||||
"repo_parent":"https://github.com/chukong/"
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
After Width: | Height: | Size: 147 KiB |
Binary file not shown.
After Width: | Height: | Size: 131 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Loading…
Reference in New Issue