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>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="10"
>
<Tool

View File

@ -1,7 +1,7 @@
function OnFinish(selProj, selObj) {
try {
// var WizardVersion = wizard.FindSymbol('WIZARD_VERSION');
// var WizardVersion = wizard.FindSymbol('WIZARD_VERSION');
// Create symbols based on the project name
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_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
var d = new Date();
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) {
try {
var config = proj.Object.Configurations('Debug');
var strSolutionName = "";
proj.Object.Keyword = "uPhoneProj";
wizard.AddSymbol('PROJECT_PRJ_TG3_DIR', strPrjTG3Dir, false);
// header files and libraries directories
var strPrjTG3Dir = '../../PRJ_TG3';
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';
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 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 strOutputFile = '$(OutDir)/' + wizard.FindSymbol("PROJECT_NAME") + '.dll';
if (wizard.FindSymbol('CCX_USE_BOX2D')) {
strCurIncludeDir += ';..\\;..\\Box2D';
strDependLibs += ' libBox2d.lib';
@ -163,77 +160,77 @@ function AddConfig(proj, strProjectName) {
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';
config.OutputDirectory = strOutputDir;
config.ConfigurationType = '2';
config.InheritedPropertySheets = '$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops';
// config.DebugSettings.Command = 'TG3_RunDll.exe';
// config.DebugSettings.CommandArguments = '$(TargetPath)';
// Check if it's Debug configuration
var bDebug = false;
if (astrConfigName[nCntr].search("Debug") != -1)
bDebug = true;
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');
CLTool.Optimization = "0";
CLTool.AdditionalIncludeDirectories = strCurIncludeDir;
CLTool.PreprocessorDefinitions = strDefinitions;
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 = '';
config.InheritedPropertySheets = '$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops';
config.OutputDirectory = strOutputDir;
config.IntermediateDirectory = '$(ConfigurationName).uphone';
config.ConfigurationType = '2';
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';
var CLTool = config.Tools('VCCLCompilerTool');
if (bDebug) {
CLTool.RuntimeLibrary = rtMultiThreadedDebug;
CLTool.MinimalRebuild = true;
CLTool.DebugInformationFormat = debugEditAndContinue;
CLTool.BasicRuntimeChecks = runtimeBasicCheckAll;
CLTool.Optimization = optimizeDisabled;
}
else {
CLTool.RuntimeLibrary = rtMultiThreaded;
CLTool.ExceptionHandling = false;
CLTool.DebugInformationFormat = debugDisabled;
}
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');
config.IntermediateDirectory = '$(ConfigurationName)';
config.OutputDirectory = '$(ConfigurationName)';
var LinkTool = config.Tools('VCLinkerTool');
if (bDebug) {
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');
CLTool.Optimization = "0";
CLTool.AdditionalIncludeDirectories = strCurIncludeDir;
CLTool.PreprocessorDefinitions = strDefinitions;
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');
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';
var PostBuildTool = config.Tools("VCPostBuildEventTool");
PostBuildTool.Description = "Performing registration...";
var strResDir = "..\\..\\NEWPLUS\\TDA_DATA\\Data\\" + strProjectName + "\\";
var strPostCmd = "mkdir " + strResDir;
strPostCmd += "\r\nxcopy /E /Y .\\Resource\\*.* " + strResDir;
PostBuildTool.CommandLine = strPostCmd;
}
}
catch (e) {
throw e;

View File

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

View File

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

View File

@ -16,3 +16,6 @@ Classes/AppDelegate.cpp
Classes/HelloWorldScene.h
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
sizeof(ResRegList_[!output PROJECT_NAME]) / sizeof(ResourceRegisterEntry), //number of item in res
};
[! endif]
Int32 TG3AppMain(const TUChar * pAppID, UInt32 nCmd, void * pCmdParam)
{
AppDelegate app;
@ -26,5 +25,3 @@ Int32 TG3AppMain(const TUChar * pAppID, UInt32 nCmd, void * pCmdParam)
return 1;
}

View File

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