本文整理汇总了C++中ci::gl::Texture::getBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture::getBounds方法的具体用法?C++ Texture::getBounds怎么用?C++ Texture::getBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ci::gl::Texture
的用法示例。
在下文中一共展示了Texture::getBounds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
// Runs update logic
void UiApp::update()
{
// Update frame rate
mFrameRate = getAverageFps();
// Toggle fullscreen
if ( mFullScreen != isFullScreen() ) {
setFullScreen( mFullScreen );
}
// Interact with first hand
const Leap::HandList& hands = mFrame.hands();
if ( hands.isEmpty() ) {
mCursorType = CursorType::NONE;
} else {
const Leap::Hand& hand = *hands.begin();
// Update cursor position
mCursorPositionTarget = warpVector( hand.palmPosition() );
if ( mCursorType == CursorType::NONE ) {
mCursorPosition = mCursorPositionTarget;
}
// Choose cursor type based on number of exposed fingers
switch ( hand.fingers().count() ) {
case 0:
mCursorType = CursorType::GRAB;
// Slider
if ( mSlider.getBounds().contains( mCursorPosition - mSliderPosition ) ) {
float x1 = mTrackPosition.x;
float x2 = mTrackPosition.x + (float)( mTrack.getWidth() - mSlider.getWidth() );
mSliderPosition.x = math<float>::clamp( mCursorPosition.x, x1, x2 );
}
break;
case 1:
mCursorType = CursorType::TOUCH;
// Buttons
mFingerTipPosition = warpPointable( *hand.fingers().begin() );
for ( size_t i = 0; i < 3; ++i ) {
mButtonState[ i ] = false;
if ( mButton[ 0 ].getBounds().contains( mFingerTipPosition - mButtonPosition[ i ] ) ) {
mButtonState[ i ] = true;
}
}
break;
default:
mCursorType = CursorType::HAND;
break;
}
}
// Smooth cursor animation
mCursorPosition = mCursorPosition.lerp( 0.21f, mCursorPositionTarget );
}
示例2: draw
void MovieLoaderTestApp::draw()
{
// clear out the window with black
gl::clear( Color( 0, 0, 0 ) );
if (!mMovieSelected) return;
if (mTexture) {
Rectf centeredRect = Rectf( mTexture.getBounds() ).getCenteredFit( getWindowBounds(), true );
gl::draw(mTexture, centeredRect);
}
}