本文整理汇总了C++中Viewport::GetWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ Viewport::GetWidth方法的具体用法?C++ Viewport::GetWidth怎么用?C++ Viewport::GetWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Viewport
的用法示例。
在下文中一共展示了Viewport::GetWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
//.........这里部分代码省略.........
default:
Log(TAG "Received system event. Message (0x%x) wParam = %d, lParam = %d.", event.syswm.msg->msg, event.syswm.msg->wParam, event.syswm.msg->lParam);
break;
}
}
break;
#endif
case SDL_KEYDOWN:
{
EventInputKeyboard ev(event.key.keysym.sym, event.key.keysym.mod, event.key.keysym.scancode, event.key.which);
this->SendEventKeyboardPress(&ev);
}
break;
case SDL_KEYUP:
{
EventInputKeyboard ev(event.key.keysym.sym, event.key.keysym.mod, event.key.keysym.scancode, event.key.which);
this->SendEventKeyboardRelease(&ev);
}
break;
case SDL_QUIT:
{
EventSystem ev;
pSystem->SendEventShutdown(&ev);
}
break;
case SDL_MOUSEMOTION:
{
f32 x, y;
x = fX = (f32)event.motion.x / (f32)pScreen->GetWidth();
y = fY = (f32)event.motion.y / (f32)pScreen->GetHeight();
Viewport *viewport = static_cast<Viewport*>(pViewManager->GetViewportAt(fX, fY));
f32 fw = 1.0f;
f32 fh = 1.0f;
if (viewport)
{
fw = (viewport->GetWidth());// * viewport->GetWidth());
fh = (viewport->GetHeight());// * viewport->GetHeight());
//x = viewport->GetX() + viewport->GetWidth() * fX;
//y = viewport->GetY() + viewport->GetHeight() * fY;
x = (fX - viewport->GetX()) / fw;
y = (fY - viewport->GetY()) / fh;
}
EventInputPointer ev(0, 0, 0, 0, x, y);
this->SendEventPointerMove(&ev);
}
break;
case SDL_MOUSEBUTTONUP:
{
f32 x, y;
x = fX = (f32)event.motion.x / (f32)pScreen->GetWidth();
y = fY = (f32)event.motion.y / (f32)pScreen->GetHeight();
Viewport *viewport = static_cast<Viewport*>(pViewManager->GetViewportAt(fX, fY));
f32 fw = 1.0f;
f32 fh = 1.0f;
if (viewport)
{
fw = (viewport->GetWidth());// * viewport->GetWidth());