91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

官方提供了Cocos2dx的第三方庫,但是采用的是2.x的接口,3.x下面依然是可以使用的,不過在這添加了采用3.x接口封裝的方法

資源截圖

代碼片段和文件信息

//
//??GB2ShapeCache-x.cpp
//??
//??Loads?physics?sprites?created?with?http://www.PhysicsEditor.de
//??To?be?used?with?cocos2d-x
//
//??Generic?Shape?Cache?for?box2d
//
//??Created?by?Thomas?Broquist
//
//??????http://www.PhysicsEditor.de
//??????http://texturepacker.com
//??????http://www.code-and-web.de
//??
//??All?rights?reserved.
//
//??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?“GB2ShapeCache-x.h“
#include?“Box2D/Box2D.h“?

using?namespace?cocos2d;

/**
?*?Internal?class?to?hold?the?fixtures
?*/
class?FixtureDef?{
public:
????FixtureDef()
????:?next(NULL)?{}
????
????~FixtureDef()?{
????????delete?next;
????????delete?fixture.shape;
????}
????
????FixtureDef?*next;
????b2FixtureDef?fixture;
????int?callbackData;
};

class?BodyDef?{
public:
BodyDef()
:?fixtures(NULL)?{}

~BodyDef()?{
if?(fixtures)
delete?fixtures;
}

FixtureDef?*fixtures;
Vec2?anchorPoint;
};

static?GB2ShapeCache?*_sharedGB2ShapeCache?=?NULL;

GB2ShapeCache*?GB2ShapeCache::sharedGB2ShapeCache(void)?{
if?(!_sharedGB2ShapeCache)?{
_sharedGB2ShapeCache?=?new?GB2ShapeCache();
????????_sharedGB2ShapeCache->init();
}

return?_sharedGB2ShapeCache;
}

bool?GB2ShapeCache::init()?{
return?true;
}

void?GB2ShapeCache::reset()?{
std::map::iterator?iter;
for?(iter?=?shapeobjects.begin()?;?iter?!=?shapeobjects.end()?;?++iter)?{
delete?iter->second;
}
shapeobjects.clear();
}

void?GB2ShapeCache::addFixturesToBody(b2Body?*body?const?std::string?&shape)?{
std::map::iterator?pos?=?shapeobjects.find(shape);
assert(pos?!=?shapeobjects.end());

BodyDef?*so?=?(*pos).second;

FixtureDef?*fix?=?so->fixtures;
????while?(fix)?{
????????body->CreateFixture(&fix->fixture);
????????fix?=?fix->next;
????}
}

cocos2d::Vec2?GB2ShapeCache::anchorPointForShape(const?std::string?&shape)?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????2124??2017-07-14?13:13??GB2ShapeCache-x.h
?????文件????????7889??2017-07-04?15:25??GLES-Render.cpp
?????文件????????2177??2016-06-23?15:42??GLES-Render.h
?????文件???????12011??2017-07-17?09:52??GB2ShapeCache-x.cpp

評論

共有 條評論