From 4957c72a0d7d95cabc162f775446de78e2d2f178 Mon Sep 17 00:00:00 2001 From: yangws Date: Mon, 11 Oct 2010 09:26:01 +0000 Subject: [PATCH] issue #176 add test_win32 project. --- Helloworld-win32/Helloworld-win32.cpp | 9 +- Helloworld-win32/Helloworld-win32.vcproj | 4 - Helloworld-win32/ReadMe.txt | 55 ------ cocos2dx-win32.sln | 6 + test_win32/application.cpp | 0 test_win32/application.h | 0 test_win32/mainform.cpp | 0 test_win32/mainform.h | 0 test_win32/test-win32.vcproj | 203 +++++++++++++++++++++++ test_win32/winmain.cpp | 22 +++ test_win32/winmain.h | 16 ++ 11 files changed, 252 insertions(+), 63 deletions(-) delete mode 100644 Helloworld-win32/ReadMe.txt create mode 100644 test_win32/application.cpp create mode 100644 test_win32/application.h create mode 100644 test_win32/mainform.cpp create mode 100644 test_win32/mainform.h create mode 100644 test_win32/test-win32.vcproj create mode 100644 test_win32/winmain.cpp create mode 100644 test_win32/winmain.h diff --git a/Helloworld-win32/Helloworld-win32.cpp b/Helloworld-win32/Helloworld-win32.cpp index 0714e98562..49598fd886 100644 --- a/Helloworld-win32/Helloworld-win32.cpp +++ b/Helloworld-win32/Helloworld-win32.cpp @@ -9,7 +9,7 @@ using namespace cocos2d; #define IMG_PATH "HelloWorld.png" -static HINSTANCE g_hInstance; +static HINSTANCE s_hInstance; ////////////////////////////////////////////////////////////////////////// // implement MyLayer @@ -83,12 +83,13 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); - g_hInstance = hInstance; + s_hInstance = hInstance; + int nRet = 0; HelloWorldApplication app; if (app.InitInstance() && app.initCocos2d()) { - app.Run(); + nRet = app.Run(); } - return 0; + return nRet; } diff --git a/Helloworld-win32/Helloworld-win32.vcproj b/Helloworld-win32/Helloworld-win32.vcproj index 53af0a7077..98fa589ec4 100644 --- a/Helloworld-win32/Helloworld-win32.vcproj +++ b/Helloworld-win32/Helloworld-win32.vcproj @@ -219,10 +219,6 @@ > - - diff --git a/Helloworld-win32/ReadMe.txt b/Helloworld-win32/ReadMe.txt deleted file mode 100644 index 83825a7f7f..0000000000 --- a/Helloworld-win32/ReadMe.txt +++ /dev/null @@ -1,55 +0,0 @@ -======================================================================== - WIN32 APPLICATION : Helloworld-win32 Project Overview -======================================================================== - -AppWizard has created this Helloworld-win32 application for you. - -This file contains a summary of what you will find in each of the files that -make up your Helloworld-win32 application. - - -Helloworld-win32.vcproj - This is the main project file for VC++ projects generated using an Application Wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - Application Wizard. - -Helloworld-win32.cpp - This is the main application source file. - -///////////////////////////////////////////////////////////////////////////// -AppWizard has created the following resources: - -Helloworld-win32.rc - This is a listing of all of the Microsoft Windows resources that the - program uses. It includes the icons, bitmaps, and cursors that are stored - in the RES subdirectory. This file can be directly edited in Microsoft - Visual C++. - -Resource.h - This is the standard header file, which defines new resource IDs. - Microsoft Visual C++ reads and updates this file. - -Helloworld-win32.ico - This is an icon file, which is used as the application's icon (32x32). - This icon is included by the main resource file Helloworld-win32.rc. - -small.ico - This is an icon file, which contains a smaller version (16x16) - of the application's icon. This icon is included by the main resource - file Helloworld-win32.rc. - -///////////////////////////////////////////////////////////////////////////// -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named Helloworld-win32.pch and a precompiled types file named StdAfx.obj. - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" comments to indicate parts of the source code you -should add to or customize. - -///////////////////////////////////////////////////////////////////////////// diff --git a/cocos2dx-win32.sln b/cocos2dx-win32.sln index 80de5c293a..72149c4fc7 100644 --- a/cocos2dx-win32.sln +++ b/cocos2dx-win32.sln @@ -12,6 +12,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chipmunk-win32", "chipmunk\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Box2D-win32", "Box2D\Box2D-win32.vcproj", "{929480E7-23C0-4DF6-8456-096D71547116}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-win32", "test_win32\test-win32.vcproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -34,6 +36,10 @@ Global {929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.Build.0 = Debug|Win32 {929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.ActiveCfg = Release|Win32 {929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.Build.0 = Release|Win32 + {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.ActiveCfg = Debug|Win32 + {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.Build.0 = Debug|Win32 + {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.ActiveCfg = Release|Win32 + {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/test_win32/application.cpp b/test_win32/application.cpp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test_win32/application.h b/test_win32/application.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test_win32/mainform.cpp b/test_win32/mainform.cpp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test_win32/mainform.h b/test_win32/mainform.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test_win32/test-win32.vcproj b/test_win32/test-win32.vcproj new file mode 100644 index 0000000000..9e6784720e --- /dev/null +++ b/test_win32/test-win32.vcproj @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test_win32/winmain.cpp b/test_win32/winmain.cpp new file mode 100644 index 0000000000..ecd2a8b078 --- /dev/null +++ b/test_win32/winmain.cpp @@ -0,0 +1,22 @@ +#include "winmain.h" + +HINSTANCE g_hInstance; + +int APIENTRY _tWinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) +{ + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + g_hInstance = hInstance; + + int nRet = 0; +// HelloWorldApplication app; +// if (app.InitInstance() && app.initCocos2d()) +// { +// nRet = app.Run(); +// } + return nRet; +} diff --git a/test_win32/winmain.h b/test_win32/winmain.h new file mode 100644 index 0000000000..912c385fba --- /dev/null +++ b/test_win32/winmain.h @@ -0,0 +1,16 @@ +#ifndef __WINMAIN_H__ +#define __WINMAIN_H__ + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include + +extern HINSTANCE g_hInstance; + +#endif // __WINMAIN_H__