mirror of https://github.com/axmolengine/axmol.git
Merge https://github.com/cocos2d/cocos2d-x into iss1489-AssetsManager
This commit is contained in:
commit
1ae332ac0b
6
AUTHORS
6
AUTHORS
|
@ -206,6 +206,12 @@ Developers:
|
|||
ThePickleMan
|
||||
Adding 'rotationIsDir' property to ParticleSystem.
|
||||
|
||||
Jianghua (jxhgzs)
|
||||
Adding an additional transform for CCNode.
|
||||
|
||||
giginet
|
||||
Fix CCRepeat#create is recieved bad argument on Lua binding.
|
||||
|
||||
Retired Core Developers:
|
||||
WenSheng Yang
|
||||
Author of windows port, CCTextField,
|
||||
|
|
|
@ -86,6 +86,8 @@ CCNode::CCNode(void)
|
|||
, m_uOrderOfArrival(0)
|
||||
, m_eGLServerState(ccGLServerState(0))
|
||||
, m_bReorderChildDirty(false)
|
||||
, m_sAdditionalTransform(CCAffineTransformMakeIdentity())
|
||||
, m_bAdditionalTransformDirty(false)
|
||||
{
|
||||
// set default scheduler and actionManager
|
||||
CCDirector *director = CCDirector::sharedDirector();
|
||||
|
@ -1158,6 +1160,12 @@ CCAffineTransform CCNode::nodeToParentTransform(void)
|
|||
m_sTransform = CCAffineTransformTranslate(m_sTransform, -m_obAnchorPointInPoints.x, -m_obAnchorPointInPoints.y);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bAdditionalTransformDirty)
|
||||
{
|
||||
m_sTransform = CCAffineTransformConcat(m_sTransform, m_sAdditionalTransform);
|
||||
m_bAdditionalTransformDirty = false;
|
||||
}
|
||||
|
||||
m_bTransformDirty = false;
|
||||
}
|
||||
|
@ -1165,6 +1173,13 @@ CCAffineTransform CCNode::nodeToParentTransform(void)
|
|||
return m_sTransform;
|
||||
}
|
||||
|
||||
void CCNode::setAdditionalTransform(const CCAffineTransform& additionalTransform)
|
||||
{
|
||||
m_sAdditionalTransform = additionalTransform;
|
||||
m_bTransformDirty = true;
|
||||
m_bAdditionalTransformDirty = true;
|
||||
}
|
||||
|
||||
CCAffineTransform CCNode::parentToNodeTransform(void)
|
||||
{
|
||||
if ( m_bInverseDirty ) {
|
||||
|
|
|
@ -1256,6 +1256,55 @@ public:
|
|||
*/
|
||||
CCPoint convertTouchToNodeSpaceAR(CCTouch * touch);
|
||||
|
||||
/**
|
||||
* Sets the additional transform.
|
||||
*
|
||||
* @note The additional transform will be concatenated at the end of nodeToParentTransform.
|
||||
* It could be used to simulate `parent-child` relationship between two nodes (e.g. one is in BatchNode, another isn't).
|
||||
* @code
|
||||
// create a batchNode
|
||||
CCSpriteBatchNode* batch= CCSpriteBatchNode::create("Icon-114.png");
|
||||
this->addChild(batch);
|
||||
|
||||
// create two sprites, spriteA will be added to batchNode, they are using different textures.
|
||||
CCSprite* spriteA = CCSprite::createWithTexture(batch->getTexture());
|
||||
CCSprite* spriteB = CCSprite::create("Icon-72.png");
|
||||
|
||||
batch->addChild(spriteA);
|
||||
|
||||
// We can't make spriteB as spriteA's child since they use different textures. So just add it to layer.
|
||||
// But we want to simulate `parent-child` relationship for these two node.
|
||||
this->addChild(spriteB);
|
||||
|
||||
//position
|
||||
spriteA->setPosition(ccp(200, 200));
|
||||
|
||||
// Gets the spriteA's transform.
|
||||
CCAffineTransform t = spriteA->nodeToParentTransform();
|
||||
|
||||
// Sets the additional transform to spriteB, spriteB's postion will based on its pseudo parent i.e. spriteA.
|
||||
spriteB->setAdditionalTransform(t);
|
||||
|
||||
//scale
|
||||
spriteA->setScale(2);
|
||||
|
||||
// Gets the spriteA's transform.
|
||||
t = spriteA->nodeToParentTransform();
|
||||
|
||||
// Sets the additional transform to spriteB, spriteB's scale will based on its pseudo parent i.e. spriteA.
|
||||
spriteB->setAdditionalTransform(t);
|
||||
|
||||
//rotation
|
||||
spriteA->setRotation(20);
|
||||
|
||||
// Gets the spriteA's transform.
|
||||
t = spriteA->nodeToParentTransform();
|
||||
|
||||
// Sets the additional transform to spriteB, spriteB's rotation will based on its pseudo parent i.e. spriteA.
|
||||
spriteB->setAdditionalTransform(t);
|
||||
* @endcode
|
||||
*/
|
||||
void setAdditionalTransform(const CCAffineTransform& additionalTransform);
|
||||
/// @} end of Coordinate Converters
|
||||
|
||||
private:
|
||||
|
@ -1290,6 +1339,8 @@ protected:
|
|||
|
||||
CCSize m_obContentSize; ///< untransformed size of the node
|
||||
|
||||
|
||||
CCAffineTransform m_sAdditionalTransform; ///< transform
|
||||
CCAffineTransform m_sTransform; ///< transform
|
||||
CCAffineTransform m_sInverse; ///< transform
|
||||
|
||||
|
@ -1321,7 +1372,7 @@ protected:
|
|||
|
||||
bool m_bTransformDirty; ///< transform dirty flag
|
||||
bool m_bInverseDirty; ///< transform dirty flag
|
||||
|
||||
bool m_bAdditionalTransformDirty; ///< The flag to check whether the additional transform is dirty
|
||||
bool m_bVisible; ///< is this node visible
|
||||
|
||||
bool m_bIgnoreAnchorPointForPosition; ///< true if the Anchor Point will be (0,0) when you position the CCNode, false otherwise.
|
||||
|
|
|
@ -52,20 +52,6 @@ void CCApplication::setAnimationInterval(double interval)
|
|||
}
|
||||
}
|
||||
|
||||
CCApplication::Orientation CCApplication::setOrientation(Orientation orientation)
|
||||
{
|
||||
return orientation;
|
||||
}
|
||||
|
||||
//void CCApplication::statusBarFrame(CCRect * rect)
|
||||
//{
|
||||
// if (rect)
|
||||
// {
|
||||
// // android doesn't have status bar.
|
||||
// *rect = CCRectMake(0, 0, 0, 0);
|
||||
// }
|
||||
//}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// static member function
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -20,25 +20,6 @@ public:
|
|||
*/
|
||||
void setAnimationInterval(double interval);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/// Device oriented vertically, home button on the bottom
|
||||
kOrientationPortrait = 0,
|
||||
/// Device oriented vertically, home button on the top
|
||||
kOrientationPortraitUpsideDown = 1,
|
||||
/// Device oriented horizontally, home button on the right
|
||||
kOrientationLandscapeLeft = 2,
|
||||
/// Device oriented horizontally, home button on the left
|
||||
kOrientationLandscapeRight = 3,
|
||||
} Orientation;
|
||||
|
||||
/**
|
||||
@brief Callback by CCDirector to change device orientation.
|
||||
@orientation The desired orientation.
|
||||
@return The actual orientation of the application.
|
||||
*/
|
||||
Orientation setOrientation(Orientation orientation);
|
||||
|
||||
/**
|
||||
@brief Run the message loop.
|
||||
*/
|
||||
|
|
|
@ -75,11 +75,6 @@ void CCApplication::setAnimationInterval(double interval)
|
|||
m_animationInterval = (long)(interval * 1000);
|
||||
}
|
||||
|
||||
CCApplication::Orientation CCApplication::setOrientation(Orientation orientation)
|
||||
{
|
||||
return orientation;
|
||||
}
|
||||
|
||||
void CCApplication::setResourceRootPath(const std::string& rootResDir)
|
||||
{
|
||||
m_resourceRootPath = rootResDir;
|
||||
|
|
|
@ -20,26 +20,6 @@ public:
|
|||
*/
|
||||
void setAnimationInterval(double interval);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/// Device oriented vertically, home button on the bottom
|
||||
kOrientationPortrait = 0,
|
||||
/// Device oriented vertically, home button on the top
|
||||
kOrientationPortraitUpsideDown = 1,
|
||||
/// Device oriented horizontally, home button on the right
|
||||
kOrientationLandscapeLeft = 2,
|
||||
/// Device oriented horizontally, home button on the left
|
||||
kOrientationLandscapeRight = 3,
|
||||
} Orientation;
|
||||
|
||||
/**
|
||||
@brief Callback by CCDirector for change device orientation.
|
||||
@orientation The defination of orientation which CCDirector want change to.
|
||||
@return The actual orientation of the application.
|
||||
*/
|
||||
Orientation setOrientation(Orientation orientation);
|
||||
|
||||
|
||||
/**
|
||||
@brief Run the message loop.
|
||||
*/
|
||||
|
|
|
@ -11,6 +11,6 @@ if exist %SCRIPT_LOG% del /Q %SCRIPT_LOG%
|
|||
cscript "%SCRIPT_DIR%InstallWizardForVC2010Express.js" /quiet
|
||||
cscript "%SCRIPT_DIR%InstallWizardForVS2010.js" /quiet
|
||||
cscript "%SCRIPT_DIR%InstallWizardForVS2012.js" /quiet
|
||||
cscript "%SCRIPT_DIR%InstallWizardForVS2012Express.js" /quiet
|
||||
if exist %SCRIPT_LOG% more %SCRIPT_LOG%
|
||||
if exist %SCRIPT_LOG% del /Q %SCRIPT_LOG%
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 4a4ce5f098c96c66f501a079491215a5904607b6
|
||||
Subproject commit cc6d8acc731c5a6970e96cc2ba231718ba693dfc
|
|
@ -1 +1 @@
|
|||
Subproject commit e5db85664c005aaae02e9dac7970b2e3c3adbe47
|
||||
Subproject commit a4cf50ac9b5541a1ba948bb459fa5bf7b4917e65
|
|
@ -1 +1 @@
|
|||
4ef84aca8211b93637bba858faf4883704dca5ae
|
||||
f0dfb853e96eda746fe727b5984febf65ffb2d65
|
|
@ -0,0 +1,239 @@
|
|||
// Setup program for the Cocos2d-win32 App Wizard for VC++ 11.0 (VC2012)
|
||||
|
||||
main();
|
||||
|
||||
function EchoInfo(bQuiet, strMsg) {
|
||||
if (! bQuiet) {
|
||||
WScript.Echo(strMsg);
|
||||
}
|
||||
else {
|
||||
var FileSys = new ActiveXObject("Scripting.FileSystemObject");
|
||||
var strLogPath = "InstallWizardLog.txt"
|
||||
var file = FileSys.OpenTextFile(strLogPath, 8, true);
|
||||
file.WriteLine(strMsg);
|
||||
file.Close();
|
||||
}
|
||||
}
|
||||
|
||||
function EchoError(bQuiet, strMsg) {
|
||||
strMsg = "Error: " + strMsg;
|
||||
if (! bQuiet) {
|
||||
WScript.Echo(strMsg);
|
||||
}
|
||||
else {
|
||||
var FileSys = new ActiveXObject("Scripting.FileSystemObject");
|
||||
var strLogPath = "InstallWizardLog.txt"
|
||||
var file = FileSys.OpenTextFile(strLogPath, 8, true);
|
||||
file.WriteLine(strMsg);
|
||||
file.Close();
|
||||
}
|
||||
}
|
||||
|
||||
function main() {
|
||||
// Decode command line arguments
|
||||
var bDebug = false;
|
||||
var bQuiet = false;
|
||||
var bElevated = false;
|
||||
var Args = WScript.Arguments;
|
||||
for (var i = 0; i < Args.length; i++) {
|
||||
if (Args(i) == "/debug")
|
||||
bDebug = true;
|
||||
else if (Args(i) == "/elevated")
|
||||
bElevated = true;
|
||||
else if (Args(i) == "/quiet")
|
||||
bQuiet = true;
|
||||
}
|
||||
|
||||
// See if UAC is enabled
|
||||
var Shell = WScript.CreateObject("Shell.Application");
|
||||
if (!bElevated && Shell.IsRestricted("System", "EnableLUA")) {
|
||||
// Check that the script is being run interactively.
|
||||
if (!WScript.Interactive) {
|
||||
EchoError(bQuiet, "(Windows LUA) Elevation required.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Now relaunch the script, using the "RunAs" verb to elevate
|
||||
var strParams = "\"" + WScript.ScriptFullName + "\"";
|
||||
if (bDebug)
|
||||
strParams += " /debug";
|
||||
strParams += " /elevated";
|
||||
Shell.ShellExecute(WScript.FullName, strParams, null, "RunAs");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create shell object
|
||||
var WSShell = WScript.CreateObject("WScript.Shell");
|
||||
// Create file system object
|
||||
var FileSys = WScript.CreateObject("Scripting.FileSystemObject");
|
||||
|
||||
// Get the folder containing the script file
|
||||
var strScriptPath = FileSys.GetParentFolderName(WScript.ScriptFullName);
|
||||
if (strScriptPath == null || strScriptPath == "")
|
||||
strScriptPath = ".";
|
||||
|
||||
// Get the folder script files copy to
|
||||
var strValue = "";
|
||||
try {
|
||||
var strVCKey = "HKLM\\Software\\Microsoft\\VisualStudio\\11.0\\Setup\\VC\\ProductDir";
|
||||
strValue = WSShell.RegRead(strVCKey);
|
||||
}
|
||||
catch (e) {
|
||||
try {
|
||||
var strVCKey_x64 = "HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\11.0\\Setup\\VC\\ProductDir";
|
||||
strValue = WSShell.RegRead(strVCKey_x64);
|
||||
}
|
||||
catch (e) {
|
||||
EchoError(bQuiet, "Cannot find where Visual Studio Express 2012 for Windows Desktop is installed.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var strDestFolder = FileSys.BuildPath(strValue, "vcprojects_WDExpress");
|
||||
if (bDebug)
|
||||
WScript.Echo("Destination: " + strDestFolder);
|
||||
|
||||
if (!FileSys.FolderExists(strDestFolder)) {
|
||||
EchoError(bQuiet, "Cannot find destination folder (should be: " + strDestFolder + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
// Wizard Info
|
||||
var nNumWizards = 1;
|
||||
|
||||
var astrWizardName = new Array();
|
||||
astrWizardName[0] = "CCAppWiz.win32";
|
||||
|
||||
var nCntr;
|
||||
for (nCntr = 0; nCntr < nNumWizards; nCntr++) {
|
||||
var strSourceFolder = FileSys.BuildPath(strScriptPath, astrWizardName[nCntr]);
|
||||
|
||||
if (bDebug)
|
||||
WScript.Echo("Source: " + strSourceFolder);
|
||||
|
||||
if (!FileSys.FolderExists(strSourceFolder)) {
|
||||
EchoError(bQuiet, "Cannot find Wizard folder (should be: " + strSourceFolder + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy files
|
||||
try {
|
||||
var strSrc = FileSys.BuildPath(strSourceFolder, astrWizardName[nCntr] + ".ico");
|
||||
var strDest = FileSys.BuildPath(strDestFolder, astrWizardName[nCntr] + ".ico");
|
||||
FileSys.CopyFile(strSrc, strDest);
|
||||
|
||||
strSrc = FileSys.BuildPath(strSourceFolder, astrWizardName[nCntr] + ".vsdir");
|
||||
strDest = FileSys.BuildPath(strDestFolder, astrWizardName[nCntr] + ".vsdir");
|
||||
FileSys.CopyFile(strSrc, strDest);
|
||||
}
|
||||
catch (e) {
|
||||
var strError = "no info";
|
||||
if (e.description.length != 0)
|
||||
strError = e.description;
|
||||
EchoError(bQuiet, "Cannot copy file (" + strError + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
// Read and write CCAppWiz.vsz, add engine version and replace path when found
|
||||
try {
|
||||
var strSrc = FileSys.BuildPath(strSourceFolder, astrWizardName[nCntr] + ".vsz");
|
||||
var strDest = FileSys.BuildPath(strDestFolder, astrWizardName[nCntr] + ".vsz");
|
||||
|
||||
var ForReading = 1;
|
||||
var fileSrc = FileSys.OpenTextFile(strSrc, ForReading);
|
||||
if (fileSrc == null) {
|
||||
EchoError(bQuiet, "Cannot open source file: " + strSrc);
|
||||
return;
|
||||
}
|
||||
|
||||
var ForWriting = 2;
|
||||
var fileDest = FileSys.OpenTextFile(strDest, ForWriting, true);
|
||||
if (fileDest == null) {
|
||||
EchoError(bQuiet, " Cannot open destination file: " + strDest);
|
||||
return;
|
||||
}
|
||||
|
||||
while (!fileSrc.AtEndOfStream) {
|
||||
var strLine = fileSrc.ReadLine();
|
||||
if (strLine.indexOf("Wizard=VsWizard.VsWizardEngine") != -1)
|
||||
strLine += ".11.0";
|
||||
else if (strLine.indexOf("WIZARD_VERSION") != -1)
|
||||
strLine = "Param=\"WIZARD_VERSION = 11.0\"";
|
||||
else if (strLine.indexOf("ABSOLUTE_PATH") != -1)
|
||||
strLine = "Param=\"ABSOLUTE_PATH = " + strSourceFolder + "\"";
|
||||
fileDest.WriteLine(strLine);
|
||||
}
|
||||
|
||||
fileSrc.Close();
|
||||
fileDest.Close();
|
||||
}
|
||||
catch (e) {
|
||||
var strError = "no info";
|
||||
if (e.description.length != 0)
|
||||
strError = e.description;
|
||||
EchoError(bQuiet, "Cannot read and write CCAppWiz.vsz (" + strError + ")");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Create Cocos2d-x folder
|
||||
var strDestCCFolder = "";
|
||||
try {
|
||||
strDestCCFolder = FileSys.BuildPath(strDestFolder, "Cocos2d-x");
|
||||
if (!FileSys.FolderExists(strDestCCFolder))
|
||||
FileSys.CreateFolder(strDestCCFolder);
|
||||
if (bDebug)
|
||||
WScript.Echo("Cocos2d-x Folder: " + strDestCCFolder);
|
||||
}
|
||||
catch (e) {
|
||||
var strError = "no info";
|
||||
if (e.description.length != 0)
|
||||
strError = e.description;
|
||||
EchoError(bQuiet, "Cannot create Cocos2d-x folder (" + strError + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
// Read and write additional CCAppWiz.vsdir, add path to the wizard location
|
||||
try {
|
||||
var strDest = FileSys.BuildPath(strDestCCFolder, "Cocos2d-x.vsdir");
|
||||
|
||||
var ForWriting = 2;
|
||||
|
||||
var fileDest = FileSys.OpenTextFile(strDest, ForWriting, true);
|
||||
if (fileDest == null) {
|
||||
EchoError(bQuiet, "Cannot open destination file: " + strDest);
|
||||
return;
|
||||
}
|
||||
|
||||
var nCntr;
|
||||
for (nCntr = 0; nCntr < nNumWizards; nCntr++) {
|
||||
var strSourceFolder = FileSys.BuildPath(strScriptPath, astrWizardName[nCntr]);
|
||||
var strSrc = FileSys.BuildPath(strSourceFolder, astrWizardName[nCntr] + ".vsdir");
|
||||
var ForReading = 1;
|
||||
var fileSrc = FileSys.OpenTextFile(strSrc, ForReading);
|
||||
if (fileSrc == null) {
|
||||
EchoError(bQuiet, "Cannot open source file: " + strSrc);
|
||||
return;
|
||||
}
|
||||
|
||||
while (!fileSrc.AtEndOfStream) {
|
||||
var strLine = fileSrc.ReadLine();
|
||||
if (strLine.indexOf(astrWizardName[nCntr] + ".vsz|") != -1)
|
||||
strLine = "..\\" + strLine;
|
||||
fileDest.WriteLine(strLine);
|
||||
}
|
||||
|
||||
fileSrc.Close();
|
||||
}
|
||||
fileDest.Close();
|
||||
}
|
||||
catch (e) {
|
||||
var strError = "no info";
|
||||
if (e.description.length != 0)
|
||||
strError = e.description;
|
||||
EchoError(bQuiet, "Cannot read and write Cocos2d-x\\CCAppWiz.vsdir (" + strError + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
EchoInfo(bQuiet, "App Wizard successfully installed for VS2012 Express!");
|
||||
}
|
|
@ -65,13 +65,7 @@ if [ -f "$file" ]; then
|
|||
fi
|
||||
done
|
||||
|
||||
# remove test_image_rgba4444.pvr.gz
|
||||
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_image_rgba4444.pvr.gz
|
||||
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgba8888.pvr.gz
|
||||
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgb888.pvr.gz
|
||||
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgba4444.pvr.gz
|
||||
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_a8.pvr.gz
|
||||
|
||||
# run ndk-build
|
||||
if [[ "$buildexternalsfromsource" ]]; then
|
||||
echo "Building external dependencies from source"
|
||||
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
# This empty file indicates this folder as a module in python
|
||||
# Don't remove me!
|
|
@ -1,55 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# handle_project_files.py for Android
|
||||
# Copyright (c) 2012 cocos2d-x.org
|
||||
# Author: WangZhe
|
||||
|
||||
# Android
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
def handle_project_files(context):
|
||||
# determine proj_path
|
||||
proj_path = context["dst_project_path"] + "/proj.android/"
|
||||
|
||||
# rename files and folders
|
||||
src_pkg = context["src_package_name"].split('.')
|
||||
dst_pkg = context["dst_package_name"].split('.')
|
||||
|
||||
os.rename(proj_path + "src/" + src_pkg[0],
|
||||
proj_path + "src/" + dst_pkg[0])
|
||||
os.rename(proj_path + "src/" + dst_pkg[0] + "/" + src_pkg[1],
|
||||
proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1])
|
||||
os.rename(proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1] + "/" + src_pkg[2],
|
||||
proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1] + "/" + dst_pkg[2])
|
||||
os.rename(proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1] + "/" + dst_pkg[2] + "/" + context["src_project_name"] + ".java",
|
||||
proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1] + "/" + dst_pkg[2] + "/" + context["dst_project_name"] + ".java")
|
||||
|
||||
dst_java_file_path = proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1] + "/" + dst_pkg[2] + "/" + context["dst_project_name"] + ".java"
|
||||
|
||||
# remove useless files.
|
||||
removes = [
|
||||
"assets",
|
||||
"bin",
|
||||
"libs",
|
||||
"gen",
|
||||
"obj",
|
||||
]
|
||||
for i in range(0, len(removes)):
|
||||
if (os.path.exists(proj_path + removes[i]) == True):
|
||||
shutil.rmtree(proj_path + removes[i])
|
||||
|
||||
# replaceString function is implemented in ../create-project.py
|
||||
import replaces
|
||||
# package_name should be replaced at first. Don't change this sequence
|
||||
replaces.replaceString(proj_path + "AndroidManifest.xml", context["src_package_name"], context["dst_package_name"])
|
||||
replaces.replaceString(dst_java_file_path, context["src_package_name"], context["dst_package_name"])
|
||||
|
||||
replaces.replaceString(proj_path + ".project", context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(proj_path + "AndroidManifest.xml", context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(proj_path + "build.xml", context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(proj_path + "build_native.sh", context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(proj_path + "res/values/strings.xml",context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(dst_java_file_path, context["src_project_name"], context["dst_project_name"])
|
||||
# done!
|
||||
print "proj.android : Done!"
|
|
@ -1,2 +0,0 @@
|
|||
# This empty file indicates this folder as a module in python
|
||||
# Don't remove me!
|
|
@ -1,25 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# handle_project_files.py for BlackBerry
|
||||
# Copyright (c) 2012 cocos2d-x.org
|
||||
# Author: Zhe WANG
|
||||
|
||||
# BlackBerry
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
def handle_project_files(context):
|
||||
# determine proj_path
|
||||
proj_path = context["dst_project_path"] + "/proj.blackberry/"
|
||||
|
||||
# replaceString function is implemented in ../create-project.py
|
||||
import replaces
|
||||
|
||||
replaces.replaceString(proj_path + "bar-descriptor.xml", context["src_package_name"], context["dst_package_name"])
|
||||
|
||||
replaces.replaceString(proj_path + ".cproject", context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(proj_path + ".project", context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(proj_path + "bar-descriptor.xml", context["src_project_name"], context["dst_project_name"])
|
||||
|
||||
# done!
|
||||
print "proj.blackberry : Done!"
|
|
@ -20,10 +20,11 @@ platforms_list = []
|
|||
# begin
|
||||
import sys
|
||||
import os, os.path
|
||||
import shutil # for copy folders and files
|
||||
import json
|
||||
import shutil
|
||||
|
||||
def dumpUsage():
|
||||
print "Usage: create-project.py -project PROJECT_NAME -package PACKAGE_NAME -language PROGRAMING_LANGUAGE"
|
||||
print "Usage: create_project.py -project PROJECT_NAME -package PACKAGE_NAME -language PROGRAMING_LANGUAGE"
|
||||
print "Options:"
|
||||
print " -project PROJECT_NAME Project name, for example: MyGame"
|
||||
print " -package PACKAGE_NAME Package name, for example: com.MyCompany.MyAwesomeGame"
|
||||
|
@ -101,6 +102,74 @@ def checkParams(context):
|
|||
"win32"]
|
||||
# end of checkParams(context) function
|
||||
|
||||
def replaceString(filepath, src_string, dst_string):
|
||||
content = ""
|
||||
f1 = open(filepath, "rb")
|
||||
for line in f1:
|
||||
if src_string in line:
|
||||
content += line.replace(src_string, dst_string)
|
||||
else:
|
||||
content += line
|
||||
f1.close()
|
||||
f2 = open(filepath, "wb")
|
||||
f2.write(content)
|
||||
f2.close()
|
||||
# end of replaceString
|
||||
|
||||
def processPlatformProjects(platform):
|
||||
# determine proj_path
|
||||
proj_path = context["dst_project_path"] + "/proj.%s/" % platform
|
||||
java_package_path = ""
|
||||
|
||||
# read josn config file or the current platform
|
||||
f = open("%s.json" % platform)
|
||||
data = json.load(f)
|
||||
|
||||
# rename package path, like "org.cocos2dx.hello" to "com.company.game". This is a special process for android
|
||||
if (platform == "android"):
|
||||
src_pkg = context["src_package_name"].split('.')
|
||||
dst_pkg = context["dst_package_name"].split('.')
|
||||
os.rename(proj_path + "src/" + src_pkg[0],
|
||||
proj_path + "src/" + dst_pkg[0])
|
||||
os.rename(proj_path + "src/" + dst_pkg[0] + "/" + src_pkg[1],
|
||||
proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1])
|
||||
os.rename(proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1] + "/" + src_pkg[2],
|
||||
proj_path + "src/" + dst_pkg[0] + "/" + dst_pkg[1] + "/" + dst_pkg[2])
|
||||
java_package_path = dst_pkg[0] + "/" + dst_pkg[1] + "/" + dst_pkg[2]
|
||||
|
||||
# rename files and folders
|
||||
for i in range(0, len(data["rename"])):
|
||||
tmp = data["rename"][i].replace("PACKAGE_PATH", java_package_path)
|
||||
src = tmp.replace("PROJECT_NAME", context["src_project_name"])
|
||||
dst = tmp.replace("PROJECT_NAME", context["dst_project_name"])
|
||||
if (os.path.exists(proj_path + src) == True):
|
||||
os.rename(proj_path + src, proj_path + dst)
|
||||
|
||||
# remove useless files and folders
|
||||
for i in range(0, len(data["remove"])):
|
||||
dst = data["remove"][i].replace("PROJECT_NAME", context["dst_project_name"])
|
||||
if (os.path.exists(proj_path + dst) == True):
|
||||
shutil.rmtree(proj_path + dst)
|
||||
|
||||
# rename package_name. This should be replaced at first. Don't change this sequence
|
||||
for i in range(0, len(data["replace_package_name"])):
|
||||
tmp = data["replace_package_name"][i].replace("PACKAGE_PATH", java_package_path)
|
||||
dst = tmp.replace("PROJECT_NAME", context["dst_project_name"])
|
||||
if (os.path.exists(proj_path + dst) == True):
|
||||
replaceString(proj_path + dst, context["src_package_name"], context["dst_package_name"])
|
||||
|
||||
# rename project_name
|
||||
for i in range(0, len(data["replace_project_name"])):
|
||||
tmp = data["replace_project_name"][i].replace("PACKAGE_PATH", java_package_path)
|
||||
dst = tmp.replace("PROJECT_NAME", context["dst_project_name"])
|
||||
if (os.path.exists(proj_path + dst) == True):
|
||||
replaceString(proj_path + dst, context["src_project_name"], context["dst_project_name"])
|
||||
|
||||
# done!
|
||||
print "proj.%s\t\t: Done!" % platform
|
||||
# end of processPlatformProjects
|
||||
|
||||
|
||||
|
||||
# -------------- main --------------
|
||||
# dump argvs
|
||||
|
@ -121,8 +190,9 @@ else:
|
|||
|
||||
# call process_proj from each platform's script folder
|
||||
for platform in platforms_list:
|
||||
exec "import %s.handle_project_files" % (platform)
|
||||
exec "%s.handle_project_files.handle_project_files(context)" % (platform)
|
||||
processPlatformProjects(platform)
|
||||
# exec "import %s.handle_project_files" % (platform)
|
||||
# exec "%s.handle_project_files.handle_project_files(context)" % (platform)
|
||||
|
||||
print "New project has been created in this path: " + context["dst_project_path"].replace("/tools/project-creator/../..", "")
|
||||
print "Have Fun!"
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
# This empty file indicates this folder as a module in python
|
||||
# Don't remove me!
|
|
@ -1,39 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# handle_project_files.py for iOS
|
||||
# Copyright (c) 2012 cocos2d-x.org
|
||||
# Author: WangZhe
|
||||
|
||||
# iOS
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
def handle_project_files(context):
|
||||
# determine proj_path
|
||||
proj_path = context["dst_project_path"] + "/proj.ios/"
|
||||
|
||||
# rename files and folders
|
||||
os.rename(proj_path + context["src_project_name"] + ".xcodeproj",
|
||||
proj_path + context["dst_project_name"] + ".xcodeproj" )
|
||||
|
||||
# remove useless files.
|
||||
removes = [
|
||||
context["dst_project_name"] + ".xcodeproj/project.xcworkspace",
|
||||
context["dst_project_name"] + ".xcodeproj/xcuserdata",
|
||||
]
|
||||
for i in range(0, len(removes)):
|
||||
if (os.path.exists(proj_path + removes[i]) == True):
|
||||
shutil.rmtree(proj_path + removes[i])
|
||||
|
||||
# replaceString function is implemented in ../create-project.py
|
||||
import replaces
|
||||
# package_name should be replaced at first. Don't change this sequence
|
||||
replaces.replaceString(proj_path + "Info.plist",
|
||||
context["src_package_name"], context["dst_package_name"])
|
||||
replaces.replaceString(proj_path + context["dst_project_name"] + ".xcodeproj/project.pbxproj",
|
||||
context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(proj_path + "Info.plist",
|
||||
context["src_project_name"], context["dst_project_name"])
|
||||
|
||||
# done!
|
||||
print "proj.ios : Done!"
|
|
@ -1,2 +0,0 @@
|
|||
# This empty file indicates this folder as a module in python
|
||||
# Don't remove me!
|
|
@ -1,22 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# handle_project_files.py for Linux
|
||||
# Copyright (c) 2012 cocos2d-x.org
|
||||
# Author: Zhe WANG
|
||||
|
||||
# Linux
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
def handle_project_files(context):
|
||||
# determine proj_path
|
||||
proj_path = context["dst_project_path"] + "/proj.linux/"
|
||||
|
||||
# replaceString function is implemented in ../create-project.py
|
||||
import replaces
|
||||
replaces.replaceString(proj_path + ".cproject", context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(proj_path + ".project", context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(proj_path + "Makefile", context["src_project_name"], context["dst_project_name"])
|
||||
|
||||
# done!
|
||||
print "proj.linux : Done!"
|
|
@ -1,2 +0,0 @@
|
|||
# This empty file indicates this folder as a module in python
|
||||
# Don't remove me!
|
|
@ -1,39 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# handle_project_files.py for Mac OS X
|
||||
# Copyright (c) 2012 cocos2d-x.org
|
||||
# Author: WangZhe
|
||||
|
||||
# Mac OS X
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
def handle_project_files(context):
|
||||
# determine proj_path
|
||||
proj_path = context["dst_project_path"] + "/proj.mac/"
|
||||
|
||||
# rename files and folders
|
||||
os.rename(proj_path + context["src_project_name"] + ".xcodeproj",
|
||||
proj_path + context["dst_project_name"] + ".xcodeproj" )
|
||||
|
||||
# remove useless files.
|
||||
removes = [
|
||||
context["dst_project_name"] + ".xcodeproj/project.xcworkspace",
|
||||
context["dst_project_name"] + ".xcodeproj/xcuserdata",
|
||||
]
|
||||
for i in range(0, len(removes)):
|
||||
if (os.path.exists(proj_path + removes[i]) == True):
|
||||
shutil.rmtree(proj_path + removes[i])
|
||||
|
||||
# replaceString function is implemented in ../create-project.py
|
||||
import replaces
|
||||
# package_name should be replaced at first. Don't change this sequence
|
||||
replaces.replaceString(proj_path + "Info.plist",
|
||||
context["src_package_name"], context["dst_package_name"])
|
||||
replaces.replaceString(proj_path + context["dst_project_name"] + ".xcodeproj/project.pbxproj",
|
||||
context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(proj_path + "Info.plist",
|
||||
context["src_project_name"], context["dst_project_name"])
|
||||
|
||||
# done!
|
||||
print "proj.mac : Done!"
|
|
@ -1,2 +0,0 @@
|
|||
# This empty file indicates this folder as a module in python
|
||||
# Don't remove me!
|
|
@ -1,21 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# handle_project_files.py for BlackBerry
|
||||
# Copyright (c) 2012 cocos2d-x.org
|
||||
# Author: Zhe WANG
|
||||
|
||||
# BlackBerry
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
def handle_project_files(context):
|
||||
# determine proj_path
|
||||
proj_path = context["dst_project_path"] + "/proj.marmalade/"
|
||||
|
||||
# rename files and folders
|
||||
os.rename(proj_path + context["src_project_name"] + ".mkb",
|
||||
proj_path + context["dst_project_name"] + ".mkb" )
|
||||
|
||||
|
||||
# done!
|
||||
print "proj.blackberry : Done!"
|
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# replaces.py
|
||||
# Copyright (c) 2012 cocos2d-x.org
|
||||
# Author: WangZhe
|
||||
|
||||
def replaceString(filepath, src_string, dst_string):
|
||||
content = ""
|
||||
f1 = open(filepath, "rb")
|
||||
for line in f1:
|
||||
if src_string in line:
|
||||
content += line.replace(src_string, dst_string)
|
||||
else:
|
||||
content += line
|
||||
f1.close()
|
||||
f2 = open(filepath, "wb")
|
||||
f2.write(content)
|
||||
f2.close()
|
||||
# end of replaceString(filepath, src, dst) function
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
# This empty file indicates this folder as a module in python
|
||||
# Don't remove me!
|
|
@ -1,33 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# handle_project_files.py for Win32
|
||||
# Copyright (c) 2012 cocos2d-x.org
|
||||
# Author: WangZhe
|
||||
|
||||
# Win32
|
||||
|
||||
import os
|
||||
|
||||
def handle_project_files(context):
|
||||
# determine proj_path
|
||||
proj_path = context["dst_project_path"] + "/proj.win32/"
|
||||
|
||||
# rename files and folders
|
||||
os.rename(proj_path + context["src_project_name"] + ".vcxproj",
|
||||
proj_path + context["dst_project_name"] + ".vcxproj")
|
||||
os.rename(proj_path + context["src_project_name"] + ".vcxproj.filters",
|
||||
proj_path + context["dst_project_name"] + ".vcxproj.filters")
|
||||
os.rename(proj_path + context["src_project_name"] + ".vcxproj.user",
|
||||
proj_path + context["dst_project_name"] + ".vcxproj.user")
|
||||
os.rename(proj_path + context["src_project_name"] + ".sln",
|
||||
proj_path + context["dst_project_name"] + ".sln")
|
||||
|
||||
# replaceString function is implemented in ../create-project.py
|
||||
import replaces
|
||||
# package_name should be replaced at first. Don't change this sequence
|
||||
replaces.replaceString(proj_path + context["dst_project_name"] + ".vcxproj", context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(proj_path + context["dst_project_name"] + ".vcxproj.filters", context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(proj_path + context["dst_project_name"] + ".vcxproj.user", context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(proj_path + context["dst_project_name"] + ".sln", context["src_project_name"], context["dst_project_name"])
|
||||
replaces.replaceString(proj_path + "main.cpp", context["src_project_name"], context["dst_project_name"])
|
||||
# done!
|
||||
print "proj.win32 : Done!"
|
|
@ -73,7 +73,7 @@ class CCRepeat : public CCActionInterval
|
|||
bool isDone(void);
|
||||
CCActionInterval* reverse(void);
|
||||
|
||||
static CCRepeat* create(CCActionInterval *pAction, unsigned int times);
|
||||
static CCRepeat* create(CCFiniteTimeAction *pAction, unsigned int times);
|
||||
};
|
||||
|
||||
class CCRepeatForever : public CCActionInterval
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
struct CCPoint
|
||||
class CCPoint
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
|
@ -9,7 +9,7 @@ struct CCPoint
|
|||
bool equals(const CCPoint & target) const ;
|
||||
};
|
||||
|
||||
struct CCSize
|
||||
class CCSize
|
||||
{
|
||||
float width;
|
||||
float height;
|
||||
|
@ -19,7 +19,7 @@ struct CCSize
|
|||
bool equals(const CCSize & target) const;
|
||||
};
|
||||
|
||||
struct CCRect
|
||||
class CCRect
|
||||
{
|
||||
CCPoint origin;
|
||||
CCSize size;
|
||||
|
|
Loading…
Reference in New Issue