Skip to content

Commit

Permalink
Merge pull request cocos2d#885 from walzer/gles20
Browse files Browse the repository at this point in the history
add CocosBuilder support for gles20 branch
  • Loading branch information
Walzer committed May 8, 2012
2 parents cf6edf7 + 3463a29 commit 2058b8b
Show file tree
Hide file tree
Showing 31 changed files with 6,076 additions and 25 deletions.
59 changes: 37 additions & 22 deletions AUTHORS
@@ -1,21 +1,34 @@
cocos2d-x authors
cocos2d-x authors & contributors

(ordered by the join in time)

Core Developers:
Zhe Wang (Walzer)
XiaoMing Zhang (Minggo)
WenSheng Yang
Bin Zhang
RongHong Huang
JianHua Chen (Dumganhar)
Shun Lin

Developers:
XiaoLong Zhang (Chukong Inc)
Mike McGary (Zynga)
Di Wu
CCBReader and cpp reflection mechanic

Angus Comrie
contributes cocos2d-x port of CCControlExtension.

Yannick Loriot
author of CCControlExtension of cocos2d-iphone port.

Surith Thekkiam (folecr, Zynga)
contribute for Android module building

Jianfeng Zhou (NetGragon Inc)
contributes CCListView and CCTextureWatcher.

dducharme
author of blackberry port

HuaXu Cai (laschweinski)
HuaXu Cai (Kongzhong Corporation)
author of linux port

ciaranj
Expand All @@ -39,19 +52,20 @@ Developers:
Chris Calm
authors of CCTexturePVR

RuiXiang Zhou
XiDi Peng
AiYu Ye
RuiXiang Zhou (NetDragon)
XiDi Peng (NetDragon)
AiYu Ye (NetDragon)
authors of lua binding

Max Aksenov
author and maintainer of Airplay port

Giovanni Zito
Francis Styck
maintainers of Marmalade port
authors of Marmalade port

Carlos Sessa
implement the accelerometer module onto Android
implement the accelerometer module for Android port

JianHua Chen (Dumganhar)
author of Bada port
Expand All @@ -61,18 +75,19 @@ Developers:

YuLei Liao(dualface)
contribute the factor of lua binding

folecr
contribute for Android module building

Yannick Loriot
author of CCControlExtension of cocos2d-iphone port.

Angus Comrie
contributes cocos2d-x port of CCControlExtension.

NetGragon
contributes CCListView and CCTextureWatcher.
Retired Core Developers:
WenSheng Yang
Author of windows port, CCTextField,
Designer of CCApplication/CCEGLView/platform structure.
He's working together with 2dx core team but leading FishingJoy game

Bin Zhang
core-team member but put himself in FishingJoy game since 2012.

RongHong Huang (flyingpaper)
Author of cocos2d-xna and spent all his time on wp7.


Cocos2d-x can not grow so fast without the active community.
Thanks to all developers who report & trace bugs, dicuss the engine usage in forum & QQ groups!
Expand Down
4 changes: 3 additions & 1 deletion cocos2dx/Android.mk
Expand Up @@ -55,7 +55,9 @@ extensions/CCControlExtension/CCScale9Sprite.cpp \
extensions/CCControlExtension/CCSpacer.cpp \
extensions/CCListView/CCListView.cpp \
extensions/CCListView/CCListViewCell.cpp \
extensions/CCTextureWatcher/CCTextureWatcher.cpp \
extensions/CCTextureWatcher/CCTextureWatcher.cpp \
extensions/CCBReader/CCBCustomClass.cpp \
extensions/CCBReader/CCBReader.cpp \
kazmath/src/aabb.c \
kazmath/src/mat3.c \
kazmath/src/mat4.c \
Expand Down
78 changes: 78 additions & 0 deletions cocos2dx/extensions/CCBReader/CCBCustomClass.cpp
@@ -0,0 +1,78 @@
/****************************************************************************
Copyright (c) 2012 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.
****************************************************************************/

#include "CCBCustomClass.h"

USING_NS_CC_EXT;

static CCBCustomClassFactory g_FactoryInstance;

// CCBCustomClassFactory
CCBCustomClassFactory::CCBCustomClassFactory()
{
m_pCustomCreatorsMap = new CUSTOM_CLASS_MAP;
}

