本文整理汇总了C++中CKContext::GetObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CKContext::GetObject方法的具体用法?C++ CKContext::GetObject怎么用?C++ CKContext::GetObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKContext
的用法示例。
在下文中一共展示了CKContext::GetObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTargetCommand
/*
*******************************************************************
* Function: CKBehavior* GetTargetCommand(const int commandId, const CKBehaviorContext& behaviorContext)
*
* Description : Gets target behavior object given the command ID
*
* Paramters :
*
* commandId r command id of the target object to get
* behaviorContext r context
*
* Returns :
* pointer to the behavior object, NULL if no object found
*
*******************************************************************
*/
CKBehavior* CGBLCommandController::GetTargetCommand(const int commandId, const CKBehaviorContext& behaviorContext)
{
CKBehavior* targetBehavior = NULL;
CKContext* context = behaviorContext.Context;
int behaviorCount = context->GetObjectsCountByClassID(CKCID_BEHAVIOR);
CK_ID* behaviorIds = context->GetObjectsListByClassID(CKCID_BEHAVIOR);
int currentID;
for (int i = 0; i < behaviorCount; ++i)
{
CKBehavior* behavior = (CKBehavior*)context->GetObject(behaviorIds[i]);
if (behavior->GetPrototypeGuid() == GUID_GBLWAITFORCOMMAND_PROTOTYPE)
{
CKParameterLocal *localParam = NULL;
localParam = behavior->GetLocalParameter(2); //Get command ID
if (localParam != NULL)
{
localParam->GetValue(¤tID); //Get command ID's value
localParam = NULL;
}
else
{
break;
}
if (currentID == commandId)
{
targetBehavior = behavior;
break;
}
}
}
return targetBehavior;
}
示例2: GetNextBBId
int GetNextBBId(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
CKContext* ctx = behcontext.Context;
beh->ActivateInput(0,FALSE);
int count = beh->GetParent()->GetSubBehaviorLinkCount();
int result = -1;
for (int i=0; i<count; i++)
{
CKBehaviorLink *link = beh->GetParent()->GetSubBehaviorLink(i);
if (link->GetInBehaviorIO() == beh->GetOutput(0))
{
result = link->GetOutBehaviorIO()->GetOwner()->GetID();
beh->SetOutputParameterValue(0,&result);
break;
}
}
CKBehavior *script = static_cast<CKBehavior*>(ctx->GetObject(result));
if (script)
{
int bc = script->GetOutputCount();
int bc2 = script->GetInputCount();
}
beh->ActivateOutput(0);
beh->SetOutputParameterValue(0,&result);
return CKBR_OK;
}
示例3: RenderCallback
/*
*******************************************************************
* Function: RenderCallback()
*
* Description : Is called from Virtools every frame. We draw the widget's visual elements in this function.
*
* Parameters :
* Passed in from Virtools. See Virtools SDK documentation:
* *renderContext, rw:
* renderObject, rw:
* *iArg, rw:
*
* Returns : Return TRUE for success or FALSE for failure. The implications of returning FALSE are not documented in the Virtools
* SDK documentation. Let's hope it doesn't format the user's hard disk.
*
*******************************************************************
*/
CKBOOL CGBLListBox::RenderCallback(CKRenderContext *renderContext, CKRenderObject* renderObject, void *iArg)
{
const int cFixedStringBufferSize = 256;
static VxRect fullUVRect(0.0f, 0.0f, 1.0f, 1.0f);
CKContext* context = renderContext->GetCKContext();
CK2dEntity* ent = CK2dEntity::Cast(renderObject);
// Sanity check
if (!ent)
{
assert(NULL);
return FALSE;
}
// Get a pointer to the building block behaviour
CKBehavior* beh = (CKBehavior*)context->GetObject(reinterpret_cast<CK_ID>(iArg));
if (!beh)
return FALSE;
// Use clipping class to manage the clipping for us
CGBLRenderClipper cRenderClipper(renderContext, ent);
// Get client rectangle
VxRect clientRect;
ent->GetExtents(fullUVRect, clientRect);
// Get the font from the base helper class
VirtoolsSource::CKTextureFont* font = CGBLWidget::GetFont(context, beh);
if (!font)
{
// Don't output an error - we check for a font in the behavioural function
return FALSE;
}
// Get material
CKMaterial* material = (CKMaterial*)beh->GetInputParameterObject(eParamInputMaterial);
if (!material)
{
return FALSE;
}
// Are we using proportional scaling?
CKBOOL isPropScaling = CGBLWidget::IsProportionalScaling(beh);
// Get the font height
float fontHeight = CGBLWidget::GetFontHeight(font, renderContext, isPropScaling);
// Render down arrow
CKBOOL isDownButtonPressed = FALSE;
beh->GetLocalParameterValue(eLocalParamIsScrollDownButtonPressed, &isDownButtonPressed);
VxRect buttonRect = GetRectDownArrow(clientRect, fontHeight);
CGBLWidget::DrawMaterialRectangle(renderContext, material, buttonRect,
isDownButtonPressed ? CGBLWidgetsTheme::GetListBoxRegionDownArrowPressed() : CGBLWidgetsTheme::GetListBoxRegionDownArrowUnpressed(),
clientRect);
// Render up arrow
CKBOOL isUpButtonPressed = FALSE;
beh->GetLocalParameterValue(eLocalParamIsScrollUpButtonPressed, &isUpButtonPressed);
buttonRect = GetRectUpArrow(clientRect, fontHeight);
CGBLWidget::DrawMaterialRectangle(renderContext, material, buttonRect,
isUpButtonPressed ? CGBLWidgetsTheme::GetListBoxRegionUpArrowPressed() : CGBLWidgetsTheme::GetListBoxRegionUpArrowUnpressed(),
clientRect);
// Render headings if present
// Get columns array
CKDataArray* columnsArray = static_cast<CKDataArray*>(beh->GetInputParameterObject(eParamInputColumnsArray));
int numColumns = columnsArray ? columnsArray->GetRowCount() : 1;
// If we have at least one row in the columns array, we are drawing headings
if (columnsArray && (columnsArray->GetRowCount() >= 1))
{
VxRect headingsRect = GetRectHeadings(clientRect, fontHeight, columnsArray);
VxRect headingRect = headingsRect;
for (int column = 0;column < numColumns;column++)
{
headingRect.right = headingRect.left + GetColumnWidth(beh, columnsArray, column) * headingsRect.GetWidth() / 100.0f;
// Draw heading background
//.........这里部分代码省略.........