CCLOG support for cocos2d-win32

This commit is contained in:
yangws 2010-11-23 11:23:29 +08:00
parent efd69c7023
commit de97900b6c
6 changed files with 109 additions and 13 deletions

29
.gitignore vendored Normal file
View File

@ -0,0 +1,29 @@
#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.aps
*.vcproj.*.user
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*

View File

@ -13,18 +13,20 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "tests\proj.win32\t
{929480E7-23C0-4DF6-8456-096D71547116} = {929480E7-23C0-4DF6-8456-096D71547116} {929480E7-23C0-4DF6-8456-096D71547116} = {929480E7-23C0-4DF6-8456-096D71547116}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "box2d", "Box2D\proj.win32\Box2D.win32.vcproj", "{929480E7-23C0-4DF6-8456-096D71547116}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libBox2D", "Box2D\proj.win32\Box2D.win32.vcproj", "{929480E7-23C0-4DF6-8456-096D71547116}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chipmunk", "chipmunk\proj.win32\chipmunk.win32.vcproj", "{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libchipmunk", "chipmunk\proj.win32\chipmunk.win32.vcproj", "{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cocosdenshion", "CocosDenshion\proj.win32\CocosDenshion.win32.vcproj", "{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCocosDenshion", "CocosDenshion\proj.win32\CocosDenshion.win32.vcproj", "{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorld", "HelloWorld.win32\HelloWorld.win32.vcproj", "{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorld", "HelloWorld.win32\HelloWorld.win32.vcproj", "{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cocos2d-win32", "cocos2dx\proj.win32\cocos2d-win32.vcproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "cocos2dx\proj.win32\cocos2d-win32.vcproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestWin32Wizard.win32", "TestWin32Wizard\TestWin32Wizard.win32.vcproj", "{2CADAE24-E793-480C-883F-6D90244B1ABD}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -60,6 +62,10 @@ Global
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.Build.0 = Debug|Win32 {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.Build.0 = Debug|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.ActiveCfg = Release|Win32 {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.ActiveCfg = Release|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.Build.0 = Release|Win32 {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.Build.0 = Release|Win32
{2CADAE24-E793-480C-883F-6D90244B1ABD}.Debug|Win32.ActiveCfg = Debug|Win32
{2CADAE24-E793-480C-883F-6D90244B1ABD}.Debug|Win32.Build.0 = Debug|Win32
{2CADAE24-E793-480C-883F-6D90244B1ABD}.Release|Win32.ActiveCfg = Release|Win32
{2CADAE24-E793-480C-883F-6D90244B1ABD}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -52,19 +52,21 @@ THE SOFTWARE.
*/ */
#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0 #if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0
#define CCLOG(...) do {} while (0) #define CCLOG(...) do {} while (0)
#define CCLOGINFO(...) do {} while (0) #define CCLOGINFO(...) do {} while (0)
#define CCLOGERROR(...) do {} while (0) #define CCLOGERROR(...) do {} while (0)
#elif COCOS2D_DEBUG == 1 #elif COCOS2D_DEBUG == 1
#define CCLOG(...) std::printf(__VA_ARGS__) #include "ccxCommon.h"
#define CCLOGERROR(...) std::printf(__VA_ARGS__) #define CCLOG(format, ...) cocos2d::CCXLog(format, __VA_ARGS__)
#define CCLOGINFO(...) do {} while (0) #define CCLOGERROR(format,...) cocos2d::CCXLog(format, __VA_ARGS__)
#define CCLOGINFO(format,...) do {} while (0)
#elif COCOS2D_DEBUG > 1 #elif COCOS2D_DEBUG > 1
#define CCLOG(...) std::printf(__VA_ARGS__) #include "ccxCommon.h"
#define CCLOGERROR(...) std::printf(__VA_ARGS__) #define CCLOG(format, ...) cocos2d::CCXLog(format, __VA_ARGS__)
#define CCLOGINFO(...) std::printf(__VA_ARGS__) #define CCLOGERROR(format,...) cocos2d::CCXLog(format, __VA_ARGS__)
#define CCLOGINFO(format,...) cocos2d::CCXLog(format, __VA_ARGS__)
#endif // COCOS2D_DEBUG #endif // COCOS2D_DEBUG
/** @def CC_SWAP /** @def CC_SWAP

View File

@ -0,0 +1,46 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "ccxCommon_win32.h"
#include <Windows.h>
#include <stdio.h>
#include <stdarg.h>
#define MAX_LEN 256
namespace cocos2d {
void CCXLog(const char * pszFormat, ...)
{
char szBuf[MAX_LEN];
va_list ap;
va_start(ap, pszFormat);
vsprintf_s(szBuf, MAX_LEN, pszFormat, ap);
va_end(ap);
OutputDebugStringA(szBuf);
}
}//namespace cocos2d

View File

@ -31,4 +31,13 @@ THE SOFTWARE.
#define CCX_DLL __declspec(dllimport) #define CCX_DLL __declspec(dllimport)
#endif #endif
namespace cocos2d{
/**
@brief Output Debug message to VS Output window.
*/
void CCX_DLL CCXLog(const char * pszFormat, ...);
}//namespace cocos2d
#endif // end of __CCX_COMMON_WIN32__ #endif // end of __CCX_COMMON_WIN32__

View File

@ -769,6 +769,10 @@
RelativePath="..\platform\win32\CCXCocos2dDefine_win32.h" RelativePath="..\platform\win32\CCXCocos2dDefine_win32.h"
> >
</File> </File>
<File
RelativePath="..\platform\win32\CCXCommon_win32.cpp"
>
</File>
<File <File
RelativePath="..\platform\win32\ccxCommon_win32.h" RelativePath="..\platform\win32\ccxCommon_win32.h"
> >