Merge branch 'gles20' of https://github.com/cocos2d/cocos2d-x into gles20

This commit is contained in:
jzgenius 2012-09-24 17:58:46 +08:00
commit 0e934be5ce
143 changed files with 1517 additions and 1664 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "tools/cxx-generator"] [submodule "tools/cxx-generator"]
path = tools/cxx-generator path = tools/cxx-generator
url = git://github.com/funkaster/cxx-generator.git url = git://github.com/funkaster/cxx-generator.git
[submodule "scripting/javascript/bindings/generated"]
path = scripting/javascript/bindings/generated
url = git://github.com/folecr/cocos2dx-autogen-bindings.git

View File

@ -35,6 +35,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCpp", "samples\TestCpp\
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestJavascript", "samples\TestJavascript\proj.win32\TestJavascript.vcproj", "{D0F06A44-A245-4D13-A498-0120C203B539}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestJavascript", "samples\TestJavascript\proj.win32\TestJavascript.vcproj", "{D0F06A44-A245-4D13-A498-0120C203B539}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28}
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25} {207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
@ -53,6 +54,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestLua", "samples\TestLua\
EndProjectSection EndProjectSection
EndProject EndProject
Global Global
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32
@ -106,7 +110,4 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection
EndGlobal EndGlobal

View File

@ -19,6 +19,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCpp", "samples\TestCpp\
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestJavascript", "samples\TestJavascript\proj.win32\TestJavascript.vcxproj", "{D0F06A44-A245-4D13-A498-0120C203B539}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestJavascript", "samples\TestJavascript\proj.win32\TestJavascript.vcxproj", "{D0F06A44-A245-4D13-A498-0120C203B539}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28}
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25} {207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
EndProjectSection EndProjectSection
EndProject EndProject

View File

@ -99,6 +99,8 @@ CCNode::CCNode(void)
CCNode::~CCNode(void) CCNode::~CCNode(void)
{ {
CCLOGINFO( "cocos2d: deallocing" ); CCLOGINFO( "cocos2d: deallocing" );
unregisterScriptHandler();
CC_SAFE_RELEASE(m_pActionManager); CC_SAFE_RELEASE(m_pActionManager);
CC_SAFE_RELEASE(m_pScheduler); CC_SAFE_RELEASE(m_pScheduler);

View File

@ -60,7 +60,7 @@ public:
strcpy(m_szKey, pStart); strcpy(m_szKey, pStart);
} }
CCDictElement(int iKey, CCObject* pObject) CCDictElement(intptr_t iKey, CCObject* pObject)
{ {
init(); init();
m_iKey = iKey; m_iKey = iKey;
@ -73,7 +73,7 @@ public:
return m_szKey; return m_szKey;
} }
inline int getIntKey() const inline intptr_t getIntKey() const
{ {
CCAssert(m_szKey[0] == '\0', "Should not call this function for string dictionary"); CCAssert(m_szKey[0] == '\0', "Should not call this function for string dictionary");
return m_iKey; return m_iKey;
@ -95,7 +95,7 @@ private:
private: private:
char m_szKey[MAX_KEY_LEN+1]; /** hash key of string type*/ char m_szKey[MAX_KEY_LEN+1]; /** hash key of string type*/
int m_iKey; /** hash key of integer type */ intptr_t m_iKey; /** hash key of integer type */
CCObject* m_pObject;/** hash value */ CCObject* m_pObject;/** hash value */
public: public:
UT_hash_handle hh; /* makes this class hashable */ UT_hash_handle hh; /* makes this class hashable */

View File

@ -97,18 +97,18 @@ CCLayer *CCLayer::create()
void CCLayer::registerWithTouchDispatcher() void CCLayer::registerWithTouchDispatcher()
{ {
CCDirector* pDirector = CCDirector::sharedDirector(); CCTouchDispatcher* pDispatcher = CCDirector::sharedDirector()->getTouchDispatcher();
if (m_pScriptHandlerEntry) if (m_pScriptHandlerEntry)
{ {
if (m_pScriptHandlerEntry->isMultiTouches()) if (m_pScriptHandlerEntry->isMultiTouches())
{ {
pDirector->getTouchDispatcher()->addStandardDelegate(this, 0); pDispatcher->addStandardDelegate(this, 0);
LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptHandlerEntry->getHandler()); LUALOG("[LUA] Add multi-touches event handler: %d", m_pScriptHandlerEntry->getHandler());
} }
else else
{ {
pDirector->getTouchDispatcher()->addTargetedDelegate(this, pDispatcher->addTargetedDelegate(this,
m_pScriptHandlerEntry->getPriority(), m_pScriptHandlerEntry->getPriority(),
m_pScriptHandlerEntry->getSwallowsTouches()); m_pScriptHandlerEntry->getSwallowsTouches());
LUALOG("[LUA] Add touch event handler: %d", m_pScriptHandlerEntry->getHandler()); LUALOG("[LUA] Add touch event handler: %d", m_pScriptHandlerEntry->getHandler());
@ -116,7 +116,7 @@ void CCLayer::registerWithTouchDispatcher()
return; return;
} }
pDirector->getTouchDispatcher()->addStandardDelegate(this, 0); pDispatcher->addStandardDelegate(this, 0);
} }
void CCLayer::registerScriptTouchHandler(int nHandler, bool bIsMultiTouches, int nPriority, bool bSwallowsTouches) void CCLayer::registerScriptTouchHandler(int nHandler, bool bIsMultiTouches, int nPriority, bool bSwallowsTouches)
@ -128,12 +128,8 @@ void CCLayer::registerScriptTouchHandler(int nHandler, bool bIsMultiTouches, int
void CCLayer::unregisterScriptTouchHandler(void) void CCLayer::unregisterScriptTouchHandler(void)
{ {
if (m_pScriptHandlerEntry) CC_SAFE_RELEASE_NULL(m_pScriptHandlerEntry);
{
m_pScriptHandlerEntry->release();
m_pScriptHandlerEntry = NULL;
} }
}
int CCLayer::excuteScriptTouchHandler(int nEventType, CCTouch *pTouch) int CCLayer::excuteScriptTouchHandler(int nEventType, CCTouch *pTouch)
{ {
@ -165,8 +161,7 @@ void CCLayer::setTouchEnabled(bool enabled)
else else
{ {
// have problems? // have problems?
CCDirector* pDirector = CCDirector::sharedDirector(); CCDirector::sharedDirector()->getTouchDispatcher()->removeDelegate(this);
pDirector->getTouchDispatcher()->removeDelegate(this);
} }
} }
} }

View File

@ -118,15 +118,18 @@
} }
size.width = MIN(size.width, origSize.width); size.width = MIN(size.width, origSize.width);
// adjust the point for alignment // adjust the point for alignment
switch (self.textAlignment) { switch ((NSTextAlignment)self.textAlignment) {
case UITextAlignmentLeft: case NSTextAlignmentLeft:
break; break;
case UITextAlignmentCenter: case NSTextAlignmentCenter:
point.x += (origSize.width - size.width) / 2.0f; point.x += (origSize.width - size.width) / 2.0f;
break; break;
case UITextAlignmentRight: case NSTextAlignmentRight:
point.x += origSize.width - size.width; point.x += origSize.width - size.width;
break; break;
case NSTextAlignmentJustified:
case NSTextAlignmentNatural:
default: break;
} }
[self.text drawAtPoint:point forWidth:size.width withZFont:actualFont lineBreakMode:self.lineBreakMode]; [self.text drawAtPoint:point forWidth:size.width withZFont:actualFont lineBreakMode:self.lineBreakMode];
} else { } else {

View File

@ -637,16 +637,19 @@ static CGSize drawOrSizeTextConstrainedToSize(BOOL performDraw, NSString *string
// draw // draw
if (performDraw) { if (performDraw) {
switch (alignment) { switch ((NSTextAlignment)alignment) {
case UITextAlignmentLeft: case NSTextAlignmentLeft:
drawPoint.x = 0; drawPoint.x = 0;
break; break;
case UITextAlignmentCenter: case NSTextAlignmentCenter:
drawPoint.x = (constrainedSize.width - lineSize.width) / 2.0f; drawPoint.x = (constrainedSize.width - lineSize.width) / 2.0f;
break; break;
case UITextAlignmentRight: case NSTextAlignmentRight:
drawPoint.x = constrainedSize.width - lineSize.width; drawPoint.x = constrainedSize.width - lineSize.width;
break; break;
case NSTextAlignmentJustified:
case NSTextAlignmentNatural:
default: break;
} }
NSUInteger stopGlyphIdx = glyphIdx; NSUInteger stopGlyphIdx = glyphIdx;
NSUInteger lastRunIdx = currentRunIdx; NSUInteger lastRunIdx = currentRunIdx;

View File

@ -3,12 +3,14 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <fontconfig/fontconfig.h>
#include "platform/CCFileUtils.h" #include "platform/CCFileUtils.h"
#include "platform/CCPlatformMacros.h" #include "platform/CCPlatformMacros.h"
#define __CC_PLATFORM_IMAGE_CPP__ #define __CC_PLATFORM_IMAGE_CPP__
#include "platform/CCImageCommon_cpp.h" #include "platform/CCImageCommon_cpp.h"
#include "platform/CCImage.h" #include "platform/CCImage.h"
#include "platform/linux/CCApplication.h"
#include "ft2build.h" #include "ft2build.h"
#include "CCStdC.h" #include "CCStdC.h"
@ -26,27 +28,13 @@ struct TextLine {
wchar_t* text; wchar_t* text;
}; };
struct FontTableItem {
char* family_name;
char* style_name;
char* filename;
};
const int fontTableItems = 4;
const char* fontPath = "/usr/share/fonts/truetype/";
FontTableItem fontsTable[fontTableItems] = {
{ "Serif", "Medium", "freefont/FreeSerif.ttf" },
{ "Sans", "Medium", "freefont/FreeSans.ttf" },
{ "WenQuanYi Micro Hei", "Regular", "wqy/wqy-microhei.ttc" },
{ "WenQuanYi Zen Hei", "Regular", "wqy/wqy-zenhei.ttc" },
};
NS_CC_BEGIN NS_CC_BEGIN
class BitmapDC class BitmapDC
{ {
public: public:
BitmapDC() { BitmapDC() {
libError = FT_Init_FreeType( &library ); libError = FT_Init_FreeType( &library );
FcInit();
iInterval = szFont_kenning; iInterval = szFont_kenning;
m_pData = NULL; m_pData = NULL;
reset(); reset();
@ -54,6 +42,7 @@ public:
~BitmapDC() { ~BitmapDC() {
FT_Done_FreeType(library); FT_Done_FreeType(library);
FcFini();
//data will be deleted by CCImage //data will be deleted by CCImage
// if (m_pData) { // if (m_pData) {
// delete m_pData; // delete m_pData;
@ -238,27 +227,42 @@ public:
return iRet; return iRet;
} }
char* getFontFile(const char* family_name) { std::string getFontFile(const char* family_name) {
char* ret = NULL; std::string fontPath = family_name;
for (int i=0; i<fontTableItems; ++i) {
FontTableItem* item = &fontsTable[i];
if (strcmp(item->family_name, family_name) == 0) {
size_t len = strlen(fontPath) + strlen(item->filename) + 1;
ret = (char*) malloc(len);
snprintf(ret, len, "%s%s", fontPath, item->filename);
break;
}
}
// Return a default font , if font is not found // check if the parameter is a font file shipped with the application
if (ret == NULL) { if ( fontPath.find(".ttf") != std::string::npos ) {
FontTableItem* item = &fontsTable[0]; fontPath = cocos2d::CCApplication::sharedApplication()->getResourceRootPath() + std::string("/") + fontPath;
size_t len = strlen(fontPath) + strlen(item->filename) + 1;
ret = (char*) malloc(len);
snprintf(ret, len, "%s%s", fontPath, item->filename);
}
return ret; FILE *f = fopen(fontPath.c_str(), "r");
if ( f ) {
fclose(f);
return fontPath;
}
}
// use fontconfig to match the parameter against the fonts installed on the system
FcPattern *pattern = FcPatternBuild (0, FC_FAMILY, FcTypeString, family_name, (char *) 0);
FcConfigSubstitute(0, pattern, FcMatchPattern);
FcDefaultSubstitute(pattern);
FcResult result;
FcPattern *font = FcFontMatch(0, pattern, &result);
if ( font ) {
FcChar8 *s = NULL;
if ( FcPatternGetString(font, FC_FILE, 0, &s) == FcResultMatch ) {
fontPath = (const char*)s;
FcPatternDestroy(font);
FcPatternDestroy(pattern);
return fontPath;
}
FcPatternDestroy(font);
}
FcPatternDestroy(pattern);
return family_name;
} }
bool getBitmap(const char *text, int nWidth, int nHeight, CCImage::ETextAlign eAlignMask, const char * pFontName, float fontSize) { bool getBitmap(const char *text, int nWidth, int nHeight, CCImage::ETextAlign eAlignMask, const char * pFontName, float fontSize) {
@ -276,9 +280,8 @@ public:
return false; return false;
} }
do { do {
char* fontfile = getFontFile(pFontName); std::string fontfile = getFontFile(pFontName);
iError = FT_New_Face( library, fontfile, 0, &face ); iError = FT_New_Face( library, fontfile.c_str(), 0, &face );
free(fontfile);
if (iError) { if (iError) {
//no valid font found use default //no valid font found use default
@ -356,9 +359,7 @@ public:
// m_pData[(iY * iMaxLineWidth + iX) * 4 + 0] = // m_pData[(iY * iMaxLineWidth + iX) * 4 + 0] =
// bitmap.buffer[i * bitmap.width + j];//B // bitmap.buffer[i * bitmap.width + j];//B
int iTemp = 0; int iTemp = cTemp << 24 | cTemp << 16 | cTemp << 8 | cTemp;
iTemp |= (cTemp ? 0xff : 0)<<24;
iTemp |= cTemp << 16 | cTemp << 8 | cTemp;
*(int*) &m_pData[(iY * iMaxLineWidth + iX) * 4 + 0] = iTemp; *(int*) &m_pData[(iY * iMaxLineWidth + iX) * 4 + 0] = iTemp;
} }
} }
@ -393,6 +394,7 @@ public:
} }
public: public:
FT_Library library; FT_Library library;
unsigned char *m_pData; unsigned char *m_pData;
int libError; int libError;
vector<TextLine> vLines; vector<TextLine> vLines;

View File

@ -50,6 +50,12 @@ THE SOFTWARE.
#define MIN min #define MIN min
#define MAX max #define MAX max
#if _MSC_VER >= 1600
#include <stdint.h>
#else
#include "./compat/stdint.h"
#endif
// Structure timeval has define in winsock.h, include windows.h for it. // Structure timeval has define in winsock.h, include windows.h for it.
#include <Windows.h> #include <Windows.h>

View File

@ -0,0 +1,247 @@
// ISO C9x compliant stdint.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006-2008 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. The name of the author may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _MSC_STDINT_H_ // [
#define _MSC_STDINT_H_
#if _MSC_VER > 1000
#pragma once
#endif
#include <limits.h>
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
// or compiler give many errors like this:
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
#ifdef __cplusplus
extern "C" {
#endif
# include <wchar.h>
#ifdef __cplusplus
}
#endif
// Define _W64 macros to mark types changing their size, like intptr_t.
#ifndef _W64
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
# define _W64 __w64
# else
# define _W64
# endif
#endif
// 7.18.1 Integer types
// 7.18.1.1 Exact-width integer types
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
// realize that, e.g. char has the same size as __int8
// so we give up on __intX for them.
#if (_MSC_VER < 1300)
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#else
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
#endif
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
// 7.18.1.2 Minimum-width integer types
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;
// 7.18.1.3 Fastest minimum-width integer types
typedef int8_t int_fast8_t;
typedef int16_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef int64_t int_fast64_t;
typedef uint8_t uint_fast8_t;
typedef uint16_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
typedef uint64_t uint_fast64_t;
// 7.18.1.4 Integer types capable of holding object pointers
#ifdef _WIN64 // [
typedef signed __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#else // _WIN64 ][
typedef _W64 signed int intptr_t;
typedef _W64 unsigned int uintptr_t;
#endif // _WIN64 ]
// 7.18.1.5 Greatest-width integer types
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
// 7.18.2 Limits of specified-width integer types
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
// 7.18.2.1 Limits of exact-width integer types
#define INT8_MIN ((int8_t)_I8_MIN)
#define INT8_MAX _I8_MAX
#define INT16_MIN ((int16_t)_I16_MIN)
#define INT16_MAX _I16_MAX
#define INT32_MIN ((int32_t)_I32_MIN)
#define INT32_MAX _I32_MAX
#define INT64_MIN ((int64_t)_I64_MIN)
#define INT64_MAX _I64_MAX
#define UINT8_MAX _UI8_MAX
#define UINT16_MAX _UI16_MAX
#define UINT32_MAX _UI32_MAX
#define UINT64_MAX _UI64_MAX
// 7.18.2.2 Limits of minimum-width integer types
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MIN INT64_MIN
#define INT_LEAST64_MAX INT64_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#define UINT_LEAST64_MAX UINT64_MAX
// 7.18.2.3 Limits of fastest minimum-width integer types
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MIN INT16_MIN
#define INT_FAST16_MAX INT16_MAX
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT16_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
// 7.18.2.4 Limits of integer types capable of holding object pointers
#ifdef _WIN64 // [
# define INTPTR_MIN INT64_MIN
# define INTPTR_MAX INT64_MAX
# define UINTPTR_MAX UINT64_MAX
#else // _WIN64 ][
# define INTPTR_MIN INT32_MIN
# define INTPTR_MAX INT32_MAX
# define UINTPTR_MAX UINT32_MAX
#endif // _WIN64 ]
// 7.18.2.5 Limits of greatest-width integer types
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
// 7.18.3 Limits of other integer types
#ifdef _WIN64 // [
# define PTRDIFF_MIN _I64_MIN
# define PTRDIFF_MAX _I64_MAX
#else // _WIN64 ][
# define PTRDIFF_MIN _I32_MIN
# define PTRDIFF_MAX _I32_MAX
#endif // _WIN64 ]
#define SIG_ATOMIC_MIN INT_MIN
#define SIG_ATOMIC_MAX INT_MAX
#ifndef SIZE_MAX // [
# ifdef _WIN64 // [
# define SIZE_MAX _UI64_MAX
# else // _WIN64 ][
# define SIZE_MAX _UI32_MAX
# endif // _WIN64 ]
#endif // SIZE_MAX ]
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
#ifndef WCHAR_MIN // [
# define WCHAR_MIN 0
#endif // WCHAR_MIN ]
#ifndef WCHAR_MAX // [
# define WCHAR_MAX _UI16_MAX
#endif // WCHAR_MAX ]
#define WINT_MIN 0
#define WINT_MAX _UI16_MAX
#endif // __STDC_LIMIT_MACROS ]
// 7.18.4 Limits of other integer types
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
// 7.18.4.1 Macros for minimum-width integer constants
#define INT8_C(val) val##i8
#define INT16_C(val) val##i16
#define INT32_C(val) val##i32
#define INT64_C(val) val##i64
#define UINT8_C(val) val##ui8
#define UINT16_C(val) val##ui16
#define UINT32_C(val) val##ui32
#define UINT64_C(val) val##ui64
// 7.18.4.2 Macros for greatest-width integer constants
#define INTMAX_C INT64_C
#define UINTMAX_C UINT64_C
#endif // __STDC_CONSTANT_MACROS ]
#endif // _MSC_STDINT_H_ ]

View File

@ -79,6 +79,7 @@
<option defaultValue="true" id="gnu.cpp.link.option.shared.1563119377" name="Shared (-shared)" superClass="gnu.cpp.link.option.shared" value="true" valueType="boolean"/> <option defaultValue="true" id="gnu.cpp.link.option.shared.1563119377" name="Shared (-shared)" superClass="gnu.cpp.link.option.shared" value="true" valueType="boolean"/>
<option id="gnu.cpp.link.option.libs.1265275896" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs"> <option id="gnu.cpp.link.option.libs.1265275896" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="glfw"/> <listOptionValue builtIn="false" value="glfw"/>
<listOptionValue builtIn="false" value="fontconfig"/>
<listOptionValue builtIn="false" value="GL"/> <listOptionValue builtIn="false" value="GL"/>
<listOptionValue builtIn="false" value="GLEW"/> <listOptionValue builtIn="false" value="GLEW"/>
</option> </option>

View File

@ -385,7 +385,7 @@ CCSprite * CCTMXLayer::insertTileForGID(unsigned int gid, const CCPoint& pos)
CCRect rect = m_pTileSet->rectForGID(gid); CCRect rect = m_pTileSet->rectForGID(gid);
rect = CC_RECT_PIXELS_TO_POINTS(rect); rect = CC_RECT_PIXELS_TO_POINTS(rect);
int z = (int)(pos.x + pos.y * m_tLayerSize.width); intptr_t z = (intptr_t)(pos.x + pos.y * m_tLayerSize.width);
CCSprite *tile = reusedTileWithRect(rect); CCSprite *tile = reusedTileWithRect(rect);
@ -447,7 +447,7 @@ CCSprite * CCTMXLayer::appendTileForGID(unsigned int gid, const CCPoint& pos)
CCRect rect = m_pTileSet->rectForGID(gid); CCRect rect = m_pTileSet->rectForGID(gid);
rect = CC_RECT_PIXELS_TO_POINTS(rect); rect = CC_RECT_PIXELS_TO_POINTS(rect);
int z = (int)(pos.x + pos.y * m_tLayerSize.width); intptr_t z = (intptr_t)(pos.x + pos.y * m_tLayerSize.width);
CCSprite *tile = reusedTileWithRect(rect); CCSprite *tile = reusedTileWithRect(rect);

View File

@ -129,16 +129,16 @@ void CCBAnimationManager::addNode(CCNode *pNode, CCDictionary *pSeq)
{ {
pNode->retain(); pNode->retain();
mNodeSequences->setObject(pSeq, (int)pNode); mNodeSequences->setObject(pSeq, (intptr_t)pNode);
} }
void CCBAnimationManager::setBaseValue(CCObject *pValue, CCNode *pNode, const char *pPropName) void CCBAnimationManager::setBaseValue(CCObject *pValue, CCNode *pNode, const char *pPropName)
{ {
CCDictionary *props = (CCDictionary*)mBaseValues->objectForKey((int)pNode); CCDictionary *props = (CCDictionary*)mBaseValues->objectForKey((intptr_t)pNode);
if (! props) if (! props)
{ {
props = CCDictionary::create(); props = CCDictionary::create();
mBaseValues->setObject(props, (int)pNode); mBaseValues->setObject(props, (intptr_t)pNode);
pNode->retain(); pNode->retain();
} }
@ -147,7 +147,7 @@ void CCBAnimationManager::setBaseValue(CCObject *pValue, CCNode *pNode, const ch
CCObject* CCBAnimationManager::getBaseValue(CCNode *pNode, const char* pPropName) CCObject* CCBAnimationManager::getBaseValue(CCNode *pNode, const char* pPropName)
{ {
CCDictionary *props = (CCDictionary*)mBaseValues->objectForKey((int)pNode); CCDictionary *props = (CCDictionary*)mBaseValues->objectForKey((intptr_t)pNode);
return props->objectForKey(pPropName); return props->objectForKey(pPropName);
} }

View File

@ -15,15 +15,15 @@ public:
virtual void completedAnimationSequenceNamed(const char *name) = 0; virtual void completedAnimationSequenceNamed(const char *name) = 0;
}; };
class CCBAnimationManager : public cocos2d::CCObject class CCBAnimationManager : public CCObject
{ {
private: private:
cocos2d::CCArray *mSequences; CCArray *mSequences;
cocos2d::CCDictionary *mNodeSequences; CCDictionary *mNodeSequences;
cocos2d::CCDictionary *mBaseValues; CCDictionary *mBaseValues;
int mAutoPlaySequenceId; int mAutoPlaySequenceId;
cocos2d::CCNode *mRootNode; CCNode *mRootNode;
CCSize mRootContainerSize; CCSize mRootContainerSize;
CCBAnimationManagerDelegate *mDelegate; CCBAnimationManagerDelegate *mDelegate;
@ -35,26 +35,26 @@ public:
virtual bool init(); virtual bool init();
cocos2d::CCArray* getSequences(); CCArray* getSequences();
int getAutoPlaySequenceId(); int getAutoPlaySequenceId();
void setAutoPlaySequenceId(int autoPlaySequenceId); void setAutoPlaySequenceId(int autoPlaySequenceId);
cocos2d::CCNode* getRootNode(); CCNode* getRootNode();
void setRootNode(cocos2d::CCNode* pRootNode); // retain void setRootNode(CCNode* pRootNode); // retain
const cocos2d::CCSize& getRootContainerSize(); const CCSize& getRootContainerSize();
void setRootContainerSize(const cocos2d::CCSize &rootContainerSize); void setRootContainerSize(const CCSize &rootContainerSize);
CCBAnimationManagerDelegate* getDelegate(); CCBAnimationManagerDelegate* getDelegate();
void setDelegate(CCBAnimationManagerDelegate* pDelegate); // retain void setDelegate(CCBAnimationManagerDelegate* pDelegate); // retain
const char* getRunningSequenceName(); const char* getRunningSequenceName();
const CCSize& getContainerSize(cocos2d::CCNode* pNode); const CCSize& getContainerSize(CCNode* pNode);
void addNode(cocos2d::CCNode *pNode, cocos2d::CCDictionary *pSeq); void addNode(CCNode *pNode, CCDictionary *pSeq);
void setBaseValue(cocos2d::CCObject *pValue, cocos2d::CCNode *pNode, const char *pPropName); void setBaseValue(CCObject *pValue, CCNode *pNode, const char *pPropName);
void runAnimations(const char *pName, float fTweenDuration); void runAnimations(const char *pName, float fTweenDuration);
void runAnimations(const char *pName); void runAnimations(const char *pName);
@ -63,33 +63,33 @@ public:
void debug(); void debug();
private: private:
cocos2d::CCObject* getBaseValue(cocos2d::CCNode *pNode, const char* pPropName); CCObject* getBaseValue(CCNode *pNode, const char* pPropName);
int getSequenceId(const char* pSequenceName); int getSequenceId(const char* pSequenceName);
CCBSequence* getSequence(int nSequenceId); CCBSequence* getSequence(int nSequenceId);
cocos2d::CCActionInterval* getAction(CCBKeyframe *pKeyframe0, CCBKeyframe *pKeyframe1, const char *pPropName, cocos2d::CCNode *pNode); CCActionInterval* getAction(CCBKeyframe *pKeyframe0, CCBKeyframe *pKeyframe1, const char *pPropName, CCNode *pNode);
void setAnimatedProperty(const char *pPropName, cocos2d::CCNode *pNode, cocos2d::CCObject *pValue, float fTweenDuraion); void setAnimatedProperty(const char *pPropName, CCNode *pNode, CCObject *pValue, float fTweenDuraion);
void setFirstFrame(cocos2d::CCNode *pNode, CCBSequenceProperty *pSeqProp, float fTweenDuration); void setFirstFrame(CCNode *pNode, CCBSequenceProperty *pSeqProp, float fTweenDuration);
cocos2d::CCActionInterval* getEaseAction(cocos2d::CCActionInterval *pAction, int nEasingType, float fEasingOpt); CCActionInterval* getEaseAction(CCActionInterval *pAction, int nEasingType, float fEasingOpt);
void runAction(cocos2d::CCNode *pNode, CCBSequenceProperty *pSeqProp, float fTweenDuration); void runAction(CCNode *pNode, CCBSequenceProperty *pSeqProp, float fTweenDuration);
void sequenceCompleted(); void sequenceCompleted();
}; };
class CCBSetSpriteFrame : public cocos2d::CCActionInstant class CCBSetSpriteFrame : public CCActionInstant
{ {
private: private:
cocos2d::CCSpriteFrame *mSpriteFrame; CCSpriteFrame *mSpriteFrame;
public: public:
~CCBSetSpriteFrame(); ~CCBSetSpriteFrame();
/** creates a Place action with a position */ /** creates a Place action with a position */
static CCBSetSpriteFrame* create(cocos2d::CCSpriteFrame *pSpriteFrame); static CCBSetSpriteFrame* create(CCSpriteFrame *pSpriteFrame);
bool initWithSpriteFrame(cocos2d::CCSpriteFrame *pSpriteFrame); bool initWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
virtual void update(float time); virtual void update(float time);
virtual cocos2d::CCObject* copyWithZone(cocos2d::CCZone *pZone); virtual CCObject* copyWithZone(CCZone *pZone);
}; };
class CCBRotateTo : public cocos2d::CCActionInterval class CCBRotateTo : public CCActionInterval
{ {
private: private:
float mStartAngle; float mStartAngle;
@ -100,8 +100,8 @@ public:
static CCBRotateTo* create(float fDuration, float fAngle); static CCBRotateTo* create(float fDuration, float fAngle);
bool initWithDuration(float fDuration, float fAngle); bool initWithDuration(float fDuration, float fAngle);
virtual void update(float time); virtual void update(float time);
virtual cocos2d::CCObject* copyWithZone(cocos2d::CCZone *pZone); virtual CCObject* copyWithZone(CCZone *pZone);
virtual void startWithTarget(cocos2d::CCNode *pNode); virtual void startWithTarget(CCNode *pNode);
}; };
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -1,6 +1,6 @@
#include "CCBFileLoader.h" #include "CCBFileLoader.h"
USING_NS_CC;
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN

View File

@ -6,10 +6,10 @@
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
class CCBKeyframe : public cocos2d::CCObject class CCBKeyframe : public CCObject
{ {
private: private:
cocos2d::CCObject *mValue; CCObject *mValue;
float mTime; float mTime;
int mEasingType; int mEasingType;
float mEasingOpt; float mEasingOpt;
@ -18,8 +18,8 @@ public:
CCBKeyframe(); CCBKeyframe();
~CCBKeyframe(); ~CCBKeyframe();
cocos2d::CCObject* getValue(); CCObject* getValue();
void setValue(cocos2d::CCObject *pValue); // retain void setValue(CCObject *pValue); // retain
float getTime(); float getTime();
void setTime(float fTime); void setTime(float fTime);

View File

@ -21,7 +21,7 @@ class CCBMemberVariableAssigner {
public: public:
virtual ~CCBMemberVariableAssigner() {}; virtual ~CCBMemberVariableAssigner() {};
virtual bool onAssignCCBMemberVariable(CCObject * pTarget, cocos2d::CCString * pMemberVariableName, CCNode * pNode) = 0; virtual bool onAssignCCBMemberVariable(CCObject * pTarget, CCString * pMemberVariableName, CCNode * pNode) = 0;
}; };
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -20,7 +20,7 @@
#endif #endif
using namespace std; using namespace std;
USING_NS_CC;
NS_CC_EXT_BEGIN; NS_CC_EXT_BEGIN;
/************************************************************************* /*************************************************************************

View File

@ -128,7 +128,7 @@ enum
kCCBScaleTypeMultiplyResolution kCCBScaleTypeMultiplyResolution
}; };
USING_NS_CC;
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
/** /**

View File

@ -5,7 +5,7 @@
#include "ExtensionMacros.h" #include "ExtensionMacros.h"
#include "../GUI/CCControlExtension/CCInvocation.h" #include "../GUI/CCControlExtension/CCInvocation.h"
USING_NS_CC;
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
#define CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(TARGET, SELECTORNAME, METHOD) if(pTarget == TARGET && pSelectorName->compare(SELECTORNAME) == 0) { \ #define CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(TARGET, SELECTORNAME, METHOD) if(pTarget == TARGET && pSelectorName->compare(SELECTORNAME) == 0) { \
@ -19,9 +19,9 @@ NS_CC_EXT_BEGIN
class CCBSelectorResolver { class CCBSelectorResolver {
public: public:
virtual ~CCBSelectorResolver() {}; virtual ~CCBSelectorResolver() {};
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName) = 0; virtual SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName) = 0;
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName) = 0; virtual extension::SEL_CCControlHandler onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName) = 0;
}; };

View File

@ -7,7 +7,7 @@
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
class CCBSequence : public cocos2d::CCObject class CCBSequence : public CCObject
{ {
private: private:
float mDuration; float mDuration;

View File

@ -7,7 +7,7 @@
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
class CCBSequenceProperty : public cocos2d::CCObject class CCBSequenceProperty : public CCObject
{ {
private: private:
std::string mName; std::string mName;

View File

@ -6,7 +6,7 @@ NS_CC_EXT_BEGIN
// Implementation of ccColor3BWapper // Implementation of ccColor3BWapper
ccColor3BWapper* ccColor3BWapper::create(const cocos2d::ccColor3B& color) ccColor3BWapper* ccColor3BWapper::create(const ccColor3B& color)
{ {
ccColor3BWapper *ret = new ccColor3BWapper(); ccColor3BWapper *ret = new ccColor3BWapper();
if (ret) if (ret)

View File

@ -10,15 +10,15 @@
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
class ccColor3BWapper : public cocos2d::CCObject class ccColor3BWapper : public CCObject
{ {
private: private:
cocos2d::ccColor3B color; ccColor3B color;
public: public:
static ccColor3BWapper* create(const cocos2d::ccColor3B& color); static ccColor3BWapper* create(const ccColor3B& color);
const cocos2d::ccColor3B& getColor(); const ccColor3B& getColor();
}; };
enum enum
@ -30,7 +30,7 @@ enum
kUnsignedCharValue, kUnsignedCharValue,
}; };
class CCBValue : public cocos2d::CCObject class CCBValue : public CCObject
{ {
private: private:
union union

View File

@ -1,6 +1,6 @@
#include "CCControlButtonLoader.h" #include "CCControlButtonLoader.h"
USING_NS_CC;
NS_CC_EXT_BEGIN; NS_CC_EXT_BEGIN;
#define PROPERTY_ZOOMONTOUCHDOWN "zoomOnTouchDown" #define PROPERTY_ZOOMONTOUCHDOWN "zoomOnTouchDown"

View File

@ -1,6 +1,6 @@
#include "CCControlLoader.h" #include "CCControlLoader.h"
USING_NS_CC;
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
#define PROPERTY_ENABLED "enabled" #define PROPERTY_ENABLED "enabled"

View File

@ -7,7 +7,7 @@
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
class CCData : public cocos2d::CCObject class CCData : public CCObject
{ {
public: public:
CCData(unsigned char *pBytes, const unsigned long nSize); CCData(unsigned char *pBytes, const unsigned long nSize);

View File

@ -1,6 +1,6 @@
#include "CCLabelBMFontLoader.h" #include "CCLabelBMFontLoader.h"
USING_NS_CC;
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN

View File

@ -1,6 +1,6 @@
#include "CCLabelTTFLoader.h" #include "CCLabelTTFLoader.h"
USING_NS_CC;
#define PROPERTY_COLOR "color" #define PROPERTY_COLOR "color"
#define PROPERTY_OPACITY "opacity" #define PROPERTY_OPACITY "opacity"

View File

@ -1,6 +1,6 @@
#include "CCLayerColorLoader.h" #include "CCLayerColorLoader.h"
USING_NS_CC;
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN

View File

@ -1,6 +1,6 @@
#include "CCLayerGradientLoader.h" #include "CCLayerGradientLoader.h"
USING_NS_CC;
#define PROPERTY_STARTCOLOR "startColor" #define PROPERTY_STARTCOLOR "startColor"
#define PROPERTY_ENDCOLOR "endColor" #define PROPERTY_ENDCOLOR "endColor"

View File

@ -1,6 +1,6 @@
#include "CCLayerLoader.h" #include "CCLayerLoader.h"
USING_NS_CC;
#define PROPERTY_TOUCH_ENABLED "isTouchEnabled" #define PROPERTY_TOUCH_ENABLED "isTouchEnabled"

View File

@ -1,6 +1,6 @@
#include "CCMenuItemImageLoader.h" #include "CCMenuItemImageLoader.h"
USING_NS_CC;
#define PROPERTY_NORMALDISPLAYFRAME "normalSpriteFrame" #define PROPERTY_NORMALDISPLAYFRAME "normalSpriteFrame"
#define PROPERTY_SELECTEDDISPLAYFRAME "selectedSpriteFrame" #define PROPERTY_SELECTEDDISPLAYFRAME "selectedSpriteFrame"

View File

@ -1,6 +1,6 @@
#include "CCMenuItemLoader.h" #include "CCMenuItemLoader.h"
USING_NS_CC;
#define PROPERTY_BLOCK "block" #define PROPERTY_BLOCK "block"
#define PROPERTY_ISENABLED "isEnabled" #define PROPERTY_ISENABLED "isEnabled"

View File

@ -6,9 +6,9 @@
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
extern cocos2d::CCPoint getAbsolutePosition(const cocos2d::CCPoint &pt, int nType, const cocos2d::CCSize &containerSize, const char *pPropName); extern CCPoint getAbsolutePosition(const CCPoint &pt, int nType, const CCSize &containerSize, const char *pPropName);
extern void setRelativeScale(cocos2d::CCNode *pNode, float fScaleX, float fScaleY, int nType, const char* pPropName); extern void setRelativeScale(CCNode *pNode, float fScaleX, float fScaleY, int nType, const char* pPropName);
NS_CC_EXT_END NS_CC_EXT_END

View File

@ -7,8 +7,6 @@
using namespace std; using namespace std;
USING_NS_CC;
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
CCNode * CCNodeLoader::loadCCNode(CCNode * pParent, CCBReader * pCCBReader) { CCNode * CCNodeLoader::loadCCNode(CCNode * pParent, CCBReader * pCCBReader) {

View File

@ -15,7 +15,7 @@
#include "CCParticleSystemQuadLoader.h" #include "CCParticleSystemQuadLoader.h"
#include "CCScrollViewLoader.h" #include "CCScrollViewLoader.h"
USING_NS_CC;
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN

View File

@ -6,6 +6,8 @@
NS_CC_EXT_BEGIN NS_CC_EXT_BEGIN
class CCNodeLoader;
typedef std::map<CCString *, CCNodeLoader *, CCStringCompare> CCNodeLoaderMap; typedef std::map<CCString *, CCNodeLoader *, CCStringCompare> CCNodeLoaderMap;
typedef std::pair<CCString *, CCNodeLoader *> CCNodeLoaderMapEntry; typedef std::pair<CCString *, CCNodeLoader *> CCNodeLoaderMapEntry;

View File

@ -1,6 +1,6 @@
#include "CCParticleSystemQuadLoader.h" #include "CCParticleSystemQuadLoader.h"
USING_NS_CC;
#define PROPERTY_EMITERMODE "emitterMode" #define PROPERTY_EMITERMODE "emitterMode"
#define PROPERTY_POSVAR "posVar" #define PROPERTY_POSVAR "posVar"

View File

@ -1,6 +1,6 @@
#include "CCScale9SpriteLoader.h" #include "CCScale9SpriteLoader.h"
USING_NS_CC;
#define PROPERTY_CONTENTSIZE "contentSize" #define PROPERTY_CONTENTSIZE "contentSize"
#define PROPERTY_SPRITEFRAME "spriteFrame" #define PROPERTY_SPRITEFRAME "spriteFrame"

View File

@ -1,6 +1,6 @@
#include "CCScrollViewLoader.h" #include "CCScrollViewLoader.h"
USING_NS_CC;
#define PROPERTY_CONTAINER "container" #define PROPERTY_CONTAINER "container"
#define PROPERTY_DIRECTION "direction" #define PROPERTY_DIRECTION "direction"

View File

@ -1,7 +1,5 @@
#include "CCSpriteLoader.h" #include "CCSpriteLoader.h"
USING_NS_CC;
#define PROPERTY_FLIP "flip" #define PROPERTY_FLIP "flip"
#define PROPERTY_DISPLAYFRAME "displayFrame" #define PROPERTY_DISPLAYFRAME "displayFrame"
#define PROPERTY_COLOR "color" #define PROPERTY_COLOR "color"

View File

@ -19,20 +19,20 @@ NS_CC_EXT_BEGIN
typedef unsigned int CCControlEvent; typedef unsigned int CCControlEvent;
typedef void (cocos2d::CCObject::*SEL_CCControlHandler)(cocos2d::CCObject*, CCControlEvent); typedef void (CCObject::*SEL_CCControlHandler)(CCObject*, CCControlEvent);
#define cccontrol_selector(_SELECTOR) (SEL_CCControlHandler)(&_SELECTOR) #define cccontrol_selector(_SELECTOR) (SEL_CCControlHandler)(&_SELECTOR)
class CCInvocation : public cocos2d::CCObject class CCInvocation : public CCObject
{ {
CC_SYNTHESIZE_READONLY(SEL_CCControlHandler, m_action, Action); CC_SYNTHESIZE_READONLY(SEL_CCControlHandler, m_action, Action);
CC_SYNTHESIZE_READONLY(CCObject*, m_target, Target); CC_SYNTHESIZE_READONLY(CCObject*, m_target, Target);
CC_SYNTHESIZE_READONLY(CCControlEvent, m_controlEvent, ControlEvent); CC_SYNTHESIZE_READONLY(CCControlEvent, m_controlEvent, ControlEvent);
public: public:
CCInvocation(cocos2d::CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent); CCInvocation(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent);
void invoke(cocos2d::CCObject* sender); void invoke(CCObject* sender);
}; };
// end of GUI group // end of GUI group

View File

@ -43,7 +43,7 @@ NS_CC_EXT_BEGIN
/** @brief Singleton that handles asynchrounous http requests /** @brief Singleton that handles asynchrounous http requests
* Once the request completed, a callback will issued in main thread when it provided during make request * Once the request completed, a callback will issued in main thread when it provided during make request
*/ */
class CCHttpClient : public cocos2d::CCObject class CCHttpClient : public CCObject
{ {
public: public:
/** Return the shared instance **/ /** Return the shared instance **/

View File

@ -35,7 +35,7 @@ NS_CC_EXT_BEGIN
Please refer to samples/TestCpp/Classes/ExtensionTest/NetworkTest/HttpClientTest.cpp as a sample Please refer to samples/TestCpp/Classes/ExtensionTest/NetworkTest/HttpClientTest.cpp as a sample
@since v2.0.2 @since v2.0.2
*/ */
class CCHttpRequest : public cocos2d::CCObject class CCHttpRequest : public CCObject
{ {
public: public:
/** Use this enum type as param in setReqeustType(param) */ /** Use this enum type as param in setReqeustType(param) */
@ -155,7 +155,7 @@ public:
/** Required field. You should set the callback selector function at ack the http request completed /** Required field. You should set the callback selector function at ack the http request completed
*/ */
inline void setResponseCallback(cocos2d::CCObject* pTarget, cocos2d::SEL_CallFuncND pSelector) inline void setResponseCallback(CCObject* pTarget, SEL_CallFuncND pSelector)
{ {
_pTarget = pTarget; _pTarget = pTarget;
_pSelector = pSelector; _pSelector = pSelector;
@ -171,7 +171,7 @@ public:
return _pTarget; return _pTarget;
} }
/** Get the selector function pointer, mainly used by CCHttpClient */ /** Get the selector function pointer, mainly used by CCHttpClient */
inline cocos2d::SEL_CallFuncND getSelector() inline SEL_CallFuncND getSelector()
{ {
return _pSelector; return _pSelector;
} }
@ -182,8 +182,8 @@ protected:
std::string _url; /// target url that this request is sent to std::string _url; /// target url that this request is sent to
std::vector<char> _requestData; /// used for POST std::vector<char> _requestData; /// used for POST
std::string _tag; /// user defined tag, to identify different requests in response callback std::string _tag; /// user defined tag, to identify different requests in response callback
cocos2d::CCObject* _pTarget; /// callback target of pSelector function CCObject* _pTarget; /// callback target of pSelector function
cocos2d::SEL_CallFuncND _pSelector; /// callback function, e.g. MyLayer::onHttpResponse(CCObject *sender, void *data) SEL_CallFuncND _pSelector; /// callback function, e.g. MyLayer::onHttpResponse(CCObject *sender, void *data)
void* _pUserData; /// You can add your customed data here void* _pUserData; /// You can add your customed data here
}; };

View File

@ -36,7 +36,7 @@ NS_CC_EXT_BEGIN
Please refer to samples/TestCpp/Classes/ExtensionTest/NetworkTest/HttpClientTest.cpp as a sample Please refer to samples/TestCpp/Classes/ExtensionTest/NetworkTest/HttpClientTest.cpp as a sample
@since v2.0.2 @since v2.0.2
*/ */
class CCHttpResponse : public cocos2d::CCObject class CCHttpResponse : public CCObject
{ {
public: public:
/** Constructor, it's used by CCHttpClient internal, users don't need to create HttpResponse manually /** Constructor, it's used by CCHttpClient internal, users don't need to create HttpResponse manually

View File

@ -32,7 +32,8 @@ bool AppDelegate::applicationDidFinishLaunching() {
{ {
// iphone // iphone
if (pDirector->enableRetinaDisplay(true)) // try to enable retina on device
if (true == CCDirector::sharedDirector()->enableRetinaDisplay(true))
{ {
// iphone hd // iphone hd
CCFileUtils::sharedFileUtils()->setResourceDirectory("iphonehd"); CCFileUtils::sharedFileUtils()->setResourceDirectory("iphonehd");

View File

@ -40,15 +40,9 @@ bool HelloWorld::init()
"CloseSelected.png", "CloseSelected.png",
this, this,
menu_selector(HelloWorld::menuCloseCallback)); menu_selector(HelloWorld::menuCloseCallback));
if (CCApplication::sharedApplication()->getTargetPlatform() == kTargetIphone) pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
{ origin.y + pCloseItem->getContentSize().height/2));
pCloseItem->setPosition(ccp(visibleSize.width - 20 + origin.x, 20 + origin.y));
}
else
{
pCloseItem->setPosition(ccp(visibleSize.width - 40 + origin.x, 40 + origin.y));
}
// create menu, it's an autorelease object // create menu, it's an autorelease object
CCMenu* pMenu = CCMenu::create(pCloseItem, NULL); CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
@ -63,7 +57,8 @@ bool HelloWorld::init()
CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", 24); CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", 24);
// position the label on the center of the screen // position the label on the center of the screen
pLabel->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height - 50 + origin.y)); pLabel->setPosition(ccp(origin.x + visibleSize.width/2,
origin.y + visibleSize.height - pLabel->getContentSize().height));
// add the label as a child to this layer // add the label as a child to this layer
this->addChild(pLabel, 1); this->addChild(pLabel, 1);
@ -77,6 +72,9 @@ bool HelloWorld::init()
// add the sprite as a child to this layer // add the sprite as a child to this layer
this->addChild(pSprite, 0); this->addChild(pSprite, 0);
// enable standard touch
this->setTouchEnabled(true);
return true; return true;
} }
@ -88,3 +86,11 @@ void HelloWorld::menuCloseCallback(CCObject* pSender)
exit(0); exit(0);
#endif #endif
} }
void HelloWorld::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)
{
CCTouch* touch = (CCTouch*)(* pTouches->begin());
CCPoint pos = touch->getLocation();
CCLog("touch, x = %f, y = %f", pos.x, pos.y);
}

View File

@ -15,6 +15,9 @@ public:
// a selector callback // a selector callback
void menuCloseCallback(CCObject* pSender); void menuCloseCallback(CCObject* pSender);
// touch callback
void ccTouchesBegan(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
// implement the "static node()" method manually // implement the "static node()" method manually
CREATE_FUNC(HelloWorld); CREATE_FUNC(HelloWorld);
}; };

View File

@ -57,7 +57,17 @@ static AppDelegate s_sharedApplication;
viewController.view = __glView; viewController.view = __glView;
// Set RootViewController to window // Set RootViewController to window
[window addSubview: viewController.view]; if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
{
// warning: addSubView doesn't work on iOS6
[window addSubview: viewController.view];
}
else
{
// use this method on ios6
[window setRootViewController:viewController];
}
[window makeKeyAndVisible]; [window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES]; [[UIApplication sharedApplication] setStatusBarHidden: YES];

View File

@ -0,0 +1 @@
66c6d1cead373b45218424f6a82f370897e443e4

View File

@ -0,0 +1 @@
84689888a14a2123d2b39f7f2f61be8c15207479

View File

@ -3,7 +3,7 @@
archiveVersion = 1; archiveVersion = 1;
classes = { classes = {
}; };
objectVersion = 45; objectVersion = 46;
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
@ -13,7 +13,6 @@
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; };
782F4619153FEDF0009FC2E5 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 782F4617153FEDF0009FC2E5 /* Default.png */; };
BF1373EF128A898400D9F789 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492D4B1289302400A09262 /* OpenGLES.framework */; }; BF1373EF128A898400D9F789 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492D4B1289302400A09262 /* OpenGLES.framework */; };
BF1373F0128A899500D9F789 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492C21128924A800A09262 /* libxml2.dylib */; }; BF1373F0128A899500D9F789 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492C21128924A800A09262 /* libxml2.dylib */; };
BF1373F1128A899E00D9F789 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492B6912891AC600A09262 /* libz.dylib */; }; BF1373F1128A899E00D9F789 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BF492B6912891AC600A09262 /* libz.dylib */; };
@ -22,6 +21,9 @@
BF23D4E8143315EB00657E08 /* HelloWorldScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BF23D4E5143315EB00657E08 /* HelloWorldScene.cpp */; }; BF23D4E8143315EB00657E08 /* HelloWorldScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BF23D4E5143315EB00657E08 /* HelloWorldScene.cpp */; };
BF365AA812A103F70050DCF4 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF365AA712A103F70050DCF4 /* AppController.mm */; }; BF365AA812A103F70050DCF4 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF365AA712A103F70050DCF4 /* AppController.mm */; };
BF4DE6AD138BB89600CF907D /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF4DE6AC138BB89600CF907D /* RootViewController.mm */; }; BF4DE6AD138BB89600CF907D /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF4DE6AC138BB89600CF907D /* RootViewController.mm */; };
D446FD79161028E9000ADA7B /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FD78161028E9000ADA7B /* Default.png */; };
D446FD7B161028ED000ADA7B /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FD7A161028ED000ADA7B /* Default@2x.png */; };
D446FD7D161028F4000ADA7B /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FD7C161028F4000ADA7B /* Default-568h@2x.png */; };
D4ABB4B313B4395300552E6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D4ABB4B213B4395300552E6E /* main.m */; }; D4ABB4B313B4395300552E6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D4ABB4B213B4395300552E6E /* main.m */; };
D4EF94E815BD319200D803EB /* Icon-57.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF94E715BD319200D803EB /* Icon-57.png */; }; D4EF94E815BD319200D803EB /* Icon-57.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF94E715BD319200D803EB /* Icon-57.png */; };
D4EF94EA15BD319500D803EB /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF94E915BD319500D803EB /* Icon-114.png */; }; D4EF94EA15BD319500D803EB /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF94E915BD319500D803EB /* Icon-114.png */; };
@ -57,7 +59,6 @@
781C33B11547F06B00633F88 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; 781C33B11547F06B00633F88 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
781C33B31547F06B00633F88 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 781C33B31547F06B00633F88 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
781C33B51547F06B00633F88 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 781C33B51547F06B00633F88 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
782F4617153FEDF0009FC2E5 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = SOURCE_ROOT; };
BF137426128A8E4600D9F789 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; BF137426128A8E4600D9F789 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
BF23D4E3143315EB00657E08 /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = "<group>"; }; BF23D4E3143315EB00657E08 /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = "<group>"; };
BF23D4E4143315EB00657E08 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; BF23D4E4143315EB00657E08 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
@ -70,6 +71,9 @@
BF492D4B1289302400A09262 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; BF492D4B1289302400A09262 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
BF4DE6AB138BB89600CF907D /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = "<group>"; }; BF4DE6AB138BB89600CF907D /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = "<group>"; };
BF4DE6AC138BB89600CF907D /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = "<group>"; }; BF4DE6AC138BB89600CF907D /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = "<group>"; };
D446FD78161028E9000ADA7B /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = ../proj.ios/Default.png; sourceTree = "<group>"; };
D446FD7A161028ED000ADA7B /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default@2x.png"; path = "../proj.ios/Default@2x.png"; sourceTree = "<group>"; };
D446FD7C161028F4000ADA7B /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "../proj.ios/Default-568h@2x.png"; sourceTree = "<group>"; };
D4ABB4B213B4395300552E6E /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; D4ABB4B213B4395300552E6E /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
D4EF94E715BD319200D803EB /* Icon-57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-57.png"; path = "../proj.ios/Icon-57.png"; sourceTree = "<group>"; }; D4EF94E715BD319200D803EB /* Icon-57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-57.png"; path = "../proj.ios/Icon-57.png"; sourceTree = "<group>"; };
D4EF94E915BD319500D803EB /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-114.png"; path = "../proj.ios/Icon-114.png"; sourceTree = "<group>"; }; D4EF94E915BD319500D803EB /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-114.png"; path = "../proj.ios/Icon-114.png"; sourceTree = "<group>"; };
@ -151,7 +155,9 @@
D4EF94EB15BD319B00D803EB /* Icon-72.png */, D4EF94EB15BD319B00D803EB /* Icon-72.png */,
D4EF94E915BD319500D803EB /* Icon-114.png */, D4EF94E915BD319500D803EB /* Icon-114.png */,
D4EF94E715BD319200D803EB /* Icon-57.png */, D4EF94E715BD319200D803EB /* Icon-57.png */,
782F4617153FEDF0009FC2E5 /* Default.png */, D446FD7C161028F4000ADA7B /* Default-568h@2x.png */,
D446FD7A161028ED000ADA7B /* Default@2x.png */,
D446FD78161028E9000ADA7B /* Default.png */,
); );
name = Resources; name = Resources;
path = ../Resources; path = ../Resources;
@ -207,8 +213,11 @@
/* Begin PBXProject section */ /* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = { 29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = {
LastUpgradeCheck = 0450;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloCpp" */; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloCpp" */;
compatibilityVersion = "Xcode 3.1"; compatibilityVersion = "Xcode 3.2";
developmentRegion = English; developmentRegion = English;
hasScannedForEncodings = 1; hasScannedForEncodings = 1;
knownRegions = ( knownRegions = (
@ -247,13 +256,15 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
782F4619153FEDF0009FC2E5 /* Default.png in Resources */,
D4EF94E815BD319200D803EB /* Icon-57.png in Resources */, D4EF94E815BD319200D803EB /* Icon-57.png in Resources */,
D4EF94EA15BD319500D803EB /* Icon-114.png in Resources */, D4EF94EA15BD319500D803EB /* Icon-114.png in Resources */,
D4EF94EC15BD319B00D803EB /* Icon-72.png in Resources */, D4EF94EC15BD319B00D803EB /* Icon-72.png in Resources */,
D4EF94EE15BD319D00D803EB /* Icon-144.png in Resources */, D4EF94EE15BD319D00D803EB /* Icon-144.png in Resources */,
15003FA315D2601D00B6775A /* iphone in Resources */, 15003FA315D2601D00B6775A /* iphone in Resources */,
15003FA515D2602400B6775A /* iphonehd in Resources */, 15003FA515D2602400B6775A /* iphonehd in Resources */,
D446FD79161028E9000ADA7B /* Default.png in Resources */,
D446FD7B161028ED000ADA7B /* Default@2x.png in Resources */,
D446FD7D161028F4000ADA7B /* Default-568h@2x.png in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -309,6 +320,7 @@
"\"$(SRCROOT)/../../../cocos2dx\"", "\"$(SRCROOT)/../../../cocos2dx\"",
"\"$(SRCROOT)/../../../cocos2dx/platform/ios\"", "\"$(SRCROOT)/../../../cocos2dx/platform/ios\"",
"\"$(SRCROOT)/../../../cocos2dx/kazmath/include\"", "\"$(SRCROOT)/../../../cocos2dx/kazmath/include\"",
"$(SRCROOT)/../../../external/chipmunk/include/chipmunk",
); );
INFOPLIST_FILE = "HelloCpp-Info.plist"; INFOPLIST_FILE = "HelloCpp-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.0; IPHONEOS_DEPLOYMENT_TARGET = 4.0;
@ -343,6 +355,7 @@
"\"$(SRCROOT)/../../../cocos2dx\"", "\"$(SRCROOT)/../../../cocos2dx\"",
"\"$(SRCROOT)/../../../cocos2dx/platform/ios\"", "\"$(SRCROOT)/../../../cocos2dx/platform/ios\"",
"\"$(SRCROOT)/../../../cocos2dx/kazmath/include\"", "\"$(SRCROOT)/../../../cocos2dx/kazmath/include\"",
"$(SRCROOT)/../../../external/chipmunk/include/chipmunk",
); );
INFOPLIST_FILE = "HelloCpp-Info.plist"; INFOPLIST_FILE = "HelloCpp-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.0; IPHONEOS_DEPLOYMENT_TARGET = 4.0;
@ -364,7 +377,6 @@
GCC_VERSION = ""; GCC_VERSION = "";
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
VALID_ARCHS = "armv6 armv7 i386"; VALID_ARCHS = "armv6 armv7 i386";
}; };
@ -380,7 +392,6 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PREBINDING = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
VALID_ARCHS = "armv6 armv7 i386"; VALID_ARCHS = "armv6 armv7 i386";
}; };

View File

@ -52,10 +52,20 @@
*/ */
// Override to allow orientations other than the default portrait orientation. // Override to allow orientations other than the default portrait orientation.
// This method is deprecated on ios6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape( interfaceOrientation ); return UIInterfaceOrientationIsLandscape( interfaceOrientation );
} }
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL) shouldAutorotate {
return YES;
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview. // Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];

View File

@ -57,7 +57,17 @@ static AppDelegate s_sharedApplication;
viewController.view = __glView; viewController.view = __glView;
// Set RootViewController to window // Set RootViewController to window
[window addSubview: viewController.view]; if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
{
// warning: addSubView doesn't work on iOS6
[window addSubview: viewController.view];
}
else
{
// use this method on ios6
[window setRootViewController:viewController];
}
[window makeKeyAndVisible]; [window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES]; [[UIApplication sharedApplication] setStatusBarHidden: YES];

View File

@ -0,0 +1 @@
66c6d1cead373b45218424f6a82f370897e443e4

View File

@ -0,0 +1 @@
84689888a14a2123d2b39f7f2f61be8c15207479

View File

@ -30,6 +30,8 @@
BF82F42113A8652A00616D55 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF82F41F13A8652A00616D55 /* AppController.mm */; }; BF82F42113A8652A00616D55 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF82F41F13A8652A00616D55 /* AppController.mm */; };
BF82F42213A8652A00616D55 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BF82F42013A8652A00616D55 /* main.m */; }; BF82F42213A8652A00616D55 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BF82F42013A8652A00616D55 /* main.m */; };
D403B5D9135D1AF1004B518D /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D403B5D8135D1AF1004B518D /* libxml2.dylib */; }; D403B5D9135D1AF1004B518D /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D403B5D8135D1AF1004B518D /* libxml2.dylib */; };
D41A0AA2160F13F8004552AE /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D41A0AA1160F13F8004552AE /* Default-568h@2x.png */; };
D446FD3B16102085000ADA7B /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FD3A16102085000ADA7B /* Default@2x.png */; };
D4CEAD7913B4634300780515 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = D4CEAD7713B4634300780515 /* RootViewController.mm */; }; D4CEAD7913B4634300780515 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = D4CEAD7713B4634300780515 /* RootViewController.mm */; };
D4EF94D715BD311700D803EB /* Icon-57.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF94D615BD311700D803EB /* Icon-57.png */; }; D4EF94D715BD311700D803EB /* Icon-57.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF94D615BD311700D803EB /* Icon-57.png */; };
D4EF94D915BD311A00D803EB /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF94D815BD311A00D803EB /* Icon-114.png */; }; D4EF94D915BD311A00D803EB /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = D4EF94D815BD311A00D803EB /* Icon-114.png */; };
@ -138,6 +140,8 @@
BF82F42013A8652A00616D55 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; BF82F42013A8652A00616D55 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
BF82F42313A8654600616D55 /* HelloLua_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloLua_Prefix.pch; sourceTree = "<group>"; }; BF82F42313A8654600616D55 /* HelloLua_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloLua_Prefix.pch; sourceTree = "<group>"; };
D403B5D8135D1AF1004B518D /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; D403B5D8135D1AF1004B518D /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; };
D41A0AA1160F13F8004552AE /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "../proj.ios/Default-568h@2x.png"; sourceTree = "<group>"; };
D446FD3A16102085000ADA7B /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default@2x.png"; path = "../proj.ios/Default@2x.png"; sourceTree = "<group>"; };
D4CEAD7713B4634300780515 /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = "<group>"; }; D4CEAD7713B4634300780515 /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = "<group>"; };
D4CEAD7813B4634300780515 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = "<group>"; }; D4CEAD7813B4634300780515 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = "<group>"; };
D4EF94D615BD311700D803EB /* Icon-57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-57.png"; path = "../proj.ios/Icon-57.png"; sourceTree = "<group>"; }; D4EF94D615BD311700D803EB /* Icon-57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-57.png"; path = "../proj.ios/Icon-57.png"; sourceTree = "<group>"; };
@ -352,7 +356,6 @@
D4EF94D615BD311700D803EB /* Icon-57.png */, D4EF94D615BD311700D803EB /* Icon-57.png */,
78947C5E14EBB9B000DBD5A6 /* background.mp3 */, 78947C5E14EBB9B000DBD5A6 /* background.mp3 */,
78947C5F14EBB9B000DBD5A6 /* crop.png */, 78947C5F14EBB9B000DBD5A6 /* crop.png */,
78DC4C9815490B9500317402 /* Default.png */,
78947C6114EBB9B000DBD5A6 /* dog.png */, 78947C6114EBB9B000DBD5A6 /* dog.png */,
78947C6214EBB9B000DBD5A6 /* effect1.wav */, 78947C6214EBB9B000DBD5A6 /* effect1.wav */,
78947C6314EBB9B000DBD5A6 /* farm.jpg */, 78947C6314EBB9B000DBD5A6 /* farm.jpg */,
@ -361,6 +364,9 @@
78947C6914EBB9B000DBD5A6 /* land.png */, 78947C6914EBB9B000DBD5A6 /* land.png */,
78947C6A14EBB9B000DBD5A6 /* menu1.png */, 78947C6A14EBB9B000DBD5A6 /* menu1.png */,
78947C6B14EBB9B000DBD5A6 /* menu2.png */, 78947C6B14EBB9B000DBD5A6 /* menu2.png */,
78DC4C9815490B9500317402 /* Default.png */,
D446FD3A16102085000ADA7B /* Default@2x.png */,
D41A0AA1160F13F8004552AE /* Default-568h@2x.png */,
); );
name = Resources; name = Resources;
path = ../Resources; path = ../Resources;
@ -588,6 +594,8 @@
D4EF94D915BD311A00D803EB /* Icon-114.png in Resources */, D4EF94D915BD311A00D803EB /* Icon-114.png in Resources */,
D4EF94DB15BD311E00D803EB /* Icon-72.png in Resources */, D4EF94DB15BD311E00D803EB /* Icon-72.png in Resources */,
D4EF94DD15BD312100D803EB /* Icon-144.png in Resources */, D4EF94DD15BD312100D803EB /* Icon-144.png in Resources */,
D41A0AA2160F13F8004552AE /* Default-568h@2x.png in Resources */,
D446FD3B16102085000ADA7B /* Default@2x.png in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -52,10 +52,20 @@
*/ */
// Override to allow orientations other than the default portrait orientation. // Override to allow orientations other than the default portrait orientation.
// This method is deprecated on ios6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape( interfaceOrientation ); return UIInterfaceOrientationIsLandscape( interfaceOrientation );
} }
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL) shouldAutorotate {
return YES;
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview. // Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];

View File

@ -3,6 +3,7 @@
USING_NS_CC; USING_NS_CC;
AppDelegate::AppDelegate() { AppDelegate::AppDelegate() {
} }
@ -14,7 +15,7 @@ AppDelegate::~AppDelegate()
bool AppDelegate::applicationDidFinishLaunching() { bool AppDelegate::applicationDidFinishLaunching() {
// initialize director // initialize director
CCDirector *pDirector = CCDirector::sharedDirector(); CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
TargetPlatform target = getTargetPlatform(); TargetPlatform target = getTargetPlatform();
@ -30,15 +31,17 @@ bool AppDelegate::applicationDidFinishLaunching() {
} }
else if (target == kTargetIphone) else if (target == kTargetIphone)
{ {
if (pDirector->enableRetinaDisplay(true)) if (CCEGLView::sharedOpenGLView()->enableRetina())
{ {
// well, it's a iPhone 4 and above, with 960x480 Retina resolution // well, it's a iPhone 4 and above, with 960x480 Retina resolution
CCFileUtils::sharedFileUtils()->setResourceDirectory("hd"); CCFileUtils::sharedFileUtils()->setResourceDirectory("hd");
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(960, 640, kResolutionNoBorder);
} }
else else
{ {
// iPhone 3GS and before, with 480x320 resolution // iPhone 3GS and before, with 480x320 resolution
CCFileUtils::sharedFileUtils()->setResourceDirectory("sd"); CCFileUtils::sharedFileUtils()->setResourceDirectory("sd");
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(480, 320, kResolutionNoBorder);
} }
} }
else else

View File

@ -4,6 +4,8 @@
using namespace cocos2d; using namespace cocos2d;
extern float g_scaleRatio;
HelloWorld::~HelloWorld() HelloWorld::~HelloWorld()
{ {
if (_targets) if (_targets)
@ -26,7 +28,18 @@ HelloWorld::HelloWorld()
:_targets(NULL) :_targets(NULL)
,_projectiles(NULL) ,_projectiles(NULL)
,_projectilesDestroyed(0) ,_projectilesDestroyed(0)
,_scaleRatio(1.0)
{ {
if ( 0 == strcmp(CCFileUtils::sharedFileUtils()->getResourceDirectory(), "hd/") )
{
// AppDelegate.cpp used hd resource & 960x640 design resolution
_scaleRatio = 2.0;
}
else
{
// sd
_scaleRatio = 1.0;
}
} }
CCScene* HelloWorld::scene() CCScene* HelloWorld::scene()
@ -75,10 +88,13 @@ bool HelloWorld::init()
this, this,
menu_selector(HelloWorld::menuCloseCallback)); menu_selector(HelloWorld::menuCloseCallback));
CC_BREAK_IF(! pCloseItem); CC_BREAK_IF(! pCloseItem);
// Place the menu item bottom-right conner. // Place the menu item bottom-right conner.
pCloseItem->setPosition(ccp(CCDirector::sharedDirector()->getVisibleSize().width - 20, CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCDirector::sharedDirector()->getVisibleOrigin().y + 20)); CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2,
origin.y + pCloseItem->getContentSize().height/2));
// Create a menu with the "close" menu item, it's an auto release object. // Create a menu with the "close" menu item, it's an auto release object.
CCMenu* pMenu = CCMenu::create(pCloseItem, NULL); CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
@ -90,10 +106,10 @@ bool HelloWorld::init()
///////////////////////////// /////////////////////////////
// 2. add your codes below... // 2. add your codes below...
CCSprite *player = CCSprite::create("Player.png", CCRectMake(0, 0, 27*_scaleRatio, 40*_scaleRatio) );
CCSize winSize = CCDirector::sharedDirector()->getVisibleSize();
CCSprite *player = CCSprite::create("Player.png", CCRectMake(0, 0, 27, 40) ); player->setPosition( ccp(origin.x + player->getContentSize().width/2,
player->setPosition( ccp(player->getContentSize().width/2, winSize.height/2) ); origin.y + visibleSize.height/2) );
this->addChild(player); this->addChild(player);
this->schedule( schedule_selector(HelloWorld::gameLogic), 1.0 ); this->schedule( schedule_selector(HelloWorld::gameLogic), 1.0 );
@ -124,8 +140,8 @@ void HelloWorld::menuCloseCallback(CCObject* pSender)
// cpp with cocos2d-x // cpp with cocos2d-x
void HelloWorld::addTarget() void HelloWorld::addTarget()
{ {
CCSprite *target = CCSprite::create("Target.png", CCRectMake(0,0,27,40) ); CCSprite *target = CCSprite::create("Target.png", CCRectMake(0,0,27*_scaleRatio,40*_scaleRatio) );
// Determine where to spawn the target along the Y axis // Determine where to spawn the target along the Y axis
CCSize winSize = CCDirector::sharedDirector()->getVisibleSize(); CCSize winSize = CCDirector::sharedDirector()->getVisibleSize();
float minY = target->getContentSize().height/2; float minY = target->getContentSize().height/2;
@ -196,7 +212,7 @@ void HelloWorld::ccTouchesEnded(CCSet* touches, CCEvent* event)
// Set up initial location of projectile // Set up initial location of projectile
CCSize winSize = CCDirector::sharedDirector()->getVisibleSize(); CCSize winSize = CCDirector::sharedDirector()->getVisibleSize();
CCSprite *projectile = CCSprite::create("Projectile.png", CCRectMake(0, 0, 20, 20)); CCSprite *projectile = CCSprite::create("Projectile.png", CCRectMake(0, 0, 20*_scaleRatio, 20*_scaleRatio));
projectile->setPosition( ccp(20, winSize.height/2) ); projectile->setPosition( ccp(20, winSize.height/2) );
// Determinie offset of location to projectile // Determinie offset of location to projectile

View File

@ -38,6 +38,7 @@ protected:
cocos2d::CCArray *_targets; cocos2d::CCArray *_targets;
cocos2d::CCArray *_projectiles; cocos2d::CCArray *_projectiles;
int _projectilesDestroyed; int _projectilesDestroyed;
float _scaleRatio;
void addTarget(); void addTarget();

View File

@ -57,7 +57,17 @@ static AppDelegate s_sharedApplication;
viewController.view = __glView; viewController.view = __glView;
// Set RootViewController to window // Set RootViewController to window
[window addSubview: viewController.view]; if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
{
// warning: addSubView doesn't work on iOS6
[window addSubview: viewController.view];
}
else
{
// use this method on ios6
[window setRootViewController:viewController];
}
[window makeKeyAndVisible]; [window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES]; [[UIApplication sharedApplication] setStatusBarHidden: YES];

View File

@ -0,0 +1 @@
66c6d1cead373b45218424f6a82f370897e443e4

View File

@ -0,0 +1 @@
84689888a14a2123d2b39f7f2f61be8c15207479

View File

@ -52,10 +52,20 @@
*/ */
// Override to allow orientations other than the default portrait orientation. // Override to allow orientations other than the default portrait orientation.
// This method is deprecated on ios6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape( interfaceOrientation ); return UIInterfaceOrientationIsLandscape( interfaceOrientation );
} }
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL) shouldAutorotate {
return YES;
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview. // Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];

View File

@ -19,6 +19,8 @@
BF23D4E8143315EB00657E08 /* HelloWorldScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BF23D4E5143315EB00657E08 /* HelloWorldScene.cpp */; }; BF23D4E8143315EB00657E08 /* HelloWorldScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BF23D4E5143315EB00657E08 /* HelloWorldScene.cpp */; };
BF365AA812A103F70050DCF4 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF365AA712A103F70050DCF4 /* AppController.mm */; }; BF365AA812A103F70050DCF4 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF365AA712A103F70050DCF4 /* AppController.mm */; };
BF4DE6AD138BB89600CF907D /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF4DE6AC138BB89600CF907D /* RootViewController.mm */; }; BF4DE6AD138BB89600CF907D /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF4DE6AC138BB89600CF907D /* RootViewController.mm */; };
D41A0AC6160F14F5004552AE /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D41A0AC5160F14F5004552AE /* Default-568h@2x.png */; };
D446FD47161020AC000ADA7B /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FD46161020AB000ADA7B /* Default@2x.png */; };
D4ABB4B313B4395300552E6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D4ABB4B213B4395300552E6E /* main.m */; }; D4ABB4B313B4395300552E6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D4ABB4B213B4395300552E6E /* main.m */; };
D4E6BC8515FCB4A4008BF525 /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D4E6BC8315FCB477008BF525 /* libcocos2dx.a */; }; D4E6BC8515FCB4A4008BF525 /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D4E6BC8315FCB477008BF525 /* libcocos2dx.a */; };
D4E6BC9215FCB5BA008BF525 /* GameOverScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D4E6BC9015FCB5BA008BF525 /* GameOverScene.cpp */; }; D4E6BC9215FCB5BA008BF525 /* GameOverScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D4E6BC9015FCB5BA008BF525 /* GameOverScene.cpp */; };
@ -71,6 +73,8 @@
BF492D4B1289302400A09262 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; BF492D4B1289302400A09262 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
BF4DE6AB138BB89600CF907D /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = "<group>"; }; BF4DE6AB138BB89600CF907D /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = "<group>"; };
BF4DE6AC138BB89600CF907D /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = "<group>"; }; BF4DE6AC138BB89600CF907D /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = "<group>"; };
D41A0AC5160F14F5004552AE /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "../proj.ios/Default-568h@2x.png"; sourceTree = "<group>"; };
D446FD46161020AB000ADA7B /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default@2x.png"; path = "../proj.ios/Default@2x.png"; sourceTree = "<group>"; };
D4ABB4B213B4395300552E6E /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; D4ABB4B213B4395300552E6E /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
D4E6BC7B15FCB477008BF525 /* cocos2dx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2dx.xcodeproj; path = ../../../cocos2dx/proj.ios/cocos2dx.xcodeproj; sourceTree = "<group>"; }; D4E6BC7B15FCB477008BF525 /* cocos2dx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2dx.xcodeproj; path = ../../../cocos2dx/proj.ios/cocos2dx.xcodeproj; sourceTree = "<group>"; };
D4E6BC9015FCB5BA008BF525 /* GameOverScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GameOverScene.cpp; sourceTree = "<group>"; }; D4E6BC9015FCB5BA008BF525 /* GameOverScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GameOverScene.cpp; sourceTree = "<group>"; };
@ -170,6 +174,8 @@
D4EF94E915BD319500D803EB /* Icon-114.png */, D4EF94E915BD319500D803EB /* Icon-114.png */,
D4EF94E715BD319200D803EB /* Icon-57.png */, D4EF94E715BD319200D803EB /* Icon-57.png */,
782F4617153FEDF0009FC2E5 /* Default.png */, 782F4617153FEDF0009FC2E5 /* Default.png */,
D446FD46161020AB000ADA7B /* Default@2x.png */,
D41A0AC5160F14F5004552AE /* Default-568h@2x.png */,
); );
name = Resources; name = Resources;
path = ../Resources; path = ../Resources;
@ -320,6 +326,8 @@
D4E6BCC915FCB6AA008BF525 /* hd in Resources */, D4E6BCC915FCB6AA008BF525 /* hd in Resources */,
D4E6BCCA15FCB6AA008BF525 /* pew-pew-lei.wav in Resources */, D4E6BCCA15FCB6AA008BF525 /* pew-pew-lei.wav in Resources */,
D4E6BCCB15FCB6AA008BF525 /* sd in Resources */, D4E6BCCB15FCB6AA008BF525 /* sd in Resources */,
D41A0AC6160F14F5004552AE /* Default-568h@2x.png in Resources */,
D446FD47161020AC000ADA7B /* Default@2x.png in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -15,7 +15,7 @@ public:
AnimationsTestLayer(); AnimationsTestLayer();
virtual ~AnimationsTestLayer(); virtual ~AnimationsTestLayer();
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName); virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, cocos2d::CCString * pSelectorName);
virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName); virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(cocos2d::CCObject * pTarget, cocos2d::CCString * pSelectorName);
virtual bool onAssignCCBMemberVariable(cocos2d::CCObject * pTarget, cocos2d::CCString * pMemberVariableName, cocos2d::CCNode * pNode); virtual bool onAssignCCBMemberVariable(cocos2d::CCObject * pTarget, cocos2d::CCString * pMemberVariableName, cocos2d::CCNode * pNode);

View File

@ -35,10 +35,20 @@
*/ */
// Override to allow orientations other than the default portrait orientation. // Override to allow orientations other than the default portrait orientation.
// This method is deprecated on ios6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape( interfaceOrientation ); return UIInterfaceOrientationIsLandscape( interfaceOrientation );
} }
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL) shouldAutorotate {
return YES;
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview. // Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];

View File

@ -44,7 +44,17 @@ static AppDelegate s_sharedApplication;
viewController.view = __glView; viewController.view = __glView;
// Set RootViewController to window // Set RootViewController to window
[window addSubview: viewController.view]; if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
{
// warning: addSubView doesn't work on iOS6
[window addSubview: viewController.view];
}
else
{
// use this method on ios6
[window setRootViewController:viewController];
}
[window makeKeyAndVisible]; [window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden:true]; [[UIApplication sharedApplication] setStatusBarHidden:true];

View File

@ -0,0 +1 @@
66c6d1cead373b45218424f6a82f370897e443e4

View File

@ -0,0 +1 @@
84689888a14a2123d2b39f7f2f61be8c15207479

View File

@ -1 +1 @@
4e9a0c8b08e12b2d6d915f77e26eae289a302051 cbe8a4c43be345c2fcb9b0e46e02ef3a1fc21c80

View File

@ -69,7 +69,7 @@ OBJECTS = ../Classes/AccelerometerTest/AccelerometerTest.o \
../Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.o \ ../Classes/ExtensionsTest/CocosBuilderTest/ButtonTest/ButtonTestLayer.o \
../Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.o \ ../Classes/ExtensionsTest/CocosBuilderTest/CocosBuilderTest.o \
../Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.o \ ../Classes/ExtensionsTest/CocosBuilderTest/HelloCocosBuilder/HelloCocosBuilderLayer.o \
../Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsLayer.o \ ../Classes/ExtensionsTest/CocosBuilderTest/AnimationsTest/AnimationsTestLayer.o \
../Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.o \ ../Classes/ExtensionsTest/CocosBuilderTest/MenuTest/MenuTestLayer.o \
../Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.o \ ../Classes/ExtensionsTest/CocosBuilderTest/TestHeader/TestHeaderLayer.o \
../Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.o \ ../Classes/ExtensionsTest/ControlExtensionTest/CCControlButtonTest/CCControlButtonTest.o \

View File

@ -3,7 +3,7 @@
#include "cocos2d.h" #include "cocos2d.h"
#include "SimpleAudioEngine.h" #include "SimpleAudioEngine.h"
#include "ScriptingCore.h" #include "ScriptingCore.h"
#include "cocos2dx.hpp" #include "generated/cocos2dx.hpp"
#include "cocos2d_specifics.hpp" #include "cocos2d_specifics.hpp"
#include "js_bindings_chipmunk_manual.hpp" #include "js_bindings_chipmunk_manual.hpp"
@ -34,8 +34,6 @@ bool AppDelegate::applicationDidFinishLaunching()
// set FPS. the default value is 1.0/60 if you don't call this // set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60); pDirector->setAnimationInterval(1.0 / 60);
CCScene * pScene = CCScene::create();
ScriptingCore* sc = ScriptingCore::getInstance(); ScriptingCore* sc = ScriptingCore::getInstance();
sc->addRegisterCallback(register_all_cocos2dx); sc->addRegisterCallback(register_all_cocos2dx);
sc->addRegisterCallback(register_cocos2dx_js_extensions); sc->addRegisterCallback(register_cocos2dx_js_extensions);

View File

@ -429,7 +429,7 @@ function performanceActions20(sprite) {
var growDuration = 0.5 + (Math.random() * 1000) / 500.0; var growDuration = 0.5 + (Math.random() * 1000) / 500.0;
var grow = cc.ScaleBy.create(growDuration, 0.5, 0.5); var grow = cc.ScaleBy.create(growDuration, 0.5, 0.5);
var permanentScaleLoop = cc.RepeatForever.create(cc.Sequence._actionOneTwo(grow, grow.reverse())); var permanentScaleLoop = cc.RepeatForever.create(cc.Sequence.create(grow, grow.reverse()));
sprite.runAction(permanentScaleLoop); sprite.runAction(permanentScaleLoop);
} }

