本文整理汇总了C++中IEvent::Block方法的典型用法代码示例。如果您正苦于以下问题:C++ IEvent::Block方法的具体用法?C++ IEvent::Block怎么用?C++ IEvent::Block使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEvent
的用法示例。
在下文中一共展示了IEvent::Block方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnEvent
void CGUIManager::OnEvent(IEvent & Event)
{
ImGuiIO& io = ImGui::GetIO();
if (InstanceOf<SKeyboardEvent>(Event))
{
SKeyboardEvent KeyboardEvent = As<SKeyboardEvent>(Event);
io.KeysDown[(int) KeyboardEvent.Key] = KeyboardEvent.Pressed;
io.KeyCtrl = Window->IsKeyDown(EKey::LeftControl) || Window->IsKeyDown(EKey::RightControl);
io.KeyShift = Window->IsKeyDown(EKey::LeftShift) || Window->IsKeyDown(EKey::RightShift);
io.KeyAlt = Window->IsKeyDown(EKey::LeftAlt) || Window->IsKeyDown(EKey::RightAlt);
}
else if (InstanceOf<SMouseEvent>(Event))
{
SMouseEvent MouseEvent = As<SMouseEvent>(Event);
switch (MouseEvent.Type)
{
case SMouseEvent::EType::Click:
if (ImGui::IsMouseHoveringAnyWindow())
{
Event.Block();
}
MousePressed[(int) MouseEvent.Button] = MouseEvent.Pressed;
break;
case SMouseEvent::EType::Move:
break;
case SMouseEvent::EType::Scroll:
MouseWheel += MouseEvent.Movement.Y;
break;
}
}
else if (InstanceOf<SCharacterEvent>(Event))
{
SCharacterEvent CharacterEvent = As<SCharacterEvent>(Event);
if (CharacterEvent.C > 0)
io.AddInputCharacter(CharacterEvent.C);
}
}