This commit is contained in:
chuanweizhang2013 2014-03-11 17:49:10 +08:00
commit 2094d4cbfd
8 changed files with 32 additions and 45 deletions

View File

@ -1 +1 @@
780fb6720d1919356d3fac951ed0f86cfb85c6bd
727d9ca089cf00365014b23ae2cf63341316ba7d

View File

@ -44,11 +44,11 @@ PhysicsContact::PhysicsContact()
, _eventCode(EventCode::NONE)
, _info(nullptr)
, _notificationEnable(true)
, _begin(false)
, _result(true)
, _data(nullptr)
, _contactInfo(nullptr)
, _contactData(nullptr)
, _preContactData(nullptr)
{
}
@ -57,6 +57,7 @@ PhysicsContact::~PhysicsContact()
{
CC_SAFE_DELETE(_info);
CC_SAFE_DELETE(_contactData);
CC_SAFE_DELETE(_preContactData);
}
PhysicsContact* PhysicsContact::construct(PhysicsShape* a, PhysicsShape* b)
@ -96,7 +97,8 @@ void PhysicsContact::generateContactData()
}
cpArbiter* arb = static_cast<cpArbiter*>(_contactInfo);
CC_SAFE_DELETE(_contactData);
CC_SAFE_DELETE(_preContactData);
_preContactData = _contactData;
_contactData = new PhysicsContactData();
_contactData->count = cpArbiterGetCount(arb);
for (int i=0; i<_contactData->count && i<PhysicsContactData::POINT_MAX; ++i)
@ -108,15 +110,13 @@ void PhysicsContact::generateContactData()
}
// PhysicsContactPreSolve implementation
PhysicsContactPreSolve::PhysicsContactPreSolve(PhysicsContactData* data, void* contactInfo)
: _preContactData(data)
, _contactInfo(contactInfo)
PhysicsContactPreSolve::PhysicsContactPreSolve(void* contactInfo)
: _contactInfo(contactInfo)
{
}
PhysicsContactPreSolve::~PhysicsContactPreSolve()
{
CC_SAFE_DELETE(_preContactData);
}
float PhysicsContactPreSolve::getRestitution() const
@ -217,7 +217,6 @@ void EventListenerPhysicsContact::onEvent(EventCustom* event)
if (onContactBegin != nullptr
&& hitTest(contact->getShapeA(), contact->getShapeB()))
{
contact->_begin = true;
contact->generateContactData();
ret = onContactBegin(*contact);
}
@ -232,8 +231,7 @@ void EventListenerPhysicsContact::onEvent(EventCustom* event)
if (onContactPreSolve != nullptr
&& hitTest(contact->getShapeA(), contact->getShapeB()))
{
PhysicsContactPreSolve solve(contact->_begin ? nullptr : contact->_contactData, contact->_contactInfo);
contact->_begin = false;
PhysicsContactPreSolve solve(contact->_contactInfo);
contact->generateContactData();
ret = onContactPreSolve(*contact, solve);

View File

@ -78,6 +78,8 @@ public:
inline PhysicsShape* getShapeB() const { return _shapeB; }
/** get contact data */
inline const PhysicsContactData* getContactData() const { return _contactData; }
/** get previous contact data */
inline const PhysicsContactData* getPreContactData() const { return _preContactData; }
/** get data. */
inline void* getData() const { return _data; }
/**
@ -112,12 +114,12 @@ private:
EventCode _eventCode;
PhysicsContactInfo* _info;
bool _notificationEnable;
bool _begin;
bool _result;
void* _data;
void* _contactInfo;
PhysicsContactData* _contactData;
PhysicsContactData* _preContactData;
friend class EventListenerPhysicsContact;
friend class PhysicsWorldCallback;
@ -146,14 +148,10 @@ public:
void ignore();
private:
PhysicsContactPreSolve(PhysicsContactData* data, void* contactInfo);
PhysicsContactPreSolve(void* contactInfo);
~PhysicsContactPreSolve();
private:
float _elasticity;
float _friction;
Point _surfaceVelocity;
PhysicsContactData* _preContactData;
void* _contactInfo;
friend class EventListenerPhysicsContact;

View File

@ -11,6 +11,11 @@
-- @param self
-- @return PhysicsContact::EventCode#PhysicsContact::EventCode ret (return value: cc.PhysicsContact::EventCode)
--------------------------------
-- @function [parent=#PhysicsContact] getPreContactData
-- @param self
-- @return PhysicsContactData#PhysicsContactData ret (return value: cc.PhysicsContactData)
--------------------------------
-- @function [parent=#PhysicsContact] getShapeA
-- @param self

View File

@ -1 +1 @@
6f6bb7571ab92f9757a753c243a5061fd64a3fbd
9ee0235aac42ea657853d56947716b3fc8fee2c2

View File

@ -261,6 +261,7 @@ int register_all_cocos2dx_physics(lua_State* tolua_S);
#endif // __cocos2dx_physics_h__

View File

@ -277,26 +277,6 @@ class SetEnvVar(object):
else:
return False
def _is_ant_exists(self):
try:
os.environ[ANT_ROOT]
return True
except Exception:
pass
ant_found = False
commands = ['ant', '-version']
child = subprocess.Popen(commands, stdout=subprocess.PIPE)
for line in child.stdout:
if 'Ant' in line:
ant_found = True
break
child.wait()
return ant_found
def _is_ant_root_valid(self, ant_root):
ant_path = ''
@ -391,7 +371,7 @@ class SetEnvVar(object):
print ""
print '-> Looking for ANT_ROOT envrironment variable...',
ant_root_added = False
ant_found = self._is_ant_exists()
ant_found = self._find_environment_variable(ANT_ROOT)
if not ant_root and not ant_found:
print 'NOT FOUND'
@ -429,6 +409,11 @@ class SetEnvVar(object):
else:
print '\nCOCOS_CONSOLE_ROOT was already added. Edit "%s" for manual changes' % target
if self._isWindows():
print '\nPlease restart the terminal to make added system variables take effect'
else:
print '\nPlease execute command: "source %s" to make added system variables take effect' % target
if __name__ == '__main__':
parser = OptionParser()
parser.add_option('-n', '--ndkroot', dest='ndk_root', help='directory of ndk root')

View File

@ -14,6 +14,12 @@ def main():
#parse to json obj
payload = json.loads(payload_str)
issue = payload['issue']
#get pull number
pr_num = issue['number']
print 'pr_num:' + str(pr_num)
payload_forword = {"number":pr_num}
comment = payload['comment']
#get comment body
comment_body = comment['body']
@ -24,12 +30,6 @@ def main():
print 'skip build for pull request #' + str(pr_num)
return(0)
issue = payload['issue']
#get pull number
pr_num = issue['number']
print 'pr_num:' + str(pr_num)
payload_forword = {"number":pr_num}
#build for pull request action 'open' and 'synchronize', skip 'close'
action = issue['state']
print 'action: ' + action