本文整理汇总了C++中Input::SetMouseMode方法的典型用法代码示例。如果您正苦于以下问题:C++ Input::SetMouseMode方法的具体用法?C++ Input::SetMouseMode怎么用?C++ Input::SetMouseMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::SetMouseMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Object
SampleSelector::SampleSelector(Context* context) :
Object(context)
{
UIView* view = FeatureExamples::GetUIView();
UILayout* rootLayout = new UILayout(context_);
rootLayout->SetAxis(UI_AXIS_Y);
rootLayout->SetRect(view->GetRect());
view->AddChild(rootLayout);
const char* examples[] = {
"Hello World",
"Hello GUI",
"Render to Texture",
"2D Sprite",
"2D Physics",
"2D Constraints",
"2D Rope",
"2D Spriter Animation",
"3D Static Scene",
"3D Animating Scene",
"3D Light Animation",
"3D Billboards",
"3D Particles",
"3D Physics",
"3D Skeletal Animation",
"3D Decals",
"3D Character",
"3D Dynamic Geometry",
"3D Ragdolls",
"3D Vehicle Demo",
"3D Crowd Navigation",
"3D Water",
"3D Multiple Viewports"
};
for (size_t i = 0; i < sizeof(examples) / sizeof(examples[0]); i++)
{
UIButton* button = new UIButton(context_);
button->SetLayoutMinWidth(128);
button->SetText(examples[i]);
button->SetId(examples[i]);
button->SubscribeToEvent(button, E_WIDGETEVENT, ATOMIC_HANDLER(SampleSelector, HandleWidgetEvent));
rootLayout->AddChild(button);
}
Input* input = GetSubsystem<Input>();
input->SetMouseVisible(true);
input->SetMouseMode(MM_FREE);
// Subscribe key up event
SubscribeToEvent(E_KEYUP, ATOMIC_HANDLER(SampleSelector, HandleKeyUp));
context->RegisterSubsystem(this);
}
示例2: SetVisible
void Console::SetVisible(bool enable)
{
Input* input = GetSubsystem<Input>();
UI* ui = GetSubsystem<UI>();
Cursor* cursor = ui->GetCursor();
background_->SetVisible(enable);
closeButton_->SetVisible(enable);
if (enable)
{
// Check if we have receivers for E_CONSOLECOMMAND every time here in case the handler is being added later dynamically
bool hasInterpreter = PopulateInterpreter();
commandLine_->SetVisible(hasInterpreter);
if (hasInterpreter && focusOnShow_)
ui->SetFocusElement(lineEdit_);
// Ensure the background has no empty space when shown without the lineedit
background_->SetHeight(background_->GetMinHeight());
if (!cursor)
{
// Show OS mouse
input->SetMouseMode(MM_FREE, true);
input->SetMouseVisible(true, true);
}
input->SetMouseGrabbed(false, true);
}
else
{
rowContainer_->SetFocus(false);
interpreters_->SetFocus(false);
lineEdit_->SetFocus(false);
if (!cursor)
{
// Restore OS mouse visibility
input->ResetMouseMode();
input->ResetMouseVisible();
}
input->ResetMouseGrabbed();
}
}