This commit is contained in:
Ming 2010-07-27 05:47:29 +00:00
Родитель e946042ce2
Коммит 5eede62659
22 изменённых файлов: 56 добавлений и 81 удалений

Просмотреть файл

@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __CCCONFIGURATION_H__
#define __CCCONFIGURATION_H__
#include "platform/Cocos2dTypes.h"
#include "platform/platform.h"
#include "cocoa/NSObject.h"
#include <GLES/gl.h>
#include <string>

Просмотреть файл

@ -45,7 +45,7 @@ extern "C" {
*/
#include "Cocoa/CGGeometry.h" // for CGPoint
#include "platform/Cocos2dTypes.h"
#include "platform/platform.h"
/** draws a point given x and y coordinate */
void ccDrawPoint( CGPoint point );

Просмотреть файл

@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __CCSCHEDULER_H__
#define __CCSCHEDULER_H__
#include "platform/Cocos2dTypes.h"
#include "platform/platform.h"
#include "cocoa/NSObject.h"
#include "cocoa/selector_protocol.h"
#include "support/data_support/uthash.h"

Просмотреть файл

@ -26,7 +26,7 @@ THE SOFTWARE.
#define __COCOA_NS_MUTATLE_ARRAY_H__
#include "cocoa/NSObject.h"
#include "platform/Cocos2dTypes.h"
#include "platform/platform.h"
#include <vector>
template<class T = NSObject*>

Просмотреть файл

@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __COCOA_NSOBJECT_H__
#define __COCOA_NSOBJECT_H__
#include "platform/Cocos2dTypes.h"
#include "platform/platform.h"
class NSZone;
class NSObject;
class NSString;

Просмотреть файл

@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __NS_ZONE_H__
#define __NS_ZONE_H__
#include "platform/Cocos2dTypes.h"
#include "platform/platform.h"
class NSObject;

Просмотреть файл

@ -27,6 +27,7 @@ THE SOFTWARE.
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstdio>
/**
@file
@ -53,14 +54,14 @@ THE SOFTWARE.
#define CCLOGERROR(...) do {} while (0)
#elif COCOS2D_DEBUG == 1
#define CCLOG(...) printf(__VA_ARGS__)
#define CCLOGERROR(...) printf(__VA_ARGS__)
#define CCLOG(...) std::printf(__VA_ARGS__)
#define CCLOGERROR(...) std::printf(__VA_ARGS__)
#define CCLOGINFO(...) do {} while (0)
#elif COCOS2D_DEBUG > 1
#define CCLOG(...) printf(__VA_ARGS__)
#define CCLOGERROR(...) printf(__VA_ARGS__)
#define CCLOGINFO(...) printf(__VA_ARGS__)
#define CCLOG(...) std::printf(__VA_ARGS__)
#define CCLOGERROR(...) std::printf(__VA_ARGS__)
#define CCLOGINFO(...) std::printf(__VA_ARGS__)
#endif // COCOS2D_DEBUG
/** @def CC_SWAP

Просмотреть файл

@ -26,7 +26,7 @@ THE SOFTWARE.
#define __CCTYPES_H__
#include "cocoa/CGGeometry.h"
#include "platform/Cocos2dTypes.h"
#include "platform/platform.h"
#include <GLES/gl.h>
/** RGB color composed of bytes 3 bytes

Просмотреть файл

@ -30,6 +30,7 @@ THE SOFTWARE.
#include "uphone/CCTime.h"
#include "uphone/NSLock.h"
#include "uphone/UIImage.h"
#include "uphone/Cocos2dTypes.h"
#else
#error "no platform flag defined!!"
#endif

Просмотреть файл

@ -25,11 +25,10 @@ THE SOFTWARE.
#ifndef __PLATFORM_UPHONE_CCFILE_UTILS_H__
#define __PLATFORM_UPHONE_CCFILE_UTILS_H__
#include "cocoa/NSObject.h"
#include <ssFile.h>
// Helper class to handle file operations
class CCFileUtils : public NSObject
class CCFileUtils
{
public:
static char* fullPathFromRelativePath(const char *pszRealPath);

Просмотреть файл

@ -25,8 +25,6 @@ THE SOFTWARE.
#ifndef __PLATFORM_UPHONE_CCTIME_H__
#define __PLATFORM_UPHONE_CCTIME_H__
#include "Cocos2dTypes.h"
struct cc_timeval
{
long tv_sec; // seconds
@ -36,7 +34,7 @@ struct cc_timeval
class CCTime
{
public:
static INT32 gettimeofday(struct cc_timeval *tp, void *tzp);
static int gettimeofday(struct cc_timeval *tp, void *tzp);
};
#endif // __PLATFORM_UPHONE_NSTIME_H__

Просмотреть файл

@ -25,36 +25,13 @@ THE SOFTWARE.
#ifndef __SUPPORT_COCOS2D_TYPES_H__
#define __SUPPORT_COCOS2D_TYPES_H__
// we support uphone now
#define _UPHONE 1
typedef signed char INT8;
typedef unsigned char UINT8;
typedef signed short INT16;
typedef unsigned short UINT16;
typedef signed int INT32;
typedef unsigned int UINT32;
typedef long long INT64;
typedef unsigned long long UINT64;
// define import export
#if defined(_UPHONE)
#define COCOS2D_IMPORT SS_IMPORT
#define COCOS2D_EXPORT SS_EXPORT
// support other platform here
#endif //_UPHONE
// define data types
#if defined(_UPHONE)
#include <ssTypes.h>
// undefine the types first
#undef INT8
#undef UINT8
#undef INT16
#undef UINT16
#undef INT32
#undef INT64
#undef UINT64
#define INT8 Int8
#define UINT8 UInt8
#define INT16 Int16
#define UINT16 UInt16
#define INT32 Int32
#define UINT32 UInt32
#define INT64 Int64
#define UINT64 UInt64
#endif // _UPHONE
#endif // __SUPPORT_COCOS2D_TYPES_H__
#endif // __SUPPORT_COCOS2D_TYPES_H__

Просмотреть файл

@ -152,17 +152,21 @@ UINT8* UIImage::getRGBA8888Data(void)
const TBitmap *pBitmap;
int nW;
int nH;
int nD;
UINT8 *pDataPtr;
// convert to RGBA8888 format
pBitmap = m_pBitmap->DupBitmapTo32();
if (pBitmp == NULL)
if (pBitmap == NULL)
{
break;
}
pBufferRet
// compute width and height
nW = pBitmap->GetWidth();
nH = pBitmap->GetHeight();
// alloc memory and store the bitmap data
pBufferRet = new UINT8(nW * nH * 4);
memcpy(pBufferRet, pBitmap->GetDataPtr(), nW * nH * 4);
} while(0);
return pBufferRet;

Просмотреть файл

@ -33,7 +33,7 @@ THE SOFTWARE.
#include "cocoa/CGGeometry.h"
#include "CCTexture2D.h"
#include "cocoa/CGAffineTransform.h"
#include "sstsd.h"
#include <string.h>
using namespace std;

Просмотреть файл

@ -22,18 +22,18 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include <stdio.h>
#include <cstdio>
#include <stdlib.h>
#include "base64.h"
unsigned char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
INT32 _base64Decode( unsigned char *input, UINT32 input_len, unsigned char *output, UINT32 *output_len )
int _base64Decode( unsigned char *input, unsigned int input_len, unsigned char *output, unsigned int *output_len )
{
static char inalphabet[256], decoder[256];
INT32 i, bits, c, char_count, errors = 0;
UINT32 input_idx = 0;
UINT32 output_idx = 0;
int i, bits, c, char_count, errors = 0;
unsigned int input_idx = 0;
unsigned int output_idx = 0;
for (i = (sizeof alphabet) - 1; i >= 0 ; i--) {
inalphabet[alphabet[i]] = 1;
@ -64,7 +64,7 @@ INT32 _base64Decode( unsigned char *input, UINT32 input_len, unsigned char *outp
if( c == '=' ) {
switch (char_count) {
case 1:
fprintf(stderr, "base64Decode: encoding incomplete: at least 2 bits missing");
std::fprintf(stderr, "base64Decode: encoding incomplete: at least 2 bits missing");
errors++;
break;
case 2:
@ -77,7 +77,7 @@ INT32 _base64Decode( unsigned char *input, UINT32 input_len, unsigned char *outp
}
} else if ( input_idx < input_len ) {
if (char_count) {
fprintf(stderr, "base64 encoding incomplete: at least %d bits truncated",
std::fprintf(stderr, "base64 encoding incomplete: at least %d bits truncated",
((4 - char_count) * 6));
errors++;
}
@ -87,18 +87,18 @@ INT32 _base64Decode( unsigned char *input, UINT32 input_len, unsigned char *outp
return errors;
}
INT32 base64Decode(unsigned char *in, UINT32 inLength, unsigned char **out)
int base64Decode(unsigned char *in, unsigned int inLength, unsigned char **out)
{
UINT32 outLength = 0;
unsigned int outLength = 0;
//should be enough to store 6-bit buffers in 8-bit buffers
*out = (unsigned char *)malloc( (size_t)(inLength * 3.0f / 4.0f + 1));
if( *out ) {
INT32 ret = _base64Decode(in, inLength, *out, &outLength);
int ret = _base64Decode(in, inLength, *out, &outLength);
if (ret > 0 )
{
printf("Base64Utils: error decoding");
std::printf("Base64Utils: error decoding");
free(*out);
*out = NULL;
outLength = 0;

Просмотреть файл

@ -25,8 +25,6 @@ THE SOFTWARE.
#ifndef __SUPPORT_BASE64_H__
#define __SUPPORT_BASE64_H__
#include "platform/Cocos2dTypes.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -44,7 +42,7 @@ extern "C" {
*
@since v0.8.1
*/
INT32 base64Decode(unsigned char *in, unsigned int inLength, unsigned char **out);
int base64Decode(unsigned char *in, unsigned int inLength, unsigned char **out);
#ifdef __cplusplus
}

