Skip to content

Commit b7ad129

Browse files
committed
issue cocos2d#176 add test code in test_win32, which same with test_uphone .
1 parent acdc728 commit b7ad129

17 files changed

+755
-26
lines changed

Box2D/Box2D-win32.vcproj

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Version="9.00"
55
Name="Box2D-win32"
66
ProjectGUID="{929480E7-23C0-4DF6-8456-096D71547116}"
7+
RootNamespace="Box2D-win32"
78
Keyword="Win32Proj"
89
TargetFrameworkVersion="0"
910
>
@@ -61,6 +62,7 @@
6162
/>
6263
<Tool
6364
Name="VCLibrarianTool"
65+
OutputFile="$(OutDir)\libBox2D.lib"
6466
/>
6567
<Tool
6668
Name="VCALinkTool"
@@ -121,6 +123,7 @@
121123
/>
122124
<Tool
123125
Name="VCLibrarianTool"
126+
OutputFile="$(OutDir)\libBox2D.lib"
124127
/>
125128
<Tool
126129
Name="VCALinkTool"

Helloworld-win32/Helloworld-win32.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "stdafx.h"
55
#include "Helloworld-win32.h"
66

7-
#include "cocos2d.h"
87
using namespace cocos2d;
98

109
#define IMG_PATH "HelloWorld.png"

Helloworld-win32/Helloworld-win32.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

3-
#include "CCXApplication.h"
4-
#include "CCXEGLView.h"
3+
#include "cocos2d.h"
54

65
class HelloWorldApplication : public cocos2d::CCXApplication
76
{

Helloworld-win32/Helloworld-win32.vcproj

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
/>
6262
<Tool
6363
Name="VCLinkerTool"
64+
OutputFile="$(OutDir)\HelloWorld.exe"
6465
LinkIncremental="2"
6566
AdditionalLibraryDirectories=""
6667
GenerateDebugInformation="true"
@@ -136,6 +137,7 @@
136137
/>
137138
<Tool
138139
Name="VCLinkerTool"
140+
OutputFile="$(OutDir)\HelloWorld.exe"
139141
LinkIncremental="1"
140142
AdditionalLibraryDirectories=""
141143
GenerateDebugInformation="true"

chipmunk/chipmunk-win32.vcproj

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
/>
6565
<Tool
6666
Name="VCLibrarianTool"
67+
OutputFile="$(OutDir)\libchipmunk.lib"
6768
/>
6869
<Tool
6970
Name="VCALinkTool"
@@ -127,6 +128,7 @@
127128
/>
128129
<Tool
129130
Name="VCLibrarianTool"
131+
OutputFile="$(OutDir)\libchipmunk.lib"
130132
/>
131133
<Tool
132134
Name="VCALinkTool"

cocos2dx-win32.sln

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ EndProject
1313
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Box2D-win32", "Box2D\Box2D-win32.vcproj", "{929480E7-23C0-4DF6-8456-096D71547116}"
1414
EndProject
1515
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-win32", "test_win32\test-win32.vcproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}"
16+
ProjectSection(ProjectDependencies) = postProject
17+
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
18+
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
19+
{929480E7-23C0-4DF6-8456-096D71547116} = {929480E7-23C0-4DF6-8456-096D71547116}
20+
EndProjectSection
1621
EndProject
1722
Global
1823
GlobalSection(SolutionConfigurationPlatforms) = preSolution

