本文整理汇总了C++中PlatformWindow::setMouseLocked方法的典型用法代码示例。如果您正苦于以下问题:C++ PlatformWindow::setMouseLocked方法的具体用法?C++ PlatformWindow::setMouseLocked怎么用?C++ PlatformWindow::setMouseLocked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlatformWindow
的用法示例。
在下文中一共展示了PlatformWindow::setMouseLocked方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onInputEvent
bool EditTSCtrl::onInputEvent(const InputEventInfo & event)
{
if(mRightMousePassThru && event.deviceType == MouseDeviceType &&
event.objInst == KEY_BUTTON1 && event.action == SI_BREAK)
{
// if the right mouse pass thru is enabled,
// we want to reactivate mouse on a right mouse button up
GuiCanvas *pCanvas = getRoot();
if( !pCanvas )
return false;
PlatformWindow *pWindow = static_cast<GuiCanvas*>(getRoot())->getPlatformWindow();
if( !pWindow )
return false;
PlatformCursorController *pController = pWindow->getCursorController();
if( !pController )
return false;
pWindow->setMouseLocked(false);
pCanvas->setCursorON( true );
if(mDisplayType != DisplayTypePerspective)
{
mouseUnlock();
pCanvas->setForceMouseToGUI(false);
pCanvas->setClampTorqueCursor(mLastMouseClamping);
}
}
if(mMiddleMousePassThru && event.deviceType == MouseDeviceType &&
event.objInst == KEY_BUTTON2 && event.action == SI_BREAK)
{
// if the middle mouse pass thru is enabled,
// we want to reactivate mouse on a middle mouse button up
GuiCanvas *pCanvas = getRoot();
if( !pCanvas )
return false;
PlatformWindow *pWindow = static_cast<GuiCanvas*>(getRoot())->getPlatformWindow();
if( !pWindow )
return false;
PlatformCursorController *pController = pWindow->getCursorController();
if( !pController )
return false;
pWindow->setMouseLocked(false);
pCanvas->setCursorON( true );
}
// we return false so that the canvas can properly process the right mouse button up...
return false;
}
示例2: onMiddleMouseDown
void EditTSCtrl::onMiddleMouseDown(const GuiEvent & event)
{
mMiddleMouseDown = true;
mMiddleMouseTriggered = false;
mLastBorderMoveTime = 0;
if(!mLeftMouseDown && !mRightMouseDown && mMiddleMousePassThru && mProfile->mCanKeyFocus)
{
GuiCanvas *pCanvas = getRoot();
if( !pCanvas )
return;
PlatformWindow *pWindow = static_cast<GuiCanvas*>(getRoot())->getPlatformWindow();
if( !pWindow )
return;
PlatformCursorController *pController = pWindow->getCursorController();
if( !pController )
return;
// ok, gotta disable the mouse
// script functions are lockMouse(true); Canvas.cursorOff();
pWindow->setMouseLocked(true);
pCanvas->setCursorON( false );
// Trigger 2 is used by the camera
MoveManager::mTriggerCount[2]++;
mMiddleMouseTriggered = true;
setFirstResponder();
}
}
示例3: messageBox
S32 Platform::messageBox(const UTF8 *title, const UTF8 *message, MBButtons buttons, MBIcons icon)
{
PlatformWindow *pWindow = WindowManager->getFirstWindow();
// Get us rendering while we're blocking.
winState.renderThreadBlocked = true;
// We don't keep a locked mouse or else we're going
// to end up possibly locking our mouse out of the
// message box area
bool cursorLocked = pWindow && pWindow->isMouseLocked();
if( cursorLocked )
pWindow->setMouseLocked( false );
// Need a visible cursor to click stuff accurately
bool cursorVisible = !pWindow || pWindow->isCursorVisible();
if( !cursorVisible )
pWindow->setCursorVisible(true);
#ifdef UNICODE
const UTF16 *msg = createUTF16string(message);
const UTF16 *t = createUTF16string(title);
#else
const UTF8 *msg = message;
const UTF8 *t = title;
#endif
HWND parent = pWindow ? static_cast<Win32Window*>(pWindow)->getHWND() : NULL;
S32 ret = ::MessageBox( parent, msg, t, getMaskFromID(sgButtonMap, buttons) | getMaskFromID(sgIconMap, icon));
#ifdef UNICODE
delete [] msg;
delete [] t;
#endif
// Dialog is gone.
winState.renderThreadBlocked = false;
if( cursorVisible == false )
pWindow->setCursorVisible( false );
if( cursorLocked == true )
pWindow->setMouseLocked( true );
return getMaskFromID(sgMsgBoxRetMap, ret);
}
示例4: onRightMouseDown
void EditTSCtrl::onRightMouseDown(const GuiEvent & event)
{
// always process the right mouse event first...
mRightMouseDown = true;
mLastBorderMoveTime = 0;
make3DMouseEvent(mLastEvent, event);
on3DRightMouseDown(mLastEvent);
if(!mLeftMouseDown && mRightMousePassThru && mProfile->mCanKeyFocus)
{
GuiCanvas *pCanvas = getRoot();
if( !pCanvas )
return;
PlatformWindow *pWindow = static_cast<GuiCanvas*>(getRoot())->getPlatformWindow();
if( !pWindow )
return;
PlatformCursorController *pController = pWindow->getCursorController();
if( !pController )
return;
// ok, gotta disable the mouse
// script functions are lockMouse(true); Canvas.cursorOff();
pWindow->setMouseLocked(true);
pCanvas->setCursorON( false );
if(mDisplayType != DisplayTypePerspective)
{
mouseLock();
mLastMousePos = event.mousePoint;
pCanvas->setForceMouseToGUI(true);
mLastMouseClamping = pCanvas->getClampTorqueCursor();
pCanvas->setClampTorqueCursor(false);
}
if(mDisplayType == DisplayTypeIsometric)
{
// Store the screen center point on the terrain for a possible rotation
TerrainBlock* activeTerrain = getActiveTerrain();
if( activeTerrain )
{
F32 extx, exty;
if(event.modifier & SI_SHIFT)
{
extx = F32(event.mousePoint.x);
exty = F32(event.mousePoint.y);
}
else
{
extx = getExtent().x * 0.5;
exty = getExtent().y * 0.5;
}
Point3F sp(extx, exty, 0.0f); // Near plane projection
Point3F start;
unproject(sp, &start);
Point3F end = start + mLastEvent.vec * 4000.0f;
Point3F tStartPnt, tEndPnt;
activeTerrain->getTransform().mulP(start, &tStartPnt);
activeTerrain->getTransform().mulP(end, &tEndPnt);
RayInfo info;
bool result = activeTerrain->castRay(tStartPnt, tEndPnt, &info);
if(result)
{
info.point.interpolate(start, end, info.t);
mIsoCamRotCenter = info.point;
}
else
{
mIsoCamRotCenter = start;
}
}
else
{
F32 extx = getExtent().x * 0.5;
F32 exty = getExtent().y * 0.5;
Point3F sp(extx, exty, 0.0f); // Near plane projection
unproject(sp, &mIsoCamRotCenter);
}
}
setFirstResponder();
}
}
示例5: setWindowLocked
void Platform::setWindowLocked(bool locked)
{
PlatformWindow* window = WindowManager->getFirstWindow();
if( window )
window->setMouseLocked( locked );
}