issue #186 uphone vs wizard add sample image.

This commit is contained in:
yangws 2010-11-18 09:47:28 +00:00
parent 202ed580d6
commit af3bbcbc7c
8 changed files with 115 additions and 111 deletions

View File

@ -18,6 +18,8 @@
<Configurations> <Configurations>
<Configuration <Configuration
Name="Debug|Win32" Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="10" ConfigurationType="10"
> >
<Tool <Tool

View File

@ -1,7 +1,7 @@
function OnFinish(selProj, selObj) { function OnFinish(selProj, selObj) {
try { try {
// var WizardVersion = wizard.FindSymbol('WIZARD_VERSION'); // var WizardVersion = wizard.FindSymbol('WIZARD_VERSION');
// Create symbols based on the project name // Create symbols based on the project name
var strProjectPath = wizard.FindSymbol('PROJECT_PATH'); var strProjectPath = wizard.FindSymbol('PROJECT_PATH');
@ -10,16 +10,6 @@ function OnFinish(selProj, selObj) {
wizard.AddSymbol('PROJECT_NAME_LOWER', strProjectName.toLowerCase(), false); wizard.AddSymbol('PROJECT_NAME_LOWER', strProjectName.toLowerCase(), false);
wizard.AddSymbol('PROJECT_NAME_UPPER', strProjectName.toUpperCase(), false); wizard.AddSymbol('PROJECT_NAME_UPPER', strProjectName.toUpperCase(), false);
// if (strProjectName.length >= 6) {
// wizard.AddSymbol('PRO_NAME_PREFIX', strProjectName.substr(0, 6).toUpperCase(), false);
// }
// else {
// var strRes = '_RES';
// var strNewFormId = strProjectName + strRes.substr(0, (6 - strProjectName.length));
//
// wizard.AddSymbol('PRO_NAME_PREFIX', strNewFormId.toUpperCase(), false);
// }
// Set current year symbol // Set current year symbol
var d = new Date(); var d = new Date();
var nYear = 0; var nYear = 0;
@ -129,23 +119,30 @@ function AddFilters(proj) {
} }
} }
// Configurations data
var nNumConfigs = 2;
var astrConfigName = new Array();
astrConfigName[0] = "Debug";
astrConfigName[1] = "Release";
function AddConfig(proj, strProjectName) { function AddConfig(proj, strProjectName) {
try { try {
var config = proj.Object.Configurations('Debug'); proj.Object.Keyword = "uPhoneProj";
var strSolutionName = ""; wizard.AddSymbol('PROJECT_PRJ_TG3_DIR', strPrjTG3Dir, false);
// header files and libraries directories
var strPrjTG3Dir = '../../PRJ_TG3'; var strPrjTG3Dir = '../../PRJ_TG3';
var strOutputDir = '../../PRJ_TG3/LIB/Win32Lib'; var strOutputDir = '../../PRJ_TG3/LIB/Win32Lib';
var strCurIncludeDir = '..\\..\\PRJ_TG3\\Include;..\\..\\PRJ_TG3\\Include\\MTAPI;..\\..\\PRJ_TG3\\Include\\ThirdParty;..\\..\\PRJ_TG3\\Include\\TCOM;..\\..\\PRJ_TG3\\Include\\OpenGL'; var strCurIncludeDir = '..\\..\\PRJ_TG3\\Include;..\\..\\PRJ_TG3\\Include\\MTAPI;..\\..\\PRJ_TG3\\Include\\ThirdParty;..\\..\\PRJ_TG3\\Include\\TCOM;..\\..\\PRJ_TG3\\Include\\OpenGL';
strCurIncludeDir += ';.;.\\Classes;.\\uphone;.\\uphone\\Res;..\\cocos2dx;..\\cocos2dx\\include'; strCurIncludeDir += ';.;.\\Classes;.\\uphone;.\\uphone\\Res;..\\cocos2dx;..\\cocos2dx\\include';
var strDefinitions = 'WIN32;_DEBUG;_CONSOLE;_TRANZDA_VM_;SS_MAKEDLL'; var strDefinitions = 'WIN32;_CONSOLE;_TRANZDA_VM_;SS_MAKEDLL';
var strDependLibs = 'WS2_32.Lib EosConfig.lib SoftSupport.lib TG3_DLL.lib libcocos2d.lib'; var strDependLibs = 'WS2_32.Lib EosConfig.lib SoftSupport.lib TG3_DLL.lib libcocos2d.lib';
var strCurLibsDir = '../../PRJ_TG3/Common/ICU/lib;../../PRJ_TG3/Mtapi/Win32/lib;../../PRJ_TG3/LIB/Win32Lib;../../PRJ_TG3/Common/SoftSupport'; var strCurLibsDir = '../../PRJ_TG3/Common/ICU/lib;../../PRJ_TG3/Mtapi/Win32/lib;../../PRJ_TG3/LIB/Win32Lib;../../PRJ_TG3/Common/SoftSupport';
var strImportLib = '$(OutDir)/' + wizard.FindSymbol("PROJECT_NAME") + '.lib'; var strImportLib = '$(OutDir)/' + wizard.FindSymbol("PROJECT_NAME") + '.lib';
var strOutputFile = '$(OutDir)/' + wizard.FindSymbol("PROJECT_NAME") + '.dll'; var strOutputFile = '$(OutDir)/' + wizard.FindSymbol("PROJECT_NAME") + '.dll';
if (wizard.FindSymbol('CCX_USE_BOX2D')) { if (wizard.FindSymbol('CCX_USE_BOX2D')) {
strCurIncludeDir += ';..\\;..\\Box2D'; strCurIncludeDir += ';..\\;..\\Box2D';
strDependLibs += ' libBox2d.lib'; strDependLibs += ' libBox2d.lib';
@ -163,77 +160,77 @@ function AddConfig(proj, strProjectName) {
strDefinitions = strDefinitions + ';__TCOM_SUPPORT__'; strDefinitions = strDefinitions + ';__TCOM_SUPPORT__';
} }
wizard.AddSymbol('PROJECT_PRJ_TG3_DIR', strPrjTG3Dir, false); // create configure
var nCntr;
for (nCntr = 0; nCntr < nNumConfigs; nCntr++) {
config.IntermediateDirectory = 'Debug'; // Check if it's Debug configuration
config.OutputDirectory = strOutputDir; var bDebug = false;
config.ConfigurationType = '2'; if (astrConfigName[nCntr].search("Debug") != -1)
config.InheritedPropertySheets = '$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops'; bDebug = true;
// config.DebugSettings.Command = 'TG3_RunDll.exe';
// config.DebugSettings.CommandArguments = '$(TargetPath)';
proj.Object.Keyword = "uPhoneProj"; var config = proj.Object.Configurations(astrConfigName[nCntr]);
if (bDebug) {
strDefinitions = '_DEBUG;' + strDefinitions;
}
else {
strDefinitions = 'NDEBUG;' + strDefinitions;
}
var CLTool = config.Tools('VCCLCompilerTool'); config.InheritedPropertySheets = '$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops';
CLTool.Optimization = "0"; config.OutputDirectory = strOutputDir;
CLTool.AdditionalIncludeDirectories = strCurIncludeDir; config.IntermediateDirectory = '$(ConfigurationName).uphone';
CLTool.PreprocessorDefinitions = strDefinitions; config.ConfigurationType = '2';
CLTool.MinimalRebuild = 'true';
CLTool.BasicRuntimeChecks = '3';
CLTool.RuntimeLibrary = '3';
CLTool.StructMemberAlignment = '3';
CLTool.TreatWChar_tAsBuiltInType = 'false';
CLTool.UsePrecompiledHeader = '0';
CLTool.WarningLevel = '3';
CLTool.DebugInformationFormat = '4';
CLTool.ForcedIncludeFiles = '';
var LinkTool = config.Tools('VCLinkerTool'); var CLTool = config.Tools('VCCLCompilerTool');
LinkTool.AdditionalDependencies = strDependLibs; if (bDebug) {
LinkTool.OutputFile = strOutputFile; CLTool.RuntimeLibrary = rtMultiThreadedDebug;
LinkTool.LinkIncremental = '2'; CLTool.MinimalRebuild = true;
LinkTool.AdditionalLibraryDirectories = strCurLibsDir; CLTool.DebugInformationFormat = debugEditAndContinue;
LinkTool.GenerateDebugInformation = 'true'; CLTool.BasicRuntimeChecks = runtimeBasicCheckAll;
LinkTool.GenerateMapFile = 'true'; CLTool.Optimization = optimizeDisabled;
LinkTool.MapExports = 'true'; }
LinkTool.SubSystem = '1'; else {
LinkTool.RandomizedBaseAddress = '1'; CLTool.RuntimeLibrary = rtMultiThreaded;
LinkTool.DataExecutionPrevention = '0'; CLTool.ExceptionHandling = false;
LinkTool.ImportLibrary = strImportLib; CLTool.DebugInformationFormat = debugDisabled;
LinkTool.TargetMachine = '1'; }
CLTool.AdditionalIncludeDirectories = strCurIncludeDir;
CLTool.PreprocessorDefinitions = strDefinitions;
CLTool.RuntimeLibrary = '3';
CLTool.StructMemberAlignment = '3';
CLTool.TreatWChar_tAsBuiltInType = 'false';
CLTool.UsePrecompiledHeader = '0';
CLTool.WarningLevel = '3';
CLTool.ForcedIncludeFiles = '';
config = proj.Object.Configurations('Release'); var LinkTool = config.Tools('VCLinkerTool');
config.IntermediateDirectory = '$(ConfigurationName)'; if (bDebug) {
config.OutputDirectory = '$(ConfigurationName)'; LinkTool.LinkIncremental = linkIncrementalYes;
LinkTool.GenerateDebugInformation = true;
LinkTool.GenerateMapFile = 'true';
LinkTool.MapExports = 'true';
}
else {
LinkTool.LinkIncremental = linkIncrementalNo;
}
LinkTool.AdditionalDependencies = strDependLibs;
LinkTool.OutputFile = strOutputFile;
LinkTool.AdditionalLibraryDirectories = strCurLibsDir;
LinkTool.SubSystem = '1';
LinkTool.RandomizedBaseAddress = '1';
LinkTool.DataExecutionPrevention = '0';
LinkTool.ImportLibrary = strImportLib;
LinkTool.TargetMachine = '1';
var CLTool = config.Tools('VCCLCompilerTool'); var PostBuildTool = config.Tools("VCPostBuildEventTool");
CLTool.Optimization = "0"; PostBuildTool.Description = "Performing registration...";
CLTool.AdditionalIncludeDirectories = strCurIncludeDir; var strResDir = "..\\..\\NEWPLUS\\TDA_DATA\\Data\\" + strProjectName + "\\";
CLTool.PreprocessorDefinitions = strDefinitions; var strPostCmd = "mkdir " + strResDir;
CLTool.MinimalRebuild = 'true'; strPostCmd += "\r\nxcopy /E /Y .\\Resource\\*.* " + strResDir;
CLTool.BasicRuntimeChecks = '3'; PostBuildTool.CommandLine = strPostCmd;
CLTool.RuntimeLibrary = '3'; }
CLTool.StructMemberAlignment = '3';
CLTool.TreatWChar_tAsBuiltInType = 'false';
CLTool.UsePrecompiledHeader = '0';
CLTool.WarningLevel = '3';
CLTool.DebugInformationFormat = '4';
CLTool.ForcedIncludeFiles = '';
var LinkTool = config.Tools('VCLinkerTool');
LinkTool.AdditionalDependencies = strDependLibs;
LinkTool.OutputFile = strOutputFile;
LinkTool.LinkIncremental = '2';
LinkTool.AdditionalLibraryDirectories = strCurLibsDir;
LinkTool.GenerateDebugInformation = 'true';
LinkTool.GenerateMapFile = 'true';
LinkTool.MapExports = 'true';
LinkTool.SubSystem = '1';
LinkTool.RandomizedBaseAddress = '1';
LinkTool.DataExecutionPrevention = '0';
LinkTool.ImportLibrary = strImportLib;
LinkTool.TargetMachine = '1';
} }
catch (e) { catch (e) {
throw e; throw e;

View File

@ -1,8 +1,15 @@
#include "AppDelegate.h" #include "AppDelegate.h"
[! if CCX_USE_COCOS_DENSHION_SIMPLE_AUDIO_ENGINE]
#include "SimpleAudioEngine.h"
[! endif]
#include "HelloWorldScene.h" #include "HelloWorldScene.h"
[! if CCX_USE_UI_RESOURCE]
#include "Resource.h" #include "Resource.h"
extern const AppResourceEntry [!output PROJECT_NAME]ResourceEntry; extern const AppResourceEntry [!output PROJECT_NAME]ResourceEntry;
[! endif]
using namespace cocos2d; using namespace cocos2d;
@ -35,10 +42,14 @@ bool AppDelegate::applicationDidFinishLaunching()
pDirector->setDisplayFPS(true); pDirector->setDisplayFPS(true);
// set the resource path // set the resource path
CCFileUtils::setResourcePath("/NEWPLUS/TDA_DATA/Data/cocos2d_tests/"); CCFileUtils::setResourcePath("/NEWPLUS/TDA_DATA/Data/[!output PROJECT_NAME]/");
[! if CCX_USE_UI_RESOURCE]
// set the ResourceEntry
CCFileUtils::setResourceEntry(&cocosTemplateResourceEntry);
// set the Images ResInfo (name and ResID) // set the Images ResInfo (name and ResID)
// CCFileUtils::setResourceInfo(ResInfo, sizeof(ResInfo) / sizeof(T_ResourceInfo)); CCFileUtils::setResourceInfo(ResInfo, sizeof(ResInfo) / sizeof(T_ResourceInfo));
[! endif]
CCScene * pScene = HelloWorld::scene(); CCScene * pScene = HelloWorld::scene();
@ -53,8 +64,9 @@ void AppDelegate::applicationDidEnterBackground()
{ {
CCDirector::sharedDirector()->stopAnimation(); CCDirector::sharedDirector()->stopAnimation();
// if you use SimpleAudioEngine, it must be pause [! if CCX_USE_COCOS_DENSHION_SIMPLE_AUDIO_ENGINE]
// SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
[! endif]
} }
// this function will be called when the app is active again // this function will be called when the app is active again
@ -62,6 +74,7 @@ void AppDelegate::applicationWillEnterForeground()
{ {
CCDirector::sharedDirector()->startAnimation(); CCDirector::sharedDirector()->startAnimation();
// if you use SimpleAudioEngine, it must resume here [! if CCX_USE_COCOS_DENSHION_SIMPLE_AUDIO_ENGINE]
// SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
[! endif]
} }

View File

@ -7,10 +7,10 @@ using namespace cocos2d;
CCScene* HelloWorld::scene() CCScene* HelloWorld::scene()
{ {
// 'scene' is an autorelease object // 'scene' is an autorelease object
CCScene *scene = CCScene::node(); CCScene * scene = CCScene::node();
// 'layer' is an autorelease object // 'layer' is an autorelease object
HelloWorld *layer = HelloWorld::node(); HelloWorld * layer = HelloWorld::node();
// add layer as a child to scene // add layer as a child to scene
scene->addChild(layer); scene->addChild(layer);
@ -24,12 +24,11 @@ bool HelloWorld::init()
{ {
////////////////////////////// //////////////////////////////
// 1. super init first // 1. super init first
if ( !CCLayer::init() ) if (! CCLayer::init())
{ {
return false; return false;
} }
[! if CCX_USE_UI_RESOURCE]
///////////////////////////// /////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program // 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it. // you may modify it.
@ -44,15 +43,11 @@ bool HelloWorld::init()
// create menu, it's an autorelease object // create menu, it's an autorelease object
CCMenu* pMenu = CCMenu::menuWithItems(pCloseItem, NULL); CCMenu* pMenu = CCMenu::menuWithItems(pCloseItem, NULL);
pMenu->setPosition( CGPointZero ); pMenu->setPosition(CGPointZero);
this->addChild(pMenu); this->addChild(pMenu);
///////////////////////////// /////////////////////////////
// 3. add your codes below... // 3. add your codes below...
[! else]
/////////////////////////////
// 2. add your codes below...
[! endif]
// add a label shows "Hello World" // add a label shows "Hello World"
// create and initialize a label // create and initialize a label
CCLabel* pLabel = CCLabel::labelWithString("HelloWorld", "Thonburi", 64); CCLabel* pLabel = CCLabel::labelWithString("HelloWorld", "Thonburi", 64);
@ -61,17 +56,15 @@ bool HelloWorld::init()
CGSize size = CCDirector::sharedDirector()->getWinSize(); CGSize size = CCDirector::sharedDirector()->getWinSize();
// position the label on the center of the screen // position the label on the center of the screen
pLabel->setPosition( ccp(size.width / 2, size.height / 2) ); pLabel->setPosition(ccp(size.width / 2, size.height / 2));
// add the label as a child to this layer // add the label as a child to this layer
this->addChild(pLabel); this->addChild(pLabel);
return true; return true;
} }
[! if CCX_USE_UI_RESOURCE]
void HelloWorld::menuCloseCallback(NSObject* pSender) void HelloWorld::menuCloseCallback(NSObject* pSender)
{ {
CCDirector::sharedDirector()->end(); CCDirector::sharedDirector()->end();
} }
[! endif]

View File

@ -12,11 +12,10 @@ public:
// there's no 'id' in cpp, so we recommand to return the exactly class pointer // there's no 'id' in cpp, so we recommand to return the exactly class pointer
static cocos2d::CCScene* scene(); static cocos2d::CCScene* scene();
[! if CCX_USE_UI_RESOURCE]
// a selector callback // a selector callback
virtual void menuCloseCallback(NSObject* pSender); virtual void menuCloseCallback(NSObject* pSender);
[! endif]
// implement the "static node()" method manually // implement the "static node()" method manually
LAYER_NODE_FUNC(HelloWorld); LAYER_NODE_FUNC(HelloWorld);
}; };

View File

@ -16,3 +16,6 @@ Classes/AppDelegate.cpp
Classes/HelloWorldScene.h Classes/HelloWorldScene.h
Classes/HelloWorldScene.cpp Classes/HelloWorldScene.cpp
Resource/CloseNormal.png
Resource/CloseSelected.png

View File

@ -13,9 +13,8 @@ extern const AppResourceEntry [!output PROJECT_NAME]ResourceEntry =
(ResourceRegisterEntry*)ResRegList_[!output PROJECT_NAME], // res list in this app (ResourceRegisterEntry*)ResRegList_[!output PROJECT_NAME], // res list in this app
sizeof(ResRegList_[!output PROJECT_NAME]) / sizeof(ResourceRegisterEntry), //number of item in res sizeof(ResRegList_[!output PROJECT_NAME]) / sizeof(ResourceRegisterEntry), //number of item in res
}; };
[! endif] [! endif]
Int32 TG3AppMain(const TUChar * pAppID, UInt32 nCmd, void * pCmdParam) Int32 TG3AppMain(const TUChar * pAppID, UInt32 nCmd, void * pCmdParam)
{ {
AppDelegate app; AppDelegate app;
@ -26,5 +25,3 @@ Int32 TG3AppMain(const TUChar * pAppID, UInt32 nCmd, void * pCmdParam)
return 1; return 1;
} }

View File

@ -2,17 +2,17 @@
#define __RESOURCE_H__ #define __RESOURCE_H__
#include "[!output PROJECT_NAME]UnicodeScript_str.h"; #include "[!output PROJECT_NAME]UnicodeScript_str.h";
[! if CCX_USE_UI_RESOURCE] [! if CCX_USE_UI_RESOURCE]
#include "[!output PROJECT_NAME]_res_c.h" #include "[!output PROJECT_NAME]_res_c.h"
[! endif]
#include "cocos2d.h" #include "cocos2d.h"
const T_ResourceInfo ResInfo[] = const T_ResourceInfo ResInfo[] =
{ {
{ "CloseNormal", COCOST_ID_BITMAP_CloseNormal }, { "CloseNormal.png", [! if CCX_USE_UI_RESOURCE]COCOST_ID_BITMAP_CloseNormal[! else]0[! endif] },
{ "CloseSelected", COCOST_ID_BITMAP_CloseSelected }, { "CloseSelected.png", [! if CCX_USE_UI_RESOURCE]COCOST_ID_BITMAP_CloseSelected[! else]0[! endif] },
}; };
[! endif]
#endif // __RESOURCE_H__ #endif // __RESOURCE_H__