View File

@ -12,6 +12,8 @@ director = cc.Director.getInstance();
winSize = director.getWinSize(); winSize = director.getWinSize();
centerPos = cc.p( winSize.width/2, winSize.height/2 ); centerPos = cc.p( winSize.width/2, winSize.height/2 );
var TAG_ACTION1_EASE_ACTIONS = 1001;
var scenes = [] var scenes = []
var currentScene = 0; var currentScene = 0;

View File

@ -41,7 +41,17 @@ static AppDelegate s_sharedApplication;
viewController.view = __glView; viewController.view = __glView;
// Set RootViewController to window // Set RootViewController to window
[window addSubview: viewController.view]; if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
{
// warning: addSubView doesn't work on iOS6
[window addSubview: viewController.view];
}
else
{
// use this method on ios6
[window setRootViewController:viewController];
}
[window makeKeyAndVisible]; [window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES]; [[UIApplication sharedApplication] setStatusBarHidden: YES];

View File

@ -0,0 +1 @@
66c6d1cead373b45218424f6a82f370897e443e4

View File

@ -0,0 +1 @@
84689888a14a2123d2b39f7f2f61be8c15207479

View File

@ -34,12 +34,19 @@
} }
*/ */
// Override to allow orientations other than the default landscape orientation. // Override to allow orientations other than the default portrait orientation.
// This method is deprecated on ios6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape( interfaceOrientation ); return UIInterfaceOrientationIsLandscape( interfaceOrientation );
}
// switch to this line if you want to set portrait view
// return UIInterfaceOrientationIsPortrait( interfaceOrientation ); // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL) shouldAutorotate {
return YES;
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {

View File

@ -88,6 +88,9 @@
A922754C1517C094001B78AA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A922754B1517C094001B78AA /* UIKit.framework */; }; A922754C1517C094001B78AA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A922754B1517C094001B78AA /* UIKit.framework */; };
A922754E1517C094001B78AA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A922754D1517C094001B78AA /* Foundation.framework */; }; A922754E1517C094001B78AA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A922754D1517C094001B78AA /* Foundation.framework */; };
A92275501517C094001B78AA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A922754F1517C094001B78AA /* CoreGraphics.framework */; }; A92275501517C094001B78AA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A922754F1517C094001B78AA /* CoreGraphics.framework */; };
D446FDA316102D7D000ADA7B /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FDA216102D7D000ADA7B /* Default.png */; };
D446FDA516102D82000ADA7B /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FDA416102D82000ADA7B /* Default@2x.png */; };
D446FDA716102D86000ADA7B /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FDA616102D86000ADA7B /* Default-568h@2x.png */; };
D45446D3156DE74F00887EB5 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = D45446CE156DE74F00887EB5 /* AppController.mm */; }; D45446D3156DE74F00887EB5 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = D45446CE156DE74F00887EB5 /* AppController.mm */; };
D45446D4156DE74F00887EB5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D45446CF156DE74F00887EB5 /* main.m */; }; D45446D4156DE74F00887EB5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D45446CF156DE74F00887EB5 /* main.m */; };
D45446D5156DE74F00887EB5 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = D45446D2156DE74F00887EB5 /* RootViewController.mm */; }; D45446D5156DE74F00887EB5 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = D45446D2156DE74F00887EB5 /* RootViewController.mm */; };
@ -239,6 +242,9 @@
A922754B1517C094001B78AA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; A922754B1517C094001B78AA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
A922754D1517C094001B78AA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; A922754D1517C094001B78AA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
A922754F1517C094001B78AA /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; A922754F1517C094001B78AA /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
D446FDA216102D7D000ADA7B /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
D446FDA416102D82000ADA7B /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
D446FDA616102D86000ADA7B /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
D45446CD156DE74F00887EB5 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = "<group>"; }; D45446CD156DE74F00887EB5 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = "<group>"; };
D45446CE156DE74F00887EB5 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = "<group>"; }; D45446CE156DE74F00887EB5 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = "<group>"; };
D45446CF156DE74F00887EB5 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; D45446CF156DE74F00887EB5 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
@ -321,6 +327,9 @@
15628F5B15F0F5C2000CF24B /* Resources */ = { 15628F5B15F0F5C2000CF24B /* Resources */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
D446FDA616102D86000ADA7B /* Default-568h@2x.png */,
D446FDA416102D82000ADA7B /* Default@2x.png */,
D446FDA216102D7D000ADA7B /* Default.png */,
15628FA815F1057E000CF24B /* animations */, 15628FA815F1057E000CF24B /* animations */,
15628F5D15F0F5E5000CF24B /* ballbounce.wav */, 15628F5D15F0F5E5000CF24B /* ballbounce.wav */,
15628F5E15F0F5E5000CF24B /* cowbell.wav */, 15628F5E15F0F5E5000CF24B /* cowbell.wav */,
@ -486,9 +495,9 @@
A92275321517C094001B78AA = { A92275321517C094001B78AA = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
15426AE915B5733200712A7F /* cocos2dx.xcodeproj */,
15628F5B15F0F5C2000CF24B /* Resources */, 15628F5B15F0F5C2000CF24B /* Resources */,
2628297C15EC7196002C4240 /* chipmunk */, 2628297C15EC7196002C4240 /* chipmunk */,
15426AE915B5733200712A7F /* cocos2dx.xcodeproj */,
F2837A9C15B9639100A5707B /* bindings */, F2837A9C15B9639100A5707B /* bindings */,
D4545214156E28EF00887EB5 /* Classes */, D4545214156E28EF00887EB5 /* Classes */,
15426FC415B5743C00712A7F /* CocosDenshion */, 15426FC415B5743C00712A7F /* CocosDenshion */,
@ -669,6 +678,9 @@
15628F7815F0F5E5000CF24B /* tank1.png in Resources */, 15628F7815F0F5E5000CF24B /* tank1.png in Resources */,
15628F7915F0F5E5000CF24B /* TileMaps in Resources */, 15628F7915F0F5E5000CF24B /* TileMaps in Resources */,
15628FA915F1057E000CF24B /* animations in Resources */, 15628FA915F1057E000CF24B /* animations in Resources */,
D446FDA316102D7D000ADA7B /* Default.png in Resources */,
D446FDA516102D82000ADA7B /* Default@2x.png in Resources */,
D446FDA716102D86000ADA7B /* Default-568h@2x.png in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -49,7 +49,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories=".;..\Classes;&quot;$(SolutionDir)scripting\javascript\spidermonkey-win32\include&quot;;&quot;$(SolutionDir)scripting\javascript\bindings&quot;;&quot;$(SolutionDir)external\chipmunk\include\chipmunk&quot;;&quot;$(SolutionDir)cocos2dx&quot;;&quot;$(SolutionDir)cocos2dx\include&quot;;&quot;$(SolutionDir)cocos2dx\kazmath\include&quot;;&quot;$(SolutionDir)cocos2dx\platform\win32&quot;;&quot;$(SolutionDir)cocos2dx\platform\third_party\win32&quot;;&quot;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES&quot;;&quot;$(SolutionDir)CocosDenshion\include&quot;" AdditionalIncludeDirectories=".;..\Classes;&quot;$(SolutionDir)scripting\javascript\spidermonkey-win32\include&quot;;&quot;$(SolutionDir)scripting\javascript\bindings&quot;;&quot;$(SolutionDir)external\chipmunk\include\chipmunk&quot;;&quot;$(SolutionDir)extensions&quot;;&quot;$(SolutionDir)cocos2dx&quot;;&quot;$(SolutionDir)cocos2dx\include&quot;;&quot;$(SolutionDir)cocos2dx\kazmath\include&quot;;&quot;$(SolutionDir)cocos2dx\platform\win32&quot;;&quot;$(SolutionDir)cocos2dx\platform\third_party\win32&quot;;&quot;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES&quot;;&quot;$(SolutionDir)CocosDenshion\include&quot;"
PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;DEBUG;_DEBUG;TRACING;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS" PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;DEBUG;_DEBUG;TRACING;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@ -74,7 +74,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="libcocos2d.lib libCocosDenshion.lib libchipmunk.lib mozjs.lib" AdditionalDependencies="libcocos2d.lib libCocosDenshion.lib libchipmunk.lib mozjs.lib opengl32.lib glew32.lib"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(OutDir)&quot;" AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
GenerateDebugInformation="true" GenerateDebugInformation="true"
@ -136,7 +136,7 @@
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\Classes;&quot;$(SolutionDir)scripting\javascript\spidermonkey-win32\include&quot;;&quot;$(SolutionDir)scripting\javascript\bindings&quot;;&quot;$(SolutionDir)external\chipmunk\include\chipmunk&quot;;&quot;$(SolutionDir)cocos2dx&quot;;&quot;$(SolutionDir)cocos2dx\include&quot;;&quot;$(SolutionDir)cocos2dx\kazmath\include&quot;;&quot;$(SolutionDir)cocos2dx\platform\win32&quot;;&quot;$(SolutionDir)cocos2dx\platform\third_party\win32&quot;;&quot;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES&quot;;&quot;$(SolutionDir)CocosDenshion\include&quot;" AdditionalIncludeDirectories=".;..\Classes;&quot;$(SolutionDir)scripting\javascript\spidermonkey-win32\include&quot;;&quot;$(SolutionDir)scripting\javascript\bindings&quot;;&quot;$(SolutionDir)external\chipmunk\include\chipmunk&quot;;&quot;$(SolutionDir)extensions&quot;;&quot;$(SolutionDir)cocos2dx&quot;;&quot;$(SolutionDir)cocos2dx\include&quot;;&quot;$(SolutionDir)cocos2dx\kazmath\include&quot;;&quot;$(SolutionDir)cocos2dx\platform\win32&quot;;&quot;$(SolutionDir)cocos2dx\platform\third_party\win32&quot;;&quot;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES&quot;;&quot;$(SolutionDir)CocosDenshion\include&quot;"
PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;NDEBUG;COCOS2D_JAVASCRIPT;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS" PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;NDEBUG;COCOS2D_JAVASCRIPT;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS"
ExceptionHandling="0" ExceptionHandling="0"
RuntimeLibrary="2" RuntimeLibrary="2"
@ -160,7 +160,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="libcocos2d.lib libCocosDenshion.lib libchipmunk.lib mozjs.lib" AdditionalDependencies="libcocos2d.lib libCocosDenshion.lib libchipmunk.lib mozjs.lib opengl32.lib glew32.lib"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="$(OutDir)" AdditionalLibraryDirectories="$(OutDir)"
SubSystem="2" SubSystem="2"
@ -212,11 +212,19 @@
> >
</File> </File>
<File <File
RelativePath="..\..\..\scripting\javascript\bindings\cocos2dx.cpp" RelativePath="..\..\..\scripting\javascript\bindings\cocosjs_manual_conversions.cpp"
> >
</File> </File>
<File <File
RelativePath="..\..\..\scripting\javascript\bindings\cocos2dx.hpp" RelativePath="..\..\..\scripting\javascript\bindings\cocosjs_manual_conversions.h"
>
</File>
<File
RelativePath="..\..\..\scripting\javascript\bindings\js_bindings_ccbreader.cpp"
>
</File>
<File
RelativePath="..\..\..\scripting\javascript\bindings\js_bindings_ccbreader.h"
> >
</File> </File>
<File <File
@ -259,6 +267,18 @@
RelativePath="..\..\..\scripting\javascript\bindings\spidermonkey_specifics.h" RelativePath="..\..\..\scripting\javascript\bindings\spidermonkey_specifics.h"
> >
</File> </File>
<Filter
Name="generated"
>
<File
RelativePath="..\..\..\scripting\javascript\bindings\generated\cocos2dx.cpp"
>
</File>
<File
RelativePath="..\..\..\scripting\javascript\bindings\generated\cocos2dx.hpp"
>
</File>
</Filter>
</Filter> </Filter>
<Filter <Filter
Name="resource" Name="resource"

View File

@ -63,7 +63,7 @@
</Midl> </Midl>
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;..\Classes;$(SolutionDir)scripting\javascript\spidermonkey-win32\include;$(SolutionDir)external\chipmunk\include\chipmunk;$(SolutionDir)scripting\javascript\bindings;$(SolutionDir)cocos2dx;$(SolutionDir)cocos2dx\include;$(SolutionDir)cocos2dx\kazmath\include;$(SolutionDir)cocos2dx\platform\win32;$(SolutionDir)cocos2dx\platform\third_party\win32;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES;$(SolutionDir)CocosDenshion\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>.;..\Classes;$(SolutionDir)scripting\javascript\spidermonkey-win32\include;$(SolutionDir)external\chipmunk\include\chipmunk;$(SolutionDir)scripting\javascript\bindings;$(SolutionDir)extensions;$(SolutionDir)cocos2dx;$(SolutionDir)cocos2dx\include;$(SolutionDir)cocos2dx\kazmath\include;$(SolutionDir)cocos2dx\platform\win32;$(SolutionDir)cocos2dx\platform\third_party\win32;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES;$(SolutionDir)CocosDenshion\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild> <MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -85,7 +85,7 @@ xcopy /Y /Q "$(SolutionDir)scripting\javascript\spidermonkey-win32\lib\*.*" "$(O
</Command> </Command>
</PreLinkEvent> </PreLinkEvent>
<Link> <Link>
<AdditionalDependencies>libcocos2d.lib;opengl32.lib;glew32.lib;libCocosDenshion.lib;libchipmunk.lib;mozjs.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>libcocos2d.lib;libExtensions.lib;opengl32.lib;glew32.lib;libCocosDenshion.lib;libchipmunk.lib;mozjs.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
@ -106,7 +106,7 @@ xcopy /Y /Q "$(SolutionDir)scripting\javascript\spidermonkey-win32\lib\*.*" "$(O
<ProxyFileName>testjs_p.c</ProxyFileName> <ProxyFileName>testjs_p.c</ProxyFileName>
</Midl> </Midl>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>.;..\Classes;$(SolutionDir)scripting\javascript\spidermonkey-win32\include;$(SolutionDir)external\chipmunk\include\chipmunk;$(SolutionDir)scripting\javascript\bindings;$(SolutionDir)cocos2dx;$(SolutionDir)cocos2dx\include;$(SolutionDir)cocos2dx\kazmath\include;$(SolutionDir)cocos2dx\platform\win32;$(SolutionDir)cocos2dx\platform\third_party\win32;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES;$(SolutionDir)CocosDenshion\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>.;..\Classes;$(SolutionDir)scripting\javascript\spidermonkey-win32\include;$(SolutionDir)external\chipmunk\include\chipmunk;$(SolutionDir)scripting\javascript\bindings;$(SolutionDir)extensions;$(SolutionDir)cocos2dx;$(SolutionDir)cocos2dx\include;$(SolutionDir)cocos2dx\kazmath\include;$(SolutionDir)cocos2dx\platform\win32;$(SolutionDir)cocos2dx\platform\third_party\win32;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES;$(SolutionDir)CocosDenshion\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling> <ExceptionHandling>
</ExceptionHandling> </ExceptionHandling>
@ -129,7 +129,7 @@ xcopy /Y /Q "$(SolutionDir)scripting\javascript\spidermonkey-win32\lib\*.*" "$(O
</Command> </Command>
</PreLinkEvent> </PreLinkEvent>
<Link> <Link>
<AdditionalDependencies>libcocos2d.lib;opengl32.lib;glew32.lib;libCocosDenshion.lib;libchipmunk.lib;mozjs.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>libcocos2d.lib;libExtensions.lib;opengl32.lib;glew32.lib;libCocosDenshion.lib;libchipmunk.lib;mozjs.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
@ -137,8 +137,10 @@ xcopy /Y /Q "$(SolutionDir)scripting\javascript\spidermonkey-win32\lib\*.*" "$(O
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\..\scripting\javascript\bindings\CCPhysicsSprite.cpp" /> <ClCompile Include="..\..\..\scripting\javascript\bindings\CCPhysicsSprite.cpp" />
<ClCompile Include="..\..\..\scripting\javascript\bindings\cocos2dx.cpp" />
<ClCompile Include="..\..\..\scripting\javascript\bindings\cocos2d_specifics.cpp" /> <ClCompile Include="..\..\..\scripting\javascript\bindings\cocos2d_specifics.cpp" />
<ClCompile Include="..\..\..\scripting\javascript\bindings\cocosjs_manual_conversions.cpp" />
<ClCompile Include="..\..\..\scripting\javascript\bindings\generated\cocos2dx.cpp" />
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_ccbreader.cpp" />
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_functions.cpp" /> <ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_functions.cpp" />
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_manual.cpp" /> <ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_manual.cpp" />
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_manual_conversions.cpp" /> <ClCompile Include="..\..\..\scripting\javascript\bindings\js_manual_conversions.cpp" />
@ -148,8 +150,10 @@ xcopy /Y /Q "$(SolutionDir)scripting\javascript\spidermonkey-win32\lib\*.*" "$(O
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\..\scripting\javascript\bindings\CCPhysicsSprite.h" /> <ClInclude Include="..\..\..\scripting\javascript\bindings\CCPhysicsSprite.h" />
<ClInclude Include="..\..\..\scripting\javascript\bindings\cocos2dx.hpp" />
<ClInclude Include="..\..\..\scripting\javascript\bindings\cocos2d_specifics.hpp" /> <ClInclude Include="..\..\..\scripting\javascript\bindings\cocos2d_specifics.hpp" />
<ClInclude Include="..\..\..\scripting\javascript\bindings\cocosjs_manual_conversions.h" />
<ClInclude Include="..\..\..\scripting\javascript\bindings\generated\cocos2dx.hpp" />
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_ccbreader.h" />
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_functions.hpp" /> <ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_functions.hpp" />
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_manual.hpp" /> <ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_manual.hpp" />
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_config.h" /> <ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_config.h" />

View File

@ -14,6 +14,9 @@
<Filter Include="Classes"> <Filter Include="Classes">
<UniqueIdentifier>{e93a77e1-af1e-4400-87d3-504b62ebdbb0}</UniqueIdentifier> <UniqueIdentifier>{e93a77e1-af1e-4400-87d3-504b62ebdbb0}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="bindings\generated">
<UniqueIdentifier>{146f26cf-13e1-4106-891b-4b0118ceac2b}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
@ -22,15 +25,6 @@
<ClCompile Include="..\Classes\AppDelegate.cpp"> <ClCompile Include="..\Classes\AppDelegate.cpp">
<Filter>Classes</Filter> <Filter>Classes</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\..\scripting\javascript\bindings\CCPhysicsSprite.cpp">
<Filter>bindings</Filter>
</ClCompile>
<ClCompile Include="..\..\..\scripting\javascript\bindings\cocos2d_specifics.cpp">
<Filter>bindings</Filter>
</ClCompile>
<ClCompile Include="..\..\..\scripting\javascript\bindings\cocos2dx.cpp">
<Filter>bindings</Filter>
</ClCompile>
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_functions.cpp"> <ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_functions.cpp">
<Filter>bindings</Filter> <Filter>bindings</Filter>
</ClCompile> </ClCompile>
@ -43,6 +37,21 @@
<ClCompile Include="..\..\..\scripting\javascript\bindings\ScriptingCore.cpp"> <ClCompile Include="..\..\..\scripting\javascript\bindings\ScriptingCore.cpp">
<Filter>bindings</Filter> <Filter>bindings</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\..\scripting\javascript\bindings\CCPhysicsSprite.cpp">
<Filter>bindings</Filter>
</ClCompile>
<ClCompile Include="..\..\..\scripting\javascript\bindings\cocos2d_specifics.cpp">
<Filter>bindings</Filter>
</ClCompile>
<ClCompile Include="..\..\..\scripting\javascript\bindings\cocosjs_manual_conversions.cpp">
<Filter>bindings</Filter>
</ClCompile>
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_ccbreader.cpp">
<Filter>bindings</Filter>
</ClCompile>
<ClCompile Include="..\..\..\scripting\javascript\bindings\generated\cocos2dx.cpp">
<Filter>bindings\generated</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="main.h"> <ClInclude Include="main.h">
@ -54,13 +63,7 @@
<ClInclude Include="..\Classes\AppDelegate.h"> <ClInclude Include="..\Classes\AppDelegate.h">
<Filter>Classes</Filter> <Filter>Classes</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\..\scripting\javascript\bindings\CCPhysicsSprite.h"> <ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_ccbreader.h">
<Filter>bindings</Filter>
</ClInclude>
<ClInclude Include="..\..\..\scripting\javascript\bindings\cocos2d_specifics.hpp">
<Filter>bindings</Filter>
</ClInclude>
<ClInclude Include="..\..\..\scripting\javascript\bindings\cocos2dx.hpp">
<Filter>bindings</Filter> <Filter>bindings</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_functions.hpp"> <ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_functions.hpp">
@ -81,6 +84,18 @@
<ClInclude Include="..\..\..\scripting\javascript\bindings\spidermonkey_specifics.h"> <ClInclude Include="..\..\..\scripting\javascript\bindings\spidermonkey_specifics.h">
<Filter>bindings</Filter> <Filter>bindings</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\..\scripting\javascript\bindings\CCPhysicsSprite.h">
<Filter>bindings</Filter>
</ClInclude>
<ClInclude Include="..\..\..\scripting\javascript\bindings\cocos2d_specifics.hpp">
<Filter>bindings</Filter>
</ClInclude>
<ClInclude Include="..\..\..\scripting\javascript\bindings\cocosjs_manual_conversions.h">
<Filter>bindings</Filter>
</ClInclude>
<ClInclude Include="..\..\..\scripting\javascript\bindings\generated\cocos2dx.hpp">
<Filter>bindings\generated</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="res\testjs.ico"> <None Include="res\testjs.ico">

View File

@ -57,7 +57,17 @@ static AppDelegate s_sharedApplication;
viewController.view = __glView; viewController.view = __glView;
// Set RootViewController to window // Set RootViewController to window
[window addSubview:__glView]; if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
{
// warning: addSubView doesn't work on iOS6
[window addSubview: viewController.view];
}
else
{
// use this method on ios6
[window setRootViewController:viewController];
}
[window makeKeyAndVisible]; [window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES]; [[UIApplication sharedApplication] setStatusBarHidden: YES];

View File

@ -0,0 +1 @@
66c6d1cead373b45218424f6a82f370897e443e4

View File

@ -0,0 +1 @@
84689888a14a2123d2b39f7f2f61be8c15207479

View File

@ -52,10 +52,20 @@
*/ */
// Override to allow orientations other than the default portrait orientation. // Override to allow orientations other than the default portrait orientation.
// This method is deprecated on ios6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape( interfaceOrientation ); return UIInterfaceOrientationIsLandscape( interfaceOrientation );
} }
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL) shouldAutorotate {
return YES;
}
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview. // Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];