CCBCustomClassFactory::~CCBCustomClassFactory()
{
CC_SAFE_DELETE(m_pCustomCreatorsMap);
}

CCBCustomClassFactory* CCBCustomClassFactory::sharedFactory()
{
// TBD: don't use static global variable, so ugly
return &g_FactoryInstance;
}

bool CCBCustomClassFactory::registCustomClass(const char* name, FUNC_CUSTON_CLASS_CREATOR pfnCreator)
{
bool bRetVal = false;

if (! (*m_pCustomCreatorsMap)[name] )
{
(*m_pCustomCreatorsMap)[name] = pfnCreator;
bRetVal = true;
}
else
{
CCLOG("CCB: key = [%s] in m_pCustomCreatorsMap is already registed", name);
}

return bRetVal;
}

CCBCustomClassProtocol* CCBCustomClassFactory::createCustomClassWithName(const char* name)
{
CCBCustomClassProtocol* pRetVal = NULL;
FUNC_CUSTON_CLASS_CREATOR pfnCreator = (*m_pCustomCreatorsMap)[name];

if (pfnCreator)
{
CCLOG("CCB: creating [%s] object", name);
pRetVal = pfnCreator();
}

return pRetVal;
}

97 changes: 97 additions & 0 deletions cocos2dx/extensions/CCBReader/CCBCustomClass.h
@@ -0,0 +1,97 @@
/****************************************************************************
Copyright (c) 2012 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 _CC_CUSTOM_CLASS_H_
#define _CC_CUSTOM_CLASS_H_

#include "cocos2d.h"
#include <map>

NS_CC_EXT_BEGIN

/**
@brief This is a simple reflection implement for custom classes in CocosBuilder
You should declare your custom class like:
class MyCustomLayer : public CCBCustomClass, public CCLayer
CCBCustomClass is a pure virtual class. It doesn't inherit CCObject to prevent dead-diamond.
*/
class CCBCustomClassProtocol
{
public:
/** You should implement this static function in your custom class, and return a valid object */
static CCBCustomClassProtocol* createInstance() { return NULL; }; // cannot create virual class here

CCBCustomClassProtocol() {};
virtual ~CCBCustomClassProtocol() {};

/** This pure virtual methods should be implemented in your custom class
please refer to tests/ExtensionsTest/CocosBuilderTest as a sample */
virtual bool callbackSetChildren(const char* name, cocos2d::CCObject* node) = 0;

/** This pure virtual methods should be implemented in your custom class
please refer to tests/ExtensionsTest/CocosBuilderTest as a sample */
virtual cocos2d::SEL_MenuHandler callbackGetSelectors(const char* selectorName) = 0;

/** This pure virtual methods should be implemented in your custom class
please refer to tests/ExtensionsTest/CocosBuilderTest as a sample */
virtual void callbackAfterCCBLoaded() = 0;
};

/**
@brief CCBCustomClass should be registed into this factory, then CCBReader can create your custom class via its name string.
See tests/Extensionstest/CocosBuilderTest/CocosBuilderTest.cpp as the reference
*/
class CC_DLL CCBCustomClassFactory
{
private:
/// a function pointer for CCCustomClassProtocol::createInstance
typedef CCBCustomClassProtocol* (*FUNC_CUSTON_CLASS_CREATOR)();
typedef std::map<std::string, FUNC_CUSTON_CLASS_CREATOR> CUSTOM_CLASS_MAP;
CUSTOM_CLASS_MAP* m_pCustomCreatorsMap;

public:
CCBCustomClassFactory();
virtual ~CCBCustomClassFactory();

/** get the singleton */
static CCBCustomClassFactory* sharedFactory();

/** Note that you should regist custom class before invoke CCBReader::nodeGraphFromFile
For example:
CCBCustomClassFactory::sharedFactory()->registCustomClass("HelloCocosBuilder",
HelloCocosBuilder::createInstance);
*/
bool registCustomClass(const char* name, FUNC_CUSTON_CLASS_CREATOR pfnCreator);

/** This function is only used in CCBReader. Developers don't need to know it */
CCBCustomClassProtocol* createCustomClassWithName(const char* name);


};

NS_CC_EXT_END;

#endif // _CC_CUSTOM_CLASS_H_

0 comments on commit 2058b8b

Please sign in to comment.