cocos2dx/CCConfiguration.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ using namespace std;
3030
namespace cocos2d {
3131

3232
// singleton stuff
33-
static CCConfiguration *g_pSharedConfiguration;
33+
static bool g_bInited;
34+
static CCConfiguration g_SharedConfiguration;
3435
static char *g_pGlExtensions;
3536

3637
CCConfiguration::CCConfiguration(void)
@@ -79,13 +80,12 @@ bool CCConfiguration::init(void)
7980

8081
CCConfiguration* CCConfiguration::sharedConfiguration(void)
8182
{
82-
if (! g_pSharedConfiguration)
83+
if (! g_bInited)
8384
{
84-
g_pSharedConfiguration = new CCConfiguration();
85-
g_pSharedConfiguration->init();
85+
g_SharedConfiguration.init();
8686
}
8787

88-
return g_pSharedConfiguration;
88+
return &g_SharedConfiguration;
8989
}
9090

9191
bool CCConfiguration::checkForGLExtension(const string &searchName)

cocos2dx/CCDirector.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ CCDirector::~CCDirector(void)
159159
CCX_SAFE_RELEASE(m_pRunningScene);
160160
CCX_SAFE_RELEASE(m_pobScenesStack);
161161

162-
// delete configuration pointer
163-
CCConfiguration *conf = CCConfiguration::sharedConfiguration();
164-
CCX_SAFE_RELEASE(conf);
165-
166162
// pop the autorelease pool
167163
NSPoolManager::getInstance()->pop();
168164

cocos2dx/cocos2dx-win32.vcproj

+4
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@
6464
<Tool
6565
Name="VCLinkerTool"
6666
AdditionalDependencies="libEGL.lib libgles_cm.lib libxml2.lib zlib.lib libpng14-imp.lib libjpeg.lib"
67+
OutputFile="$(OutDir)\libcocos2d.dll"
6768
LinkIncremental="2"
6869
AdditionalLibraryDirectories=".\platform\win32\third_party\OGLES\WindowsPC\Lib;d:/Work7/PRJ_TG3/LIB/Win32Lib;D:\Work7\PRJ_TG3\Common\SoftSupport"
6970
IgnoreAllDefaultLibraries="false"
7071
IgnoreDefaultLibraryNames="MSVCRT.lib;LIBCMTD.lib"
7172
GenerateDebugInformation="true"
7273
SubSystem="2"
74+
ImportLibrary="$(TargetDir)libcocos2d.lib"
7375
TargetMachine="1"
7476
/>
7577
<Tool
@@ -140,12 +142,14 @@
140142
<Tool
141143
Name="VCLinkerTool"
142144
AdditionalDependencies="libEGL.lib libgles_cm.lib libxml2.lib zlib.lib libpng14-imp.lib libjpeg.lib"
145+
OutputFile="$(OutDir)\libcocos2d.dll"
143146
LinkIncremental="2"
144147
AdditionalLibraryDirectories=".\platform\win32\third_party\OGLES\WindowsPC\Lib;d:/Work7/PRJ_TG3/LIB/Win32Lib;D:\Work7\PRJ_TG3\Common\SoftSupport"
145148
GenerateDebugInformation="true"
146149
SubSystem="2"
147150
OptimizeReferences="2"
148151
EnableCOMDATFolding="2"
152+
ImportLibrary="$(TargetDir)libcocos2d.lib"
149153
TargetMachine="1"
150154
/>
151155
<Tool

output.bat

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@echo off
2+
3+
REM export source code from dir %1 to dir %2
4+
5+
IF NOT DEFINED OUTPUT_BY_SVN GOTO AFTER_OUTPUT_BY_SVN
6+
svn export -r BASE --force %1 %2
7+
GOTO FILE_RETURN
8+
:AFTER_OUTPUT_BY_SVN
9+
10+
IF NOT EXIST %2 MD %2
11+
COPY /Y %1\*.* %2
12+
13+
:FILE_RETURN

test_win32/TestApplication.cpp

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#include "TestApplication.h"
2+
#include "winmain.h"
3+
#include "tests/controller.h"
4+
5+
using namespace cocos2d;
6+
7+
//////////////////////////////////////////////////////////////////////////
8+
// implement TestApplication
9+
//////////////////////////////////////////////////////////////////////////
10+
11+
bool TestApplication::InitInstance()
12+
{
13+
return m_MainForm.Create(L"Cocos2dx-Win32", 480, 320);
14+
}
15+
16+
bool TestApplication::initCocos2d()
17+
{
18+
// init director
19+
CCDirector * pDirector = CCDirector::getSharedDirector();
20+
pDirector->setOpenGLView(&m_MainForm);
21+
22+
pDirector->setDisplayFPS(true);
23+
24+
CCScene * pScene = CCScene::node();
25+
CCLayer * pLayer = new TestController();
26+
pLayer->autorelease();
27+
28+
pScene->addChild(pLayer);
29+
pDirector->replaceScene(pScene);
30+
31+
return true;
32+
}
33+
34+
void TestApplication::applicationDidEnterBackground()
35+
{
36+
CCDirector::getSharedDirector()->stopAnimation();
37+
}
38+
39+
void TestApplication::applicationWillEnterForeground()
40+
{
41+
CCDirector::getSharedDirector()->startAnimation();
42+
}

test_win32/TestApplication.h

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#ifndef __TEST_APPLICATION_H__
2+
#define __TEST_APPLICATION_H__
3+
4+
#include "cocos2d.h"
5+
6+
class TestApplication : public cocos2d::CCXApplication
7+
{
8+
public:
9+
virtual bool initCocos2d();
10+
virtual bool InitInstance();
11+
12+
virtual void applicationDidEnterBackground();
13+
virtual void applicationWillEnterForeground();
14+
15+
protected:
16+
cocos2d::CCXEGLView m_MainForm;
17+
};
18+
19+
#endif // __TEST_APPLICATION_H__

test_win32/application.cpp

Whitespace-only changes.

test_win32/application.h

Whitespace-only changes.

test_win32/copy_res.bat

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
echo off
2+
set OUTPUT_BY_SVN=1
3+
set TOOLSDIR=..
4+
call %TOOLSDIR%\output.bat %CD%\Res %1

0 commit comments

Comments
 (0)