View File

@ -11,6 +11,9 @@
158B579C15EC9D86009FCBB4 /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 158B579815EC9D86009FCBB4 /* Icon-72.png */; }; 158B579C15EC9D86009FCBB4 /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 158B579815EC9D86009FCBB4 /* Icon-72.png */; };
158B579D15EC9D86009FCBB4 /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = 158B579915EC9D86009FCBB4 /* Icon-114.png */; }; 158B579D15EC9D86009FCBB4 /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = 158B579915EC9D86009FCBB4 /* Icon-114.png */; };
158B579E15EC9D86009FCBB4 /* Icon-144.png in Resources */ = {isa = PBXBuildFile; fileRef = 158B579A15EC9D86009FCBB4 /* Icon-144.png */; }; 158B579E15EC9D86009FCBB4 /* Icon-144.png in Resources */ = {isa = PBXBuildFile; fileRef = 158B579A15EC9D86009FCBB4 /* Icon-144.png */; };
D41A0AE5160F1640004552AE /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D41A0AE4160F1640004552AE /* Default-568h@2x.png */; };
D446FD9616102D5B000ADA7B /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FD9516102D5B000ADA7B /* Default.png */; };
D446FD9816102D61000ADA7B /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D446FD9716102D61000ADA7B /* Default@2x.png */; };
F293B3CD15EB7BE500256477 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3CC15EB7BE500256477 /* QuartzCore.framework */; }; F293B3CD15EB7BE500256477 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3CC15EB7BE500256477 /* QuartzCore.framework */; };
F293B3CF15EB7BE500256477 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3CE15EB7BE500256477 /* OpenGLES.framework */; }; F293B3CF15EB7BE500256477 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3CE15EB7BE500256477 /* OpenGLES.framework */; };
F293B3D115EB7BE500256477 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3D015EB7BE500256477 /* OpenAL.framework */; }; F293B3D115EB7BE500256477 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3D015EB7BE500256477 /* OpenAL.framework */; };
@ -130,6 +133,9 @@
158B579815EC9D86009FCBB4 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = SOURCE_ROOT; }; 158B579815EC9D86009FCBB4 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = SOURCE_ROOT; };
158B579915EC9D86009FCBB4 /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-114.png"; sourceTree = SOURCE_ROOT; }; 158B579915EC9D86009FCBB4 /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-114.png"; sourceTree = SOURCE_ROOT; };
158B579A15EC9D86009FCBB4 /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-144.png"; sourceTree = SOURCE_ROOT; }; 158B579A15EC9D86009FCBB4 /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-144.png"; sourceTree = SOURCE_ROOT; };
D41A0AE4160F1640004552AE /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "../../TestLua/proj.ios/Default-568h@2x.png"; sourceTree = "<group>"; };
D446FD9516102D5B000ADA7B /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = ../../TestLua/proj.ios/Default.png; sourceTree = "<group>"; };
D446FD9716102D61000ADA7B /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default@2x.png"; path = "../../TestLua/proj.ios/Default@2x.png"; sourceTree = "<group>"; };
F293B3C815EB7BE500256477 /* TestLua.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestLua.app; sourceTree = BUILT_PRODUCTS_DIR; }; F293B3C815EB7BE500256477 /* TestLua.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestLua.app; sourceTree = BUILT_PRODUCTS_DIR; };
F293B3CC15EB7BE500256477 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; F293B3CC15EB7BE500256477 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
F293B3CE15EB7BE500256477 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; F293B3CE15EB7BE500256477 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
@ -496,6 +502,9 @@
F293BC4615EB859D00256477 /* Resources */ = { F293BC4615EB859D00256477 /* Resources */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
D446FD9716102D61000ADA7B /* Default@2x.png */,
D446FD9516102D5B000ADA7B /* Default.png */,
D41A0AE4160F1640004552AE /* Default-568h@2x.png */,
158B579715EC9D86009FCBB4 /* Icon-57.png */, 158B579715EC9D86009FCBB4 /* Icon-57.png */,
158B579815EC9D86009FCBB4 /* Icon-72.png */, 158B579815EC9D86009FCBB4 /* Icon-72.png */,
158B579915EC9D86009FCBB4 /* Icon-114.png */, 158B579915EC9D86009FCBB4 /* Icon-114.png */,
@ -710,6 +719,9 @@
158B579C15EC9D86009FCBB4 /* Icon-72.png in Resources */, 158B579C15EC9D86009FCBB4 /* Icon-72.png in Resources */,
158B579D15EC9D86009FCBB4 /* Icon-114.png in Resources */, 158B579D15EC9D86009FCBB4 /* Icon-114.png in Resources */,
158B579E15EC9D86009FCBB4 /* Icon-144.png in Resources */, 158B579E15EC9D86009FCBB4 /* Icon-144.png in Resources */,
D41A0AE5160F1640004552AE /* Default-568h@2x.png in Resources */,
D446FD9616102D5B000ADA7B /* Default.png in Resources */,
D446FD9816102D61000ADA7B /* Default@2x.png in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -9,8 +9,8 @@ LOCAL_MODULE_FILENAME := libscriptingcore-spidermonkey
LOCAL_SRC_FILES := ScriptingCore.cpp \ LOCAL_SRC_FILES := ScriptingCore.cpp \
cocos2d_specifics.cpp \ cocos2d_specifics.cpp \
CCPhysicsSprite.cpp \ CCPhysicsSprite.cpp \
cocos2dx.cpp \
js_manual_conversions.cpp \ js_manual_conversions.cpp \
cocosjs_manual_conversions.cpp \
js_bindings_chipmunk_manual.cpp \ js_bindings_chipmunk_manual.cpp \
js_bindings_chipmunk_functions.cpp \ js_bindings_chipmunk_functions.cpp \
generated/cocos2dx.cpp generated/cocos2dx.cpp

View File

@ -21,7 +21,7 @@
#include "CCPhysicsSprite.h" #include "CCPhysicsSprite.h"
#include "ScriptingCore.h" #include "ScriptingCore.h"
#include "js_manual_conversions.h" #include "cocosjs_manual_conversions.h"
using namespace cocos2d; using namespace cocos2d;

View File

@ -1,3 +1,6 @@
#ifndef __CCPHYSICSSPRITE_H__
#define __CCPHYSICSSPRITE_H__
#include "sprite_nodes/CCSprite.h" #include "sprite_nodes/CCSprite.h"
#include "chipmunk.h" #include "chipmunk.h"
@ -24,3 +27,4 @@ public:
virtual void setRotation(float rotation); virtual void setRotation(float rotation);
}; };
#endif /* __CCPHYSICSSPRITE_H__ */

View File

@ -421,7 +421,7 @@ JSBool ScriptingCore::forceGC(JSContext *cx, uint32_t argc, jsval *vp)
static void dumpNamedRoot(const char *name, void *addr, JSGCRootType type, void *data) static void dumpNamedRoot(const char *name, void *addr, JSGCRootType type, void *data)
{ {
printf("Root: '%s' at %p\n", name, addr); CCLOG("Root: '%s' at %p", name, addr);
} }
JSBool ScriptingCore::dumpRoot(JSContext *cx, uint32_t argc, jsval *vp) JSBool ScriptingCore::dumpRoot(JSContext *cx, uint32_t argc, jsval *vp)

View File

@ -106,7 +106,7 @@ class JSTouchDelegate: public CCTouchDelegate, public CCNode {
void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent) { void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent) {
CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pTouch);
CC_UNUSED_PARAM(pEvent); CC_UNUSED_PARAM(pEvent);
jsval retval; //jsval retval;
ScriptingCore::getInstance()->executeCustomTouchEvent(CCTOUCHMOVED, ScriptingCore::getInstance()->executeCustomTouchEvent(CCTOUCHMOVED,
pTouch, _mObj); pTouch, _mObj);
} }

View File

@ -0,0 +1,160 @@
#include "jsapi.h"
#include "jsfriendapi.h"
#include "ScriptingCore.h"
#include "js_bindings_config.h"
#include "cocosjs_manual_conversions.h"
#define JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES
using namespace cocos2d;
JSBool jsval_to_CCPoint( JSContext *cx, jsval vp, CCPoint *ret )
{
#ifdef JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES
JSObject *jsobj;
if( ! JS_ValueToObject( cx, vp, &jsobj ) )
return JS_FALSE;
JSB_PRECONDITION( jsobj, "Not a valid JS object");
jsval valx, valy;
JSBool ok = JS_TRUE;
ok &= JS_GetProperty(cx, jsobj, "x", &valx);
ok &= JS_GetProperty(cx, jsobj, "y", &valy);
if( ! ok )
return JS_FALSE;
double x, y;
ok &= JS_ValueToNumber(cx, valx, &x);
ok &= JS_ValueToNumber(cx, valy, &y);
if( ! ok )
return JS_FALSE;
ret->x = x;
ret->y = y;
return JS_TRUE;
#else // #! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES
JSObject *tmp_arg;
if( ! JS_ValueToObject( cx, vp, &tmp_arg ) )
return JS_FALSE;
JSB_PRECONDITION( tmp_arg && JS_IsTypedArrayObject( tmp_arg, cx ), "Not a TypedArray object");
JSB_PRECONDITION( JS_GetTypedArrayByteLength( tmp_arg, cx ) == sizeof(cpVect), "Invalid length");
*ret = *(CCPoint*)JS_GetArrayBufferViewData( tmp_arg, cx );
return JS_TRUE;
#endif // #! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES
}
JSBool jsval_to_CGPoint( JSContext *cx, jsval vp, cpVect *ret )
{
#ifdef JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES
JSObject *jsobj;
if( ! JS_ValueToObject( cx, vp, &jsobj ) )
return JS_FALSE;
JSB_PRECONDITION( jsobj, "Not a valid JS object");
jsval valx, valy;
JSBool ok = JS_TRUE;
ok &= JS_GetProperty(cx, jsobj, "x", &valx);
ok &= JS_GetProperty(cx, jsobj, "y", &valy);
if( ! ok )
return JS_FALSE;
double x, y;
ok &= JS_ValueToNumber(cx, valx, &x);
ok &= JS_ValueToNumber(cx, valy, &y);
if( ! ok )
return JS_FALSE;
ret->x = x;
ret->y = y;
return JS_TRUE;
#else // #! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES
JSObject *tmp_arg;
if( ! JS_ValueToObject( cx, vp, &tmp_arg ) )
return JS_FALSE;
JSB_PRECONDITION( tmp_arg && JS_IsTypedArrayObject( tmp_arg, cx ), "Not a TypedArray object");
JSB_PRECONDITION( JS_GetTypedArrayByteLength( tmp_arg, cx ) == sizeof(cpVect), "Invalid length");
*ret = *(cpVect*)JS_GetArrayBufferViewData( tmp_arg, cx );
return JS_TRUE;
#endif // #! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES
}
jsval CGPoint_to_jsval( JSContext *cx, cpVect p)
{
#ifdef JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES
JSObject *object = JS_NewObject(cx, NULL, NULL, NULL );
if (!object)
return JSVAL_VOID;
if (!JS_DefineProperty(cx, object, "x", DOUBLE_TO_JSVAL(p.x), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) ||
!JS_DefineProperty(cx, object, "y", DOUBLE_TO_JSVAL(p.y), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) )
return JSVAL_VOID;
return OBJECT_TO_JSVAL(object);
#else // JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES
#ifdef __LP64__
JSObject *typedArray = JS_NewFloat64Array( cx, 2 );
#else
JSObject *typedArray = JS_NewFloat32Array( cx, 2 );
#endif
cpVect *buffer = (cpVect*)JS_GetArrayBufferViewData(typedArray, cx );
*buffer = p;
return OBJECT_TO_JSVAL(typedArray);
#endif // ! JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES
}
JSBool jsval_to_cpBB( JSContext *cx, jsval vp, cpBB *ret )
{
JSObject *tmp_arg;
if( ! JS_ValueToObject( cx, vp, &tmp_arg ) )
return JS_FALSE;
JSB_PRECONDITION( JS_IsTypedArrayObject( tmp_arg, cx ), "Not a TypedArray object");
JSB_PRECONDITION( JS_GetTypedArrayByteLength( tmp_arg, cx ) == sizeof(cpFloat)*4, "Invalid length");
*ret = *(cpBB*)JS_GetArrayBufferViewData( tmp_arg, cx);
return JS_TRUE;
}
jsval cpBB_to_jsval(JSContext *cx, cpBB bb )
{
#ifdef __LP64__
JSObject *typedArray = JS_NewFloat64Array( cx, 4 );
#else
JSObject *typedArray = JS_NewFloat32Array( cx, 4 );
#endif
cpBB *buffer = (cpBB*)JS_GetArrayBufferViewData(typedArray, cx);
*buffer = bb;
return OBJECT_TO_JSVAL(typedArray);
}

View File

@ -0,0 +1,25 @@
#ifndef __COCOSJS_MANUAL_CONVERSIONS_H__
#define __COCOSJS_MANUAL_CONVERSIONS_H__
#include "chipmunk.h"
#include "cocos2d.h"
#include "js_manual_conversions.h"
//#ifdef __cplusplus
//extern "C" {
//#endif
JSBool jsval_to_CGPoint( JSContext *cx, jsval vp, cpVect *out );
jsval CGPoint_to_jsval( JSContext *cx, cpVect p );
JSBool jsval_to_cpBB( JSContext *cx, jsval vp, cpBB *ret );
jsval cpBB_to_jsval(JSContext *cx, cpBB bb );
//#ifdef __cplusplus
//}
//#endif
#define cpVect_to_jsval CGPoint_to_jsval
#define jsval_to_cpVect jsval_to_CGPoint
#endif /* __COCOSJS_MANUAL_CONVERSIONS_H__ */

@ -0,0 +1 @@
Subproject commit 2d18305596b4da4b260bb2fd6d5ed8e878d0b129

View File

@ -8,7 +8,6 @@
#include "js_bindings_ccbreader.h" #include "js_bindings_ccbreader.h"
#include "ScriptingCore.h" #include "ScriptingCore.h"
#include "CCNodeLoaderLibrary.h"
USING_NS_CC; USING_NS_CC;
USING_NS_CC_EXT; USING_NS_CC_EXT;
@ -91,7 +90,7 @@ static CCNode* loadReader(const char *file, jsval owner) {
ccBCallbackProxy->setJSOwner(owner); ccBCallbackProxy->setJSOwner(owner);
//ccbReader->setOwner(dynamic_cast<CCObject *>(ccBCallbackProxy)); //ccbReader->setOwner(dynamic_cast<CCObject *>(ccBCallbackProxy));
CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast<CCBSelectorResolver *>(ccBCallbackProxy); //CCBSelectorResolver * targetAsCCBSelectorResolver = dynamic_cast<CCBSelectorResolver *>(ccBCallbackProxy);
CCNode * node = ccbReader->readNodeGraphFromFile(file, dynamic_cast<CCObject *>(ccBCallbackProxy)); CCNode * node = ccbReader->readNodeGraphFromFile(file, dynamic_cast<CCObject *>(ccBCallbackProxy));

Some files were not shown because too many files have changed in this diff Show More