Skip to content

Commit a500e7f

Browse files
halx99minggo
authored andcommitted
Rename cocos2d::MessageBox to cocos2d::ccMessageBox. (#20159)
* Rename cocos2d::MessageBox to cocos2d::ccMessageBox to avoid confilicit with win32 API macro 'MessageBox'. * Sync non-win32 platforms.
1 parent 8f17512 commit a500e7f

File tree

8 files changed

+10
-15
lines changed

8 files changed

+10
-15
lines changed

cocos/platform/CCCommon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void CC_DLL LuaLog(const char * format);
4545
/**
4646
@brief Pop out a message box
4747
*/
48-
void CC_DLL MessageBox(const char * msg, const char * title);
48+
void CC_DLL ccMessageBox(const char * msg, const char * title);
4949

5050
/**
5151
@brief Enum the language type supported now

cocos/platform/android/CCCommon-android.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ NS_CC_BEGIN
3737

3838
#define MAX_LEN (cocos2d::kMaxLogLen + 1)
3939

40-
void MessageBox(const char * pszMsg, const char * pszTitle)
40+
void ccMessageBox(const char * pszMsg, const char * pszTitle)
4141
{
4242
JniHelper::callStaticVoidMethod("org.cocos2dx.lib.Cocos2dxHelper", "showDialog", pszTitle, pszMsg);
4343
}

cocos/platform/desktop/CCGLViewImpl-desktop.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float fram
308308
message.append(_glfwError);
309309
}
310310

311-
MessageBox(message.c_str(), "Error launch application");
311+
ccMessageBox(message.c_str(), "Error launch application");
312312
return false;
313313
}
314314

@@ -357,7 +357,7 @@ bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float fram
357357
sprintf(strComplain,
358358
"OpenGL 1.5 or higher is required (your version is %s). Please upgrade the driver of your video card.",
359359
glVersion);
360-
MessageBox(strComplain, "OpenGL version too old");
360+
ccMessageBox(strComplain, "OpenGL version too old");
361361
return false;
362362
}
363363

@@ -1026,7 +1026,7 @@ bool GLViewImpl::initGlew()
10261026
GLenum GlewInitResult = glewInit();
10271027
if (GLEW_OK != GlewInitResult)
10281028
{
1029-
MessageBox((char *)glewGetErrorString(GlewInitResult), "OpenGL error");
1029+
ccMessageBox((char *)glewGetErrorString(GlewInitResult), "OpenGL error");
10301030
return false;
10311031
}
10321032

@@ -1051,7 +1051,7 @@ bool GLViewImpl::initGlew()
10511051
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
10521052
if(glew_dynamic_binding() == false)
10531053
{
1054-
MessageBox("No OpenGL framebuffer support. Please upgrade the driver of your video card.", "OpenGL error");
1054+
ccMessageBox("No OpenGL framebuffer support. Please upgrade the driver of your video card.", "OpenGL error");
10551055
return false;
10561056
}
10571057
#endif

cocos/platform/ios/CCCommon-ios.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ of this software and associated documentation files (the "Software"), to deal
3939
NS_CC_BEGIN
4040

4141
// ios no MessageBox, use log instead
42-
void MessageBox(const char * msg, const char * title)
42+
void ccMessageBox(const char * msg, const char * title)
4343
{
4444
// only enable it on iOS.
4545
// FIXME: Implement it for tvOS

cocos/platform/linux/CCCommon-linux.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ THE SOFTWARE.
3333

3434
NS_CC_BEGIN
3535

36-
void MessageBox(const char * msg, const char * title)
36+
void ccMessageBox(const char * msg, const char * title)
3737
{
3838
log("%s: %s", title, msg);
3939
}

cocos/platform/mac/CCCommon-mac.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void LuaLog(const char * format)
4343
}
4444

4545
// ios no MessageBox, use log instead
46-
void MessageBox(const char * msg, const char * title)
46+
void ccMessageBox(const char * msg, const char * title)
4747
{
4848
NSString * tmpTitle = (title) ? [NSString stringWithUTF8String : title] : nil;
4949
NSString * tmpMsg = (msg) ? [NSString stringWithUTF8String : msg] : nil;

cocos/platform/win32/CCCommon-win32.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ NS_CC_BEGIN
3535

3636
#define MAX_LEN (cocos2d::kMaxLogLen + 1)
3737

38-
void MessageBox(const char * pszMsg, const char * pszTitle)
38+
void ccMessageBox(const char * pszMsg, const char * pszTitle)
3939
{
4040
std::wstring wsMsg = cocos2d::StringUtf8ToWideChar(pszMsg);
4141
std::wstring wsTitle = cocos2d::StringUtf8ToWideChar(pszTitle);

cocos/platform/win32/CCStdC-win32.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,6 @@ inline errno_t strcpy_s(char *strDestination, size_t numberOfElements,
140140
#endif
141141
#endif // __MINGW32__
142142

143-
// Conflicted with cocos2d::MessageBox, so we need to undef it.
144-
#ifdef MessageBox
145-
#undef MessageBox
146-
#endif
147-
148143
// Conflicted with ParticleSystem::PositionType::RELATIVE, so we need to undef it.
149144
#ifdef RELATIVE
150145
#undef RELATIVE

0 commit comments

Comments
 (0)