本文整理汇总了C++中KX_GameObject::GetState方法的典型用法代码示例。如果您正苦于以下问题:C++ KX_GameObject::GetState方法的具体用法?C++ KX_GameObject::GetState怎么用?C++ KX_GameObject::GetState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KX_GameObject
的用法示例。
在下文中一共展示了KX_GameObject::GetState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsNegativeEvent
bool
KX_StateActuator::Update()
{
bool bNegativeEvent = IsNegativeEvent();
unsigned int objMask;
// execution of state actuator means that we are in the execution phase, reset this pointer
// because all the active actuator of this object will be removed for sure.
m_gameobj->m_firstState = NULL;
RemoveAllEvents();
if (bNegativeEvent) return false;
KX_GameObject *obj = (KX_GameObject*) GetParent();
objMask = obj->GetState();
switch (m_operation)
{
case OP_CPY:
objMask = m_mask;
break;
case OP_SET:
objMask |= m_mask;
break;
case OP_CLR:
objMask &= ~m_mask;
break;
case OP_NEG:
objMask ^= m_mask;
break;
default:
// unsupported operation, no nothing
return false;
}
obj->SetState(objMask);
return false;
}
示例2: RenderDebugProperties
void KX_KetsjiEngine::RenderDebugProperties()
{
STR_String debugtxt;
int xcoord = 10; // mmmm, these constants were taken from blender source
int ycoord = 14; // to 'mimic' behaviour
float tottime = m_logger->GetAverage();
if (tottime < 1e-6f) {
tottime = 1e-6f;
}
// Set viewport to entire canvas
RAS_Rect viewport;
m_canvas->SetViewPort(0, 0, int(m_canvas->GetWidth()), int(m_canvas->GetHeight()));
/* Framerate display */
if (m_show_framerate) {
debugtxt.Format("swap : %.3f (%.3f frames per second)", tottime, 1.0/tottime);
m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
debugtxt.Ptr(),
xcoord,
ycoord,
m_canvas->GetWidth() /* RdV, TODO ?? */,
m_canvas->GetHeight() /* RdV, TODO ?? */);
ycoord += 14;
}
/* Profile and framerate display */
if (m_show_profile)
{
for (int j = tc_first; j < tc_numCategories; j++)
{
debugtxt.Format(m_profileLabels[j]);
m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
debugtxt.Ptr(),
xcoord,ycoord,
m_canvas->GetWidth(),
m_canvas->GetHeight());
double time = m_logger->GetAverage((KX_TimeCategory)j);
debugtxt.Format("%.3fms (%2.2f %%)", time*1000.f, time/tottime * 100.f);
m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
debugtxt.Ptr(),
xcoord + 60 ,ycoord,
m_canvas->GetWidth(),
m_canvas->GetHeight());
ycoord += 14;
}
}
/* Property display*/
if (m_show_debug_properties && m_propertiesPresent)
{
KX_SceneList::iterator sceneit;
for (sceneit = m_scenes.begin();sceneit != m_scenes.end() ; sceneit++)
{
KX_Scene* scene = *sceneit;
/* the 'normal' debug props */
vector<SCA_DebugProp*>& debugproplist = scene->GetDebugProperties();
for (vector<SCA_DebugProp*>::iterator it = debugproplist.begin();
!(it==debugproplist.end());it++)
{
CValue* propobj = (*it)->m_obj;
STR_String objname = propobj->GetName();
STR_String propname = (*it)->m_name;
if (propname == "__state__")
{
// reserve name for object state
KX_GameObject* gameobj = static_cast<KX_GameObject*>(propobj);
unsigned int state = gameobj->GetState();
debugtxt = objname + "." + propname + " = ";
bool first = true;
for (int statenum=1;state;state >>= 1, statenum++)
{
if (state & 1)
{
if (!first)
{
debugtxt += ",";
}
debugtxt += STR_String(statenum);
first = false;
}
}
m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
debugtxt.Ptr(),
xcoord,
ycoord,
m_canvas->GetWidth(),
m_canvas->GetHeight());
ycoord += 14;
}
else
{
CValue* propval = propobj->GetProperty(propname);
if (propval)
{
STR_String text = propval->GetText();
debugtxt = objname + "." + propname + " = " + text;
m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
//.........这里部分代码省略.........