当前位置: 首页 > 工具软件 > cclog > 使用案例 >

CCCommon(CCLog CCLuaLog CCMessageBox)

白彦
2023-12-01

#ifndef __CC_COMMON_H__

#define __CC_COMMON_H__


#include "CCPlatformMacros.h"


NS_CC_BEGIN


/// The max length of CCLog message.

static const int kMaxLogLen = 16*1024;

/**

@brief Output Debug message.

*/

void CC_DLL CCLog(const char * pszFormat, ...) CC_FORMAT_PRINTF(1, 2);

{

    printf("Cocos2d: ");

    char szBuf[kMaxLogLen+1] = {0};

    va_list ap;

    va_start(ap, pszFormat);

    vsnprintf(szBuf, kMaxLogLen, pszFormat, ap);

    va_end(ap);

    printf("%s", szBuf);

    printf("\n");

}


/**

 * lua can not deal with ...

 */

void CC_DLL CCLuaLog(const char * pszFormat);

{

    puts(pszFormat);

}


/**

@brief Pop out a message box

*/

void CC_DLL CCMessageBox(const char * pszMsg, const char * pszTitle);

{

    NSString * title = (pszTitle) ? [NSString stringWithUTF8String : pszTitle] : nil;

    NSString * msg = (pszMsg) ? [NSString stringWithUTF8String : pszMsg] : nil;

    UIAlertView * messageBox = [[UIAlertView alloc] initWithTitle: title

                                                          message: msg

                                                         delegate: nil

                                                cancelButtonTitle: @"OK"

                                                otherButtonTitles: nil];

    [messageBox autorelease];

    [messageBox show];

}


/**

@brief Enum the language type supported now

*/

typedef enum LanguageType

{

    kLanguageEnglish = 0,

    kLanguageChinese,

    kLanguageFrench,

    kLanguageItalian,

    kLanguageGerman,

    kLanguageSpanish,

    kLanguageRussian,

    kLanguageKorean,

    kLanguageJapanese,

    kLanguageHungarian,

    kLanguagePortuguese,

    kLanguageArabic

} ccLanguageType;


// end of platform group

/// @}


NS_CC_END


#endif    // __CC_COMMON_H__


 类似资料:

相关阅读

相关文章

相关问答