fixed #30: change some header files to include

This commit is contained in:
Ming 2010-08-04 08:45:00 +00:00
parent 7f20bced08
commit 76f62adf62
43 changed files with 88 additions and 1136 deletions

View File

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

View File

@ -24,7 +24,7 @@ THE SOFTWARE.
#include "CCDirector.h" #include "CCDirector.h"
#include "CCScene.h" #include "CCScene.h"
#include "cocoa/NSMutableArray.h" #include "NSMutableArray.h"
#include "CCScheduler.h" #include "CCScheduler.h"
#include "ccMacros.h" #include "ccMacros.h"
#include "Cocos2dDefine.h" #include "Cocos2dDefine.h"
@ -35,7 +35,7 @@ THE SOFTWARE.
#include "CCTextureCache.h" #include "CCTextureCache.h"
#include "CCTransition.h" #include "CCTransition.h"
#include "CCSpriteFrameCache.h" #include "CCSpriteFrameCache.h"
#include "cocoa/NSAutoreleasePool.h" #include "NSAutoreleasePool.h"
#include "platform/platform.h" #include "platform/platform.h"
#include <string> #include <string>

View File

@ -28,10 +28,10 @@ THE SOFTWARE.
#include "ccConfig.h" #include "ccConfig.h"
#include "ccTypes.h" #include "ccTypes.h"
#include "Cocos2dDefine.h" #include "Cocos2dDefine.h"
#include "cocoa/NSObject.h" #include "NSObject.h"
#include "cocoa/CGGeometry.h" #include "CGGeometry.h"
#include "cocoa/NSMutableArray.h" #include "NSMutableArray.h"
#include "cocoa/CGGeometry.h" #include "CGGeometry.h"
#include "CCXEGLView.h" #include "CCXEGLView.h"
#include "ccxCommon.h" #include "ccxCommon.h"

View File