Просмотреть файл

@ -21,10 +21,8 @@ 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "TGAlib.h"

Просмотреть файл

@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __SUPPORT_DATA_SUPPORT_TGALIB_H__
#define __SUPPORT_DATA_SUPPORT_TGALIB_H__
#include "platform/Cocos2dTypes.h"
#include "platform/platform.h"
enum {
TGA_OK,

Просмотреть файл

@ -24,14 +24,15 @@ THE SOFTWARE.
#ifndef __SUPPORT_OPGL_SUPPORT_OPGL_INTERNAL_H__
#define __SUPPORT_OPGL_SUPPORT_OPGL_INTERNAL_H__
#include <cstdio>
/* Generic error reporting */
#define REPORT_ERROR(__FORMAT__, ...) printf("%s: %s\n", __FUNCTION__, __VA_ARGS__)
#define REPORT_ERROR(__FORMAT__, ...) std::printf("%s: %s\n", __FUNCTION__, __VA_ARGS__)
/* EAGL and GL functions calling wrappers that log on error */
#define CALL_EAGL_FUNCTION(__FUNC__, ...) ({ EAGLError __error = __FUNC__( __VA_ARGS__ ); if(__error != kEAGLErrorSuccess) printf("%s() called from %s returned error %i\n", #__FUNC__, __FUNCTION__, __error); (__error ? false : true); })
#define CALL_EAGL_FUNCTION(__FUNC__, ...) ({ EAGLError __error = __FUNC__( __VA_ARGS__ ); if(__error != kEAGLErrorSuccess) std::printf("%s() called from %s returned error %i\n", #__FUNC__, __FUNCTION__, __error); (__error ? false : true); })
//#define CHECK_GL_ERROR() ({ GLenum __error = glGetError(); if(__error) printf("OpenGL error 0x%04X in %s\n", __error, __FUNCTION__); (__error ? NO : YES); })
#define CHECK_GL_ERROR() ({ GLenum __error = glGetError(); if(__error) printf("OpenGL error 0x%04X in %s\n", __error, __FUNCTION__); })
#define CHECK_GL_ERROR() ({ GLenum __error = glGetError(); if(__error) std::printf("OpenGL error 0x%04X in %s\n", __error, __FUNCTION__); })
/* Optional delegate methods support */
#ifndef __DELEGATE_IVAR__

Просмотреть файл

@ -37,7 +37,7 @@ THE SOFTWARE.
#include "CCTexture2D.h"
#include "CCPVRTexture.h"
#include "CCConfiguration.h"
#include "platform/UIImage.h"
#include "platform/platform.h"
#if CC_FONT_LABEL_SUPPORT

Просмотреть файл

@ -27,9 +27,7 @@ THE SOFTWARE.
#include "CCTexture2D.h"
#include "ccMacros.h"
#include "cocoa/NSData.h"
#include "platform/NSLock.h"
#include "platform/CCFileUtils.h"
#include "platform/UIImage.h"
#include "platform/platform.h"
//#include "CCDirector.h"
/// @todo EAGLContext static EAGLContext *auxEAGLcontext = NULL;

Просмотреть файл

@ -26,7 +26,7 @@ THE SOFTWARE.
#include "CCTouchHandler.h"
#include "../cocoa/NSMutableArray.h"
#include "../cocoa/NSSet.h"
#include "../platform/CCTouch.h"
#include "platform/CCTouchPlatform.h"
#include "CCTexture2D.h"
#include <assert.h>