本文整理汇总了C++中GuiCanvas类的典型用法代码示例。如果您正苦于以下问题:C++ GuiCanvas类的具体用法?C++ GuiCanvas怎么用?C++ GuiCanvas使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GuiCanvas类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onLoseFirstResponder
bool GuiTextEditCtrl::dealWithEnter( bool clearResponder )
{
//first validate
if (mProfile->mReturnTab)
{
onLoseFirstResponder();
}
updateHistory(&mTextBuffer, true);
mHistoryDirty = false;
//next exec the alt console command
execAltConsoleCallback();
// Notify of Return
onReturn_callback();
if (mProfile->mReturnTab)
{
GuiCanvas *root = getRoot();
if (root)
{
root->tabNext();
return true;
}
}
if( clearResponder )
clearFirstResponder();
return true;
}
示例2: getRoot
void GuiDecalEditorCtrl::get3DCursor( GuiCursor *&cursor,
bool &visible,
const Gui3DMouseEvent &event_ )
{
cursor = NULL;
visible = false;
GuiCanvas *root = getRoot();
if ( !root )
return;
S32 currCursor = PlatformCursorController::curArrow;
if ( root->mCursorChanged == currCursor )
return;
PlatformWindow *window = root->getPlatformWindow();
PlatformCursorController *controller = window->getCursorController();
// We've already changed the cursor,
// so set it back before we change it again.
if( root->mCursorChanged != -1)
controller->popCursor();
// Now change the cursor shape
controller->pushCursor(currCursor);
root->mCursorChanged = currCursor;
}
示例3: getRoot
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();
}
}
示例4: Init
bool VolumetricFogRTManager::Init()
{
if (mIsInitialized)
{
Con::errorf("VolumetricFogRTManager allready initialized!!");
return true;
}
GuiCanvas* cv = dynamic_cast<GuiCanvas*>(Sim::findObject("Canvas"));
if (cv == NULL)
{
Con::errorf("VolumetricFogRTManager::Init() - Canvas not found!!");
return false;
}
mPlatformWindow = cv->getPlatformWindow();
mPlatformWindow->getScreenResChangeSignal().notify(this,&VolumetricFogRTManager::ResizeRT);
if (mTargetScale < 1 || GFX->getAdapterType() == Direct3D11)
mTargetScale = 1;
mWidth = mFloor(mPlatformWindow->getClientExtent().x / mTargetScale);
mHeight = mFloor(mPlatformWindow->getClientExtent().y / mTargetScale);
mDepthBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
&GFXRenderTargetProfile, avar("%s() - mDepthBuffer (line %d)", __FUNCTION__, __LINE__));
if (!mDepthBuffer.isValid())
{
Con::errorf("VolumetricFogRTManager Fatal Error: Unable to create Depthbuffer");
return false;
}
if (!mDepthTarget.registerWithName("volfogdepth"))
{
Con::errorf("VolumetricFogRTManager Fatal Error : Unable to register Depthbuffer");
return false;
}
mDepthTarget.setTexture(mDepthBuffer);
mFrontBuffer = GFXTexHandle(mWidth, mHeight, GFXFormatR32F,
&GFXRenderTargetProfile, avar("%s() - mFrontBuffer (line %d)", __FUNCTION__, __LINE__));
if (!mFrontBuffer.isValid())
{
Con::errorf("VolumetricFogRTManager Fatal Error: Unable to create front buffer");
return false;
}
if (!mFrontTarget.registerWithName("volfogfront"))
{
Con::errorf("VolumetricFogRTManager Fatal Error : Unable to register Frontbuffer");
return false;
}
mFrontTarget.setTexture(mFrontBuffer);
Con::setVariable("$VolumetricFog::density", "0.0");
mIsInitialized = true;
return true;
}
示例5: getParent
void GuiTextEditSliderCtrl::onMouseDragged(const GuiEvent &event)
{
// If we're not active then skip out.
if ( !mActive || !mAwake || !mVisible )
{
Parent::onMouseDragged(event);
return;
}
if(mTextAreaHit == None || mTextAreaHit == Slider)
{
mTextAreaHit = Slider;
GuiControl *parent = getParent();
if(!parent)
return;
Point2I camPos = event.mousePoint;
Point2I point = parent->localToGlobalCoord(getPosition());
F32 maxDis = 100;
F32 val;
if(camPos.y < point.y)
{
if((F32)point.y < maxDis)
maxDis = (F32)point.y;
val = point.y - maxDis;
if(point.y > 0)
mMulInc= 1.0f-(((float)camPos.y - val) / maxDis);
else
mMulInc = 1.0f;
checkIncValue();
return;
}
else if(camPos.y > point.y + getExtent().y)
{
GuiCanvas *root = getRoot();
val = (F32)(root->getHeight() - (point.y + getHeight()));
if(val < maxDis)
maxDis = val;
if( val > 0)
mMulInc= -(F32)(camPos.y - (point.y + getHeight()))/maxDis;
else
mMulInc = -1.0f;
checkIncValue();
return;
}
mTextAreaHit = None;
Parent::onMouseDragged(event);
}
}
示例6: getRoot
void ForestEditorCtrl::onSleep()
{
// Pop our default cursor off.
GuiCanvas *root = getRoot();
if ( root )
{
PlatformWindow *window = root->getPlatformWindow();
PlatformCursorController *controller = window->getCursorController();
controller->popCursor();
}
Parent::onSleep();
}
示例7:
GuiElement::~GuiElement()
{
if (owner)
{
owner->elements.remove(this);
//Find the owning cancas, as we need to remove ourselves if we are the focus or click element.
GuiCanvas* canvas = dynamic_cast<GuiCanvas*>(getTopLevelContainer());
if (canvas)
{
canvas->unfocusElement(this);
}
}
}
示例8: getRoot
void GuiTextEditCtrl::setFirstResponder()
{
Parent::setFirstResponder();
GuiCanvas *root = getRoot();
if (root != NULL)
{
root->enableKeyboardTranslation();
// If the native OS accelerator keys are not disabled
// then some key events like Delete, ctrl+V, etc may
// not make it down to us.
root->setNativeAcceleratorsEnabled( false );
}
}
示例9: setVisible
void PostEffectVis::setVisible( bool visible )
{
GuiCanvas *canvas = NULL;
if ( !Sim::findObject( "Canvas", canvas ) )
{
Con::errorf( "PostEffectVis::setVisible, Canvas was not found." );
return;
}
GuiControl *content = _getContentControl();
if ( visible && !content->isAwake() )
canvas->pushDialogControl( content, 100 );
if ( !visible && content->isAwake() )
canvas->popDialogControl( content );
}
示例10: _getContentControl
GuiControl* PostEffectVis::_getContentControl()
{
if ( mContent == NULL )
{
GuiCanvas *canvas = NULL;
if ( !Sim::findObject( "Canvas", canvas ) )
{
AssertFatal( false, "PostEffectVis::_getContentControl, Canvas not found." );
return NULL;
}
mContent = new GuiControl();
mContent->setPosition( 0, 0 );
mContent->setExtent( 1024, 768 );
mContent->setDataField( StringTable->insert( "noCursor" ), NULL, "1" );
mContent->setDataField( StringTable->insert( "profile" ), NULL, "GuiModelessDialogProfile" );
mContent->registerObject( "PfxVisContent" );
canvas->pushDialogControl( mContent, 100 );
}
return mContent;
}
示例11: make3DMouseEvent
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();
}
}