@ -40,7 +40,7 @@ THE SOFTWARE.
@warning These functions draws the Line, Point, Polygon, immediately. They aren't batched. If you are going to make a game that depends on these primitives, I suggest creating a batch. @warning These functions draws the Line, Point, Polygon, immediately. They aren't batched. If you are going to make a game that depends on these primitives, I suggest creating a batch.
*/ */
#include "Cocoa/CGGeometry.h" // for CGPoint #include "CGGeometry.h" // for CGPoint
namespace cocos2d { namespace cocos2d {
/** draws a point given x and y coordinate */ /** draws a point given x and y coordinate */

View File

@ -25,7 +25,7 @@ THE SOFTWARE.
#include "CCScheduler.h" #include "CCScheduler.h"
#include "ccMacros.h" #include "ccMacros.h"
#include "support/data_support/utlist.h" #include "support/data_support/utlist.h"
#include "cocoa/NSMutableArray.h" #include "NSMutableArray.h"
#include <assert.h> #include <assert.h>
namespace cocos2d { namespace cocos2d {

View File

@ -25,8 +25,8 @@ THE SOFTWARE.
#ifndef __CCSCHEDULER_H__ #ifndef __CCSCHEDULER_H__
#define __CCSCHEDULER_H__ #define __CCSCHEDULER_H__
#include "cocoa/NSObject.h" #include "NSObject.h"
#include "cocoa/selector_protocol.h" #include "selector_protocol.h"
#include "support/data_support/uthash.h" #include "support/data_support/uthash.h"
namespace cocos2d { namespace cocos2d {

View File

@ -1,59 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __COCOA_CGAFFINETRANSFORM_H__
#define __COCOA_CGAFFINETRANSFORM_H__
#include "CGGeometry.h"
namespace cocos2d {
struct CGAffineTransform {
CGFloat a, b, c, d;
CGFloat tx, ty;
};
inline CGAffineTransform __CGAffineTransformMake(CGFloat a, CGFloat b, CGFloat c, CGFloat d, CGFloat tx, CGFloat ty);
#define CGAffineTransformMake __CGAffineTransformMake
inline CGPoint __CGPointApplyAffineTransform(CGPoint point, CGAffineTransform t);
#define CGPointApplyAffineTransform __CGPointApplyAffineTransform
inline CGSize __CGSizeApplyAffineTransform(CGSize size, CGAffineTransform t);
#define CGSizeApplyAffineTransform __CGSizeApplyAffineTransform
CGAffineTransform CGAffineTransformMakeIdentity();
CGRect CGRectApplyAffineTransform(CGRect rect, CGAffineTransform anAffineTransform);
CGAffineTransform CGAffineTransformTranslate(CGAffineTransform t, float tx, float ty);
CGAffineTransform CGAffineTransformRotate(CGAffineTransform aTransform, CGFloat anAngle);
CGAffineTransform CGAffineTransformScale(CGAffineTransform t, CGFloat sx, CGFloat sy);
CGAffineTransform CGAffineTransformConcat(CGAffineTransform t1,CGAffineTransform t2);
bool CGAffineTransformEqualToTransform(CGAffineTransform t1,CGAffineTransform t2);
CGAffineTransform CGAffineTransformInvert(CGAffineTransform t);
extern const CGAffineTransform CGAffineTransformIdentity;
}//namespace cocos2d
#endif // __COCOA_CGAFFINETRANSFORM_H__

View File

@ -1,111 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __COCOS_CGGEMETRY_H__
#define __COCOS_CGGEMETRY_H__
#include "ccxCommon.h"
namespace cocos2d {
typedef float CGFloat;
class CCX_DLL CGPoint
{
public:
float x;
float y;
public:
CGPoint();
CGPoint(float x, float y);
public:
static bool CGPointEqualToPoint(CGPoint point1, CGPoint point2);
};
class CCX_DLL CGSize
{
public:
float width;
float height;
public:
CGSize();
CGSize(float width, float height);
public:
static bool CGSizeEqualToSize(CGSize size1, CGSize size2);
};
class CCX_DLL CGRect
{
public:
CGPoint origin;
CGSize size;
public:
CGRect();
CGRect(float x, float y, float width, float height);
public:
// return the leftmost x-value of 'rect'
static CGFloat CGRectGetMinX(CGRect rect);
// return the rightmost x-value of 'rect'
static CGFloat CGRectGetMaxX(CGRect rect);
// return the midpoint x-value of 'rect'
static CGFloat CGRectGetMidX(CGRect rect);
// Return the bottommost y-value of `rect'
static CGFloat CGRectGetMinY(CGRect rect);
// Return the topmost y-value of `rect'
static CGFloat CGRectGetMaxY(CGRect rect);
// Return the midpoint y-value of `rect'
static CGFloat CGRectGetMidY(CGRect rect);
static bool CGRectEqualToRect(CGRect rect1, CGRect rect2);
static bool CGRectContainsPoint(CGRect rect, CGPoint point);
};
#define CGPointMake(x, y) CGPoint((x), (y))
#define CGSizeMake(width, height) CGSize((width), (height))
#define CGRectMake(x, y, width, height) CGRect((x), (y), (width), (height))
const CGPoint CGPointZero = CGPointMake(0,0);
/* The "zero" size -- equivalent to CGSizeMake(0, 0). */
const CGSize CGSizeZero = CGSizeMake(0,0);
/* The "zero" rectangle -- equivalent to CGRectMake(0, 0, 0, 0). */
const CGRect CGRectZero = CGRectMake(0,0,0,0);
}//namespace cocos2d
#endif // __COCOS_CGGEMETRY_H__

View File

@ -1,76 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __NS_AUTO_RELEASE_POOL_H__
#define __NS_AUTO_RELEASE_POOL_H__
#include "NSObject.h"
#include "NSMutablearray.h"
#include <stack>
namespace cocos2d {
class NSAutoreleasePool
{
public:
NSAutoreleasePool(void);
~NSAutoreleasePool(void);
void addObject(NSObject *pObject);
void removeObject(NSObject *pObject);
void clear(void);
private:
NSMutableArray<NSObject*> *m_pManagedObjectArray;
};
class NSPoolManager
{
public:
~NSPoolManager();
void finalize(void);
void push(void);
void pop(void);
void removeObject(NSObject *pObject);
void addObject(NSObject *pObject);
public:
static NSPoolManager* getInstance();
private:
NSPoolManager();
NSAutoreleasePool* getCurReleasePool();
private:
static NSPoolManager *m_pPoolManager;
private:
std::stack<NSAutoreleasePool *> *m_pReleasePoolStack;
NSAutoreleasePool *m_pCurReleasePool;
};
}//namespace cocos2d
#endif //__NS_AUTO_RELEASE_POOL_H__

View File

@ -1,50 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __NSDATA_H__
#define __NSDATA_H__
#include "NSObject.h"
#include <string>
#include "platform/platform.h"
namespace cocos2d {
class NSData : public NSObject
{
public:
NSData(void);
~NSData(void);
void* bytes(void);
public:
static NSData* dataWithBytes(UINT8 *pBytes, int size);
static NSData* dataWithContentsOfFile(const std::string &strPath);
private:
char *m_pData;
};
}//namespace cocos2d
#endif //__NSDATA_H__

View File

@ -1,315 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __COCOA_NS_MUTATLE_ARRAY_H__
#define __COCOA_NS_MUTATLE_ARRAY_H__
#include "cocoa/NSObject.h"
#include <vector>
#include <assert.h>
namespace cocos2d {
// the element should be pointer of NSObject or it's sub class
template<class T = NSObject*>
class NSMutableArray : public NSObject
{
public:
typedef std::vector<T> NSObjectArray;
typedef typename NSObjectArray::iterator NSMutableArrayIterator;
typedef typename NSObjectArray::reverse_iterator NSMutableArrayRevIterator;
public:
NSMutableArray(unsigned int uSize = 0)
{
m_array.resize(uSize);
}
~NSMutableArray(void)
{
removeAllObjects();
}
unsigned int count(void)
{
return m_array.size();
}
unsigned int getIndexOfObject(T pObject)
{
if (m_array.empty() || (pObject == NULL))
{
return 0;
}
NSMutableArray<T>::NSMutableArrayIterator iter;
unsigned int uRet = 0;
int i;
for (iter = m_array.begin(), i = 0; iter != m_array.end(); ++iter, ++i)
{
if (*iter == pObject)
{
uRet = i;
break;
}
}
return uRet;
}
bool containsObject(T pObject)
{
if (m_array.empty() || (! pObject))
{
return false;
}
bool bRet = false;
NSMutableArray<T>::NSMutableArrayIterator iter;
for (iter = m_array.begin(); iter != m_array.end(); ++iter)
{
if (*iter == pObject)
{
bRet = true;
break;
}
}
return bRet;
}
T getLastObject(void)
{
T pObject = NULL;
int count = this->count();
if (count > 0)
{
pObject = m_array[count - 1];
}
return pObject;
}
T getObjectAtIndex(unsigned int uIndex)
{
assert(uIndex < count());
if (uIndex >= count())
{
return NULL;
}
return m_array[uIndex];
}
// Adding objects
void addObject(T pObject)
{
// make sure the pointer is not null
if (pObject == NULL)
{
return;
}
// add the refrence
pObject->retain();
// the array is full, push back
m_array.push_back(pObject);
}
void addObjectsFromArray(NSMutableArray<T> *pArray)
{
if (pArray && pArray->count() > 0)
{
NSMutableArray<T>::NSMutableArrayIterator iter;
for (iter = pArray->begin(); iter != pArray->end(); ++iter)
{
if (*iter)
{
m_array.push_back(*iter);
}
}
}
}
void insertObjectAtIndex(T pObject, unsigned int uIndex)
{
// make sure the object is not null
if (pObject == NULL)
{
return;
}
// add the refrence of the object
pObject->retain();
// insert the object
m_array.insert(m_array.begin() + uIndex, pObject);
}
// Removing objects
void removeLastObject(void)
{
int count = this->count();
if (count > 0)
{
removeObjectAtIndex(count - 1);
}
}
void removeObject(T pObject)
{
if (m_array.empty() || (! pObject))
{
return;
}
NSMutableArray<T>::NSMutableArrayIterator iter;
int i;
for (iter = m_array.begin(), i = 0; iter != m_array.end(); ++iter, ++i)
{
if (*iter == pObject)
{
m_array.erase(iter);
pObject->release();
break;
}
}
}
void removeObjectAtIndex(unsigned int uIndex)
{
if (m_array.empty() || uIndex == 0)
{
return;
}
T pObject = m_array.at(uIndex);
if (pObject)
{
pObject->release();
}
m_array.erase(m_array.begin() + uIndex);
}
void removeAllObjects(void)
{
NSMutableArray<T>::NSMutableArrayIterator iter;
for (iter = m_array.begin(); iter != m_array.end(); ++iter)
{
if (*iter)
{
(*iter)->release();
}
}
m_array.clear();
}
void replaceObjectAtIndex(unsigned int uIndex, T pObject)
{
if (uIndex >= count())
{
// index out of range
assert(0);
return;
}
// release the object
T pTmp = m_array[uIndex];
if (pTmp)
{
pTmp->release();
}
m_array[uIndex] = pObject;
// add the ref
if (pObject)
{
pObject->retain();
}
}
NSMutableArrayIterator begin(void)
{
return m_array.begin();
}
NSMutableArrayIterator end(void)
{
return m_array.end();
}
public:
static NSMutableArray<T>* arrayWithObjects(T pObject1, ...)
{
NSMutableArray<T> *pArray = new NSMutableArray<T>();
va_list params;
va_start(params, pObject1);
T pFirst = pObject1;
while (pFirst)
{
pArray->addObject(pFirst);
pFirst = va_arg(params, T);
}
va_end(params);
return pArray;
}
static NSMutableArray<T>* arrayWithArray(NSMutableArray<T> *pArray)
{
if (pArray == NULL)
{
return NULL;
}
NSMutableArray<T> *pNewArray = new NSMutableArray<T>();
NSMutableArray<T>::NSMutableArrayIterator iter;
for (iter = pArray->begin(); iter != pArray->end(); ++iter)
{
pNewArray->addObject(*iter);
}
return pNewArray;
}
private:
std::vector<T> m_array;
};
#define NSArray NSMutableArray
}//namespace cocos2d
#endif // __COCOA_NS_MUTATLE_ARRAY_H__

View File

@ -1,206 +0,0 @@
/* cocos2d for windows
*
* http://cocos2d-win.blogspot.com
*
* Copyright (C) 2010 KOO C.H
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the 'cocos2d for windows' license.
*
* You will find a copy of this license within the cocos2d for windows
* distribution inside the "LICENSE" file.
*
*/
#ifndef __CCMUTABLE_DICTIONARY_H__
#define __CCMUTABLE_DICTIONARY_H__
#include <map>
#include <vector>
#include "NSObject.h"
#include "NSMutableArray.h"
using namespace std;
namespace cocos2d {
template<class _T, class _ValueT = NSObject*>
class NSMutableDictionary : public NSObject
{
public:
typedef std::map<_T, _ValueT> NSObjectMap;
typedef typename NSObjectMap::iterator NSObjectMapIter;
protected:
typedef pair<_T, _ValueT> Int_Pair;
NSObjectMap m_Map;
bool m_bBegin;
NSObjectMapIter m_MapIter;
public:
NSMutableDictionary(void)
{
m_bBegin = false;
}
~NSMutableDictionary(void)
{
removeAllObjects();
}
/// return the number of items
unsigned int count()
{
return m_Map.size();
}
/// return all the keys
std::vector<std::string> allKeys()
{
std::vector<std::string> tRet;
NSObjectMapIter it;
for( it = m_Map.begin(); it != m_Map.end(); ++it)
{
tRet.push_back(it->first);
}
return tRet;
}
/** @warning : We use '==' to compare two objects*/
std::vector<std::string> allKeysForObject(_ValueT object)
{
std::vector<std::string> tRet;
NSObjectMapIter it;
for( it= m_Map.begin(); it != m_Map.end(); ++it)
{
if (it->second == object)
{
tRet.push_back(it->first);
}
}
return tRet;
}
_ValueT objectForKey(_T key) ///<
{
NSObjectMapIter it;
it = m_Map.find(key);
if(it == m_Map.end()) //no match case
return NULL;
return it->second;
}
bool setObject(_ValueT pObject, _T key)
{
pair<NSObjectMapIter, bool > pr;
pr = m_Map.insert( Int_Pair(key, pObject) );
if(pr.second == true)
{
pObject->retain();
return true;
}
return false;
}
void removeObjectForKey(_T key)
{
NSObjectMapIter it;
it = m_Map.find(key);
if(it == m_Map.end()) //no match case
return;
if(it->second )
{
it->second->release() ;
m_Map.erase(it);
}
}
bool begin()
{
if(m_Map.size() == 0)
return false;
m_MapIter = m_Map.begin();
m_bBegin = true;
return true;
}
_ValueT next(_T* key = NULL)
{
if(!m_bBegin)
return NULL;
_ValueT pObject = m_MapIter->second;
if(m_MapIter == m_Map.end())
{
m_bBegin = false;
}
else
{
if(key)
{
*key = m_MapIter->first;
}
m_MapIter++;
if(m_MapIter == m_Map.end())
{
m_bBegin = false;
}
}
return pObject;
}
void end()
{
m_bBegin = false;
}
void removeAllObjects()
{
NSObjectMapIter it;
for( it= m_Map.begin(); it != m_Map.end(); ++it)
{
it->second->release();
}
m_Map.clear();
}
static NSMutableDictionary<_T, _ValueT>* dictionaryWithDictionary(NSMutableDictionary<_T, _ValueT>* srcDict)
{
NSMutableDictionary<_T, _ValueT>* pNewDict = new NSMutableDictionary<_T, _ValueT>();
srcDict->begin();
_T key;
_ValueT value;
while( (value = srcDict->next(&key)) )
{
pNewDict->setObject(value, key);
}
srcDict->end();
return pNewDict;
}
};
#define NSDictionary NSMutableDictionary
}//namespace cocos2d
#endif //__CCMUTABLE_DICTIONARY_H__

View File

@ -1,67 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __COCOA_NSOBJECT_H__
#define __COCOA_NSOBJECT_H__
#include "ccxCommon.h"
namespace cocos2d {
class NSZone;
class NSObject;
class NSString;
class CCX_DLL CCCopying
{
public:
virtual NSObject* copyWithZone(NSZone* pZone);
};
class CCX_DLL NSObject : public CCCopying
{
protected:
// object id
unsigned int m_uID;
// count of refrence
unsigned int m_uRefrence;
// is the object autoreleased
bool m_bManaged;
public:
NSObject(void);
~NSObject(void);
virtual void release(void);
virtual void retain(void);
NSObject* autorelease(void);
NSObject* copy(void);
bool isSingleRefrence(void);
unsigned int retainCount(void);
bool isEqual(const NSObject* pObject);
friend class NSAutoreleasePool;
};
}//namespace cocos2d
#endif // __COCOA_NSOBJECT_H__

View File

@ -1,59 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __NS_SET_H__
#define __NS_SET_H__
#include <set>
#include "NSObject.h"
namespace cocos2d {
typedef std::set<NSObject *>::iterator NSSetIterator;
class NSSet : public NSObject
{
public:
NSSet(void);
NSSet(const NSSet &rSetObject);
virtual ~NSSet(void);
NSSet* copy();
NSSet* mutableCopy();
int count();
void addObject(NSObject *pObject);
void removeObject(NSObject *pObject);
bool containsObject(NSObject *pObject);
NSSetIterator begin();
NSSetIterator end();
private:
std::set<NSObject *> m_set;
};
typedef NSSet NSMutableSet;
}//namespace cocos2d
#endif // __NS_SET_H__

View File

@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "NSZone.h" #include "NSZone.h"
#include "cocoa/NSObject.h" #include "NSObject.h"
namespace cocos2d { namespace cocos2d {
NSZone::NSZone(NSObject *pObject) NSZone::NSZone(NSObject *pObject)

View File

@ -1,44 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __NS_ZONE_H__
#define __NS_ZONE_H__
#include "platform/platform.h"
namespace cocos2d {
class NSObject;
class NSZone
{
public:
NSZone(NSObject *pObject = NULL);
public:
NSObject *m_pCopyObject;
};
}//namespace cocos2d
#endif // __NS_ZONE_H__

View File

@ -1,61 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __COCOA_SELECTOR_PROTOCOL_H__
#define __COCOA_SELECTOR_PROTOCOL_H__
#include "ccTypes.h"
#include "NSObject.h"
#include "ccxCommon.h"
namespace cocos2d {
class CCNode;
class CCX_DLL SelectorProtocol
{
public:
virtual void update(ccTime dt) {};
virtual void tick(ccTime dt){};
virtual void callfunc(){};
virtual void callfunc(CCNode* pSender){};
virtual void callfunc(CCNode* pSender, void* pData){};
virtual void menuHandler(NSObject* pSender){};
};
class CCNode;
typedef void (SelectorProtocol::*SEL_SCHEDULE)(ccTime);
typedef void (SelectorProtocol::*SEL_CallFunc)();
typedef void (SelectorProtocol::*SEL_CallFuncN)(CCNode*);
typedef void (SelectorProtocol::*SEL_CallFuncND)(CCNode*, void*);
typedef void (SelectorProtocol::*SEL_MunuHandler)(NSObject*);
#define schedule_selector(_SELECTOR) (SEL_SCHEDULE)(*((SEL_SCHEDULE*)(&(&_SELECTOR))) )
#define callfunc_selector(_SELECTOR) (SEL_CallFunc)(*((SEL_CallFunc*)(&(&_SELECTOR))) )
#define callfuncN_selector(_SELECTOR) (SEL_CallFuncN)(*((SEL_CallFuncN*)(&(&_SELECTOR))) )
#define callfuncND_selector(_SELECTOR) (SEL_CallFuncND)(*((SEL_CallFuncND*)(&(&_SELECTOR))) )
#define menu_selector(_SELECTOR) (SEL_MunuHandler)(*((SEL_MunuHandler*)(&(&_SELECTOR))) )
}//namespace cocos2d
#endif // __COCOA_SELECTOR_PROTOCOL_H__

View File

@ -304,6 +304,14 @@
RelativePath=".\include\CCXEGLView.h" RelativePath=".\include\CCXEGLView.h"
> >
</File> </File>
<File
RelativePath=".\include\CGAffineTransform.h"
>
</File>
<File
RelativePath=".\include\CGGeometry.h"
>
</File>
<File <File
RelativePath=".\include\cocos2d.h" RelativePath=".\include\cocos2d.h"
> >
@ -312,6 +320,38 @@
RelativePath=".\include\Cocos2dDefine.h" RelativePath=".\include\Cocos2dDefine.h"
> >
</File> </File>
<File
RelativePath=".\include\NSAutoreleasePool.h"
>
</File>
<File
RelativePath=".\include\NSData.h"
>
</File>
<File
RelativePath=".\include\NSMutableArray.h"
>
</File>
<File
RelativePath=".\include\NSMutableDictionary.h"
>
</File>
<File
RelativePath=".\include\NSObject.h"
>
</File>
<File
RelativePath=".\include\NSSet.h"
>
</File>
<File
RelativePath=".\include\NSZone.h"
>
</File>
<File
RelativePath=".\include\selector_protocol.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="Makefiles" Name="Makefiles"
@ -513,70 +553,30 @@
RelativePath=".\cocoa\CGAffineTransform.cpp" RelativePath=".\cocoa\CGAffineTransform.cpp"
> >
</File> </File>
<File
RelativePath=".\cocoa\CGAffineTransform.h"
>
</File>
<File <File
RelativePath=".\cocoa\CGGeometry.cpp" RelativePath=".\cocoa\CGGeometry.cpp"
> >
</File> </File>
<File
RelativePath=".\cocoa\CGGeometry.h"
>
</File>
<File <File
RelativePath=".\cocoa\NSAutoreleasePool.cpp" RelativePath=".\cocoa\NSAutoreleasePool.cpp"
> >
</File> </File>
<File
RelativePath=".\cocoa\NSAutoreleasePool.h"
>
</File>
<File <File
RelativePath=".\cocoa\NSData.cpp" RelativePath=".\cocoa\NSData.cpp"
> >
</File> </File>
<File
RelativePath=".\cocoa\NSData.h"
>
</File>
<File
RelativePath=".\cocoa\NSMutableArray.h"
>
</File>
<File
RelativePath=".\cocoa\NSMutableDictionary.h"
>
</File>
<File <File
RelativePath=".\cocoa\NSObject.cpp" RelativePath=".\cocoa\NSObject.cpp"
> >
</File> </File>
<File
RelativePath=".\cocoa\NSObject.h"
>
</File>
<File <File
RelativePath=".\cocoa\NSSet.cpp" RelativePath=".\cocoa\NSSet.cpp"
> >
</File> </File>
<File
RelativePath=".\cocoa\NSSet.h"
>
</File>
<File <File
RelativePath=".\cocoa\NSZone.cpp" RelativePath=".\cocoa\NSZone.cpp"
> >
</File> </File>
<File
RelativePath=".\cocoa\NSZone.h"
>
</File>
<File
RelativePath=".\cocoa\selector_protocol.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="platform" Name="platform"

View File

@ -27,7 +27,7 @@ THE SOFTWARE.
#include "ccTypes.h" #include "ccTypes.h"
#include "CCCamera.h" #include "CCCamera.h"
#include "cocoa/NSObject.h" #include "NSObject.h"
namespace cocos2d { namespace cocos2d {
class CCTexture2D; class CCTexture2D;

View File

@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __CCCAMERA_H__ #ifndef __CCCAMERA_H__
#define __CCCAMERA_H__ #define __CCCAMERA_H__
#include "cocoa/NSObject.h" #include "NSObject.h"
#include "ccMacros.h" #include "ccMacros.h"
#include <string> #include <string>
namespace cocos2d { namespace cocos2d {

View File

@ -28,8 +28,8 @@ THE SOFTWARE.
#include "Cocos2dDefine.h" #include "Cocos2dDefine.h"
#include "ccMacros.h" #include "ccMacros.h"
#include "CCScheduler.h" #include "CCScheduler.h"
#include "cocoa/CGAffineTransform.h" #include "CGAffineTransform.h"
#include "cocoa/NSMutableArray.h" #include "NSMutableArray.h"
#include "ccConfig.h" #include "ccConfig.h"
#include "ccxCommon.h" #include "ccxCommon.h"

View File

@ -31,8 +31,8 @@ THE SOFTWARE.
#include <GLES/gl.h> #include <GLES/gl.h>
#include <GLES/glext.h> #include <GLES/glext.h>
#include "Cocos2dDefine.h" #include "Cocos2dDefine.h"
#include "cocoa/NSObject.h" #include "NSObject.h"
#include "cocoa/NSMutableArray.h" #include "NSMutableArray.h"
#include "support/data_support/uthash.h" #include "support/data_support/uthash.h"
namespace cocos2d { namespace cocos2d {

View File

@ -29,7 +29,7 @@ THE SOFTWARE.
#include "CCProtocols.h" #include "CCProtocols.h"
#include "CCTextureAtlas.h" #include "CCTextureAtlas.h"
#include "ccTypes.h" #include "ccTypes.h"
#include "cocoa/NSMutableDictionary.h" #include "NSMutableDictionary.h"
#include "ccxCommon.h" #include "ccxCommon.h"
#include <string> #include <string>

View File

@ -27,8 +27,8 @@ THE SOFTWARE.
#include "CCNode.h" #include "CCNode.h"
#include "CCProtocols.h" #include "CCProtocols.h"
#include "cocoa/NSMutableArray.h" #include "NSMutableArray.h"
#include "cocoa/NSObject.h" #include "NSObject.h"
#include <string.h> #include <string.h>

View File

@ -32,8 +32,8 @@ THE SOFTWARE.
#include "CCSpriteFrame.h" #include "CCSpriteFrame.h"
#include "CCTexture2D.h" #include "CCTexture2D.h"
#include "cocoa/NSObject.h" #include "NSObject.h"
#include "cocoa/NSMutableDictionary.h" #include "NSMutableDictionary.h"
#include <string> #include <string>
#include <map> #include <map>

View File

@ -29,7 +29,7 @@ THE SOFTWARE.
#include "CCProtocols.h" #include "CCProtocols.h"
#include "CCTextureAtlas.h" #include "CCTextureAtlas.h"
#include "ccMacros.h" #include "ccMacros.h"
#include "cocoa/NSMutableArray.h" #include "NSMutableArray.h"
namespace cocos2d { namespace cocos2d {

View File

@ -29,8 +29,8 @@ THE SOFTWARE.
#include <GLES/gl.h> #include <GLES/gl.h>
#include "Cocos2dDefine.h" #include "Cocos2dDefine.h"
#include "cocoa/NSObject.h" #include "NSObject.h"
#include "cocoa/CGGeometry.h" #include "CGGeometry.h"
namespace cocos2d { namespace cocos2d {
class UIImage; class UIImage;

View File

@ -27,7 +27,7 @@ THE SOFTWARE.
#include <string> #include <string>
#include "ccTypes.h" #include "ccTypes.h"
#include "cocoa/NSObject.h" #include "NSObject.h"
#include "ccConfig.h" #include "ccConfig.h"
namespace cocos2d { namespace cocos2d {

View File

@ -26,10 +26,10 @@ THE SOFTWARE.
#define __CCTEXTURE_CACHE_H__ #define __CCTEXTURE_CACHE_H__
#include <string> #include <string>
#include "cocoa/NSObject.h" #include "NSObject.h"
/// @todo #import <Foundation/Foundation.h> /// @todo #import <Foundation/Foundation.h>
/// @todo #import <CoreGraphics/CGImage.h> /// @todo #import <CoreGraphics/CGImage.h>
#include "cocoa/NSMutableDictionary.h" #include "NSMutableDictionary.h"
namespace cocos2d { namespace cocos2d {
class CCTexture2D; class CCTexture2D;

View File

@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __CCTYPES_H__ #ifndef __CCTYPES_H__
#define __CCTYPES_H__ #define __CCTYPES_H__
#include "cocoa/CGGeometry.h" #include "CGGeometry.h"
#include <GLES/gl.h> #include <GLES/gl.h>
namespace cocos2d { namespace cocos2d {

View File

@ -31,7 +31,7 @@ THE SOFTWARE.
#include "gles/gl.h" #include "gles/gl.h"
#include "Cocos2dDefine.h" #include "Cocos2dDefine.h"
#include "cocoa/NSSet.h" #include "NSSet.h"
#include "touch_dispatcher/CCTouch.h" #include "touch_dispatcher/CCTouch.h"
#include "touch_dispatcher/CCTouchDispatcher.h" #include "touch_dispatcher/CCTouchDispatcher.h"

View File

@ -28,7 +28,7 @@ THE SOFTWARE.
#include "GuiBase.h" #include "GuiBase.h"
#include "TWindow.h" #include "TWindow.h"
#include "cocoa/CGGeometry.h" #include "CGGeometry.h"
class TApplication; class TApplication;

View File

@ -30,9 +30,9 @@ THE SOFTWARE.
#include "CCTextureCache.h" #include "CCTextureCache.h"
#include "support/CGPointExtension.h" #include "support/CGPointExtension.h"
#include "CCDrawingPrimitives.h" #include "CCDrawingPrimitives.h"
#include "cocoa/CGGeometry.h" #include "CGGeometry.h"
#include "CCTexture2D.h" #include "CCTexture2D.h"
#include "cocoa/CGAffineTransform.h" #include "CGAffineTransform.h"
#include "sstsd.h" #include "sstsd.h"
#include <string.h> #include <string.h>

View File

@ -26,7 +26,7 @@ THE SOFTWARE.
#include "CCSpriteFrame.h" #include "CCSpriteFrame.h"
#include "ccMacros.h" #include "ccMacros.h"
#include "CCTexture2D.h" #include "CCTexture2D.h"
#include "cocoa/CGGeometry.h" #include "CGGeometry.h"
namespace cocos2d { namespace cocos2d {
// implementation of CCAnimation // implementation of CCAnimation

View File

@ -41,7 +41,7 @@ THE SOFTWARE.
- cpvadd( CGPointMake(1,1), CGPointMake(2,2) ); // mixing chipmunk and CG (avoid) - cpvadd( CGPointMake(1,1), CGPointMake(2,2) ); // mixing chipmunk and CG (avoid)
*/ */
#include "cocoa/CGGeometry.h" #include "CGGeometry.h"
#include <math.h> #include <math.h>
namespace cocos2d { namespace cocos2d {

View File

@ -23,7 +23,7 @@ THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "TransformUtils.h" #include "TransformUtils.h"
#include "cocoa/CGAffineTransform.h" #include "CGAffineTransform.h"
namespace cocos2d { namespace cocos2d {
void CGAffineToGL(const CGAffineTransform *t, GLfloat *m) void CGAffineToGL(const CGAffineTransform *t, GLfloat *m)

View File

@ -24,7 +24,7 @@ THE SOFTWARE.
#include "CCPVRTexture.h" #include "CCPVRTexture.h"
#include "ccMacros.h" #include "ccMacros.h"
#include "cocoa/NSData.h" #include "NSData.h"
namespace cocos2d { namespace cocos2d {

View File

@ -28,7 +28,7 @@ THE SOFTWARE.
#include "CCTextureCache.h" #include "CCTextureCache.h"
#include "CCTexture2D.h" #include "CCTexture2D.h"
#include "ccMacros.h" #include "ccMacros.h"
#include "cocoa/NSData.h" #include "NSData.h"
#include "CCDirector.h" #include "CCDirector.h"
/// @todo EAGLContext static EAGLContext *auxEAGLcontext = NULL; /// @todo EAGLContext static EAGLContext *auxEAGLcontext = NULL;

View File

@ -25,8 +25,8 @@ THE SOFTWARE.
#ifndef __CC_TOUCH_H__ #ifndef __CC_TOUCH_H__
#define __CC_TOUCH_H__ #define __CC_TOUCH_H__
#include "cocoa/NSObject.h" #include "NSObject.h"
#include "cocoa/CGGeometry.h" #include "CGGeometry.h"
namespace cocos2d { namespace cocos2d {

View File

@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __TOUCH_DISPATHCHER_CCTOUCH_DELEGATE_PROTOCOL_H__ #ifndef __TOUCH_DISPATHCHER_CCTOUCH_DELEGATE_PROTOCOL_H__
#define __TOUCH_DISPATHCHER_CCTOUCH_DELEGATE_PROTOCOL_H__ #define __TOUCH_DISPATHCHER_CCTOUCH_DELEGATE_PROTOCOL_H__
#include "cocoa/NSObject.h" #include "NSObject.h"
#include "ccxCommon.h" #include "ccxCommon.h"
namespace cocos2d { namespace cocos2d {

View File

@ -24,8 +24,8 @@ THE SOFTWARE.
#include "CCTouchDispatcher.h" #include "CCTouchDispatcher.h"
#include "CCTouchHandler.h" #include "CCTouchHandler.h"
#include "../cocoa/NSMutableArray.h" #include "NSMutableArray.h"
#include "../cocoa/NSSet.h" #include "NSSet.h"
#include "CCTouch.h" #include "CCTouch.h"
#include "CCTexture2D.h" #include "CCTexture2D.h"

View File

@ -26,8 +26,8 @@ THE SOFTWARE.
#define __TOUCH_DISPATCHER_CCTOUCH_DISPATCHER_H__ #define __TOUCH_DISPATCHER_CCTOUCH_DISPATCHER_H__
#include "CCTouchDelegateProtocol.h" #include "CCTouchDelegateProtocol.h"
#include "cocoa/NSObject.h" #include "NSObject.h"
#include "cocoa/NSMutableArray.h" #include "NSMutableArray.h"
namespace cocos2d { namespace cocos2d {
typedef enum typedef enum

View File

@ -27,8 +27,8 @@ THE SOFTWARE.
#include "CCTouchDelegateProtocol.h" #include "CCTouchDelegateProtocol.h"
#include "CCTouchDispatcher.h" #include "CCTouchDispatcher.h"
#include "cocoa/NSObject.h" #include "NSObject.h"
#include "cocoa/NSSet.h" #include "NSSet.h"
namespace cocos2d { namespace cocos2d {
/** /**