本文整理汇总了C++中QNode::_getToLuaClassName方法的典型用法代码示例。如果您正苦于以下问题:C++ QNode::_getToLuaClassName方法的具体用法?C++ QNode::_getToLuaClassName怎么用?C++ QNode::_getToLuaClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QNode
的用法示例。
在下文中一共展示了QNode::_getToLuaClassName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BeginContact
//------------------------------------------------------------------------------
// QContactListener
//------------------------------------------------------------------------------
void QContactListener::BeginContact(b2Contact* pContact)
{
QNode* pNodeA = (QNode*)pContact->GetFixtureA()->GetBody()->GetUserData();
QNode* pNodeB = (QNode*)pContact->GetFixtureB()->GetBody()->GetUserData();
lua_gettop(g_L);
LUA_EVENT_PREPARE("collision"); // On stack: event
LUA_EVENT_SET_STRING("phase", "began");
LUA_EVENT_SET_TOLUA_PTR("nodeA", (void*)pNodeA, pNodeA->_getToLuaClassName());
LUA_EVENT_SET_TOLUA_PTR("nodeB", (void*)pNodeB, pNodeB->_getToLuaClassName());
LUA_EVENT_SET_TOLUA_PTR("target", (void*)pNodeA, pNodeA->_getToLuaClassName());
// World point of collision... is this correct?
b2WorldManifold wm;
pContact->GetWorldManifold(&wm);
float dx = g_Sim->scaleP2D(wm.points[0].x);
float dy = g_Sim->scaleP2D(wm.points[0].y);
LUA_EVENT_SET_NUMBER("x", dx);
LUA_EVENT_SET_NUMBER("y", dy);
lua_getfield(g_L, LUA_GLOBALSINDEX, "handleNodeEvent");
lua_pushvalue(g_L, -2); // On stack: handleNodeEvent(event)
tolua_pushusertype(g_L, (void*)pNodeA, pNodeA->_getToLuaClassName()); // On stack: handleNodeEvent(event, node)
lua_gettop(g_L);
int s = lua_pcall(g_L, 2, 1, 0);
lua_gettop(g_L);
LUA_REPORT_ERRORS(g_L, s);
lua_gettop(g_L);
lua_pop(g_L, 3);
lua_gettop(g_L);
}
示例2: EndContact
//------------------------------------------------------------------------------
void QContactListener::EndContact(b2Contact* pContact)
{
QNode* pNodeA = (QNode*)pContact->GetFixtureA()->GetBody()->GetUserData();
QNode* pNodeB = (QNode*)pContact->GetFixtureB()->GetBody()->GetUserData();
lua_gettop(g_L);
LUA_EVENT_PREPARE("collision"); // On stack: event
LUA_EVENT_SET_STRING("phase", "ended");
LUA_EVENT_SET_TOLUA_PTR("nodeA", (void*)pNodeA, pNodeA->_getToLuaClassName());
LUA_EVENT_SET_TOLUA_PTR("nodeB", (void*)pNodeB, pNodeB->_getToLuaClassName());
LUA_EVENT_SET_TOLUA_PTR("target", (void*)pNodeA, pNodeA->_getToLuaClassName());
lua_getfield(g_L, LUA_GLOBALSINDEX, "handleNodeEvent");
lua_pushvalue(g_L, -2); // On stack: handleNodeEvent(event)
tolua_pushusertype(g_L, (void*)pNodeA, pNodeA->_getToLuaClassName()); // On stack: handleNodeEvent(event, node)
lua_gettop(g_L);
int s = lua_pcall(g_L, 2, 1, 0);
lua_gettop(g_L);
LUA_REPORT_ERRORS(g_L, s);
lua_gettop(g_L);
lua_pop(g_L, 3);
lua_gettop(g_L);
}
示例3: PostSolve
//------------------------------------------------------------------------------
void QContactListener::PostSolve(b2Contact* pContact, const b2ContactImpulse* pImpulse)
{
QNode* pNodeA = (QNode*)pContact->GetFixtureA()->GetBody()->GetUserData();
QNode* pNodeB = (QNode*)pContact->GetFixtureB()->GetBody()->GetUserData();
LUA_EVENT_PREPARE("collisionPostSolve"); // On stack: event
LUA_EVENT_SET_STRING("phase", "ended");
LUA_EVENT_SET_TOLUA_PTR("nodeA", (void*)pNodeA, pNodeA->_getToLuaClassName());
LUA_EVENT_SET_TOLUA_PTR("nodeB", (void*)pNodeB, pNodeB->_getToLuaClassName());
LUA_EVENT_SET_TOLUA_PTR("target", (void*)pNodeA, pNodeA->_getToLuaClassName());
QContact con(pContact);
LUA_EVENT_SET_TOLUA_PTR("contact", (void*)&con, "quick::QPhysics::Contact");
// Force (impulse)
float f = g_Sim->scaleP2D(pImpulse->normalImpulses[0]);
LUA_EVENT_SET_NUMBER("impulse", f);
lua_getfield(g_L, LUA_GLOBALSINDEX, "handleNodeEvent");
lua_pushvalue(g_L, -2); // On stack: handleNodeEvent(event)
tolua_pushusertype(g_L, (void*)pNodeA, pNodeA->_getToLuaClassName()); // On stack: handleNodeEvent(event, node)
int s = lua_pcall(g_L, 2, 1, 0);
LUA_REPORT_ERRORS(g_L, s);
lua_pop(g_L, 2);
lua_gettop(g_L);
}