本文整理汇总了C++中ci::gl::Texture::getHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture::getHeight方法的具体用法?C++ Texture::getHeight怎么用?C++ Texture::getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ci::gl::Texture
的用法示例。
在下文中一共展示了Texture::getHeight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImageButtonSpriteRef
KeyBackground::KeyBackground(const Vec2f& initPosition, const ci::gl::Texture& closeKeyboard, const ci::ColorA& color)
:alphaColorPlashka(0.0f),
showing(false),
initPosition(initPosition),
plashkaHeight(592.0f),
bgHeight(1920.0f - 592.0f - initPosition.x),
closeKeyboard(closeKeyboard)
{
#ifdef PORTRAIT_RES
auto positionY = 885.0f - closeKeyboard.getHeight() * 0.5f;
#else
auto positionY = 600.0f - closeKeyboard.getHeight() * 0.5f;
#endif
auto positionX = (1080.0f - closeKeyboard.getWidth()) * 0.5f;
btn = ImageButtonSpriteRef(new ImageButtonSprite(closeKeyboard));
btn->setPosition(initPosition + Vec2f(positionX, positionY));
addChild(btn);
mainColor = color;
}
示例2: init
void SpriteSheet::init(ci::gl::Texture spriteImage, std::string xmlPath, int DataFormat){
__spriteData = SpriteDataParser::parseSpriteData(xmlPath, DataFormat);
__spriteImage = spriteImage;
__currentFrame = 0;
__totalFrames = __spriteData.size();
__textureWidth = spriteImage.getWidth();
__textureHeight = spriteImage.getHeight();
x = 0;
y = 0;
scale = 1.0f;
rotation = 0.0f;
alpha = 1.0f;
}
示例3: update
// Runs update logic
void UiApp::update()
{
// Update frame rate
mFrameRate = getAverageFps();
// Toggle fullscreen
if ( mFullScreen != isFullScreen() ) {
setFullScreen( mFullScreen );
}
// Update device
if ( mLeap && mLeap->isConnected() ) {
mLeap->update();
}
// Interact with first hand
if ( mHands.empty() ) {
mCursorType = CursorType::NONE;
} else {
const Hand& hand = mHands.begin()->second;
// Update cursor position
mCursorPositionTarget = warp( hand.getPosition() );
if ( mCursorType == CursorType::NONE ) {
mCursorPosition = mCursorPositionTarget;
}
// Choose cursor type based on number of exposed fingers
switch ( hand.getFingers().size() ) {
case 0:
mCursorType = CursorType::GRAB;
break;
case 1:
mCursorType = CursorType::TOUCH;
break;
default:
mCursorType = CursorType::HAND;
break;
}
}
// Smooth cursor animation
mCursorPosition = mCursorPosition.lerp( 0.21f, mCursorPositionTarget );
mCursorPosition.z = 0.0f;
// Hit buttons
for ( size_t i = 0; i < 3; ++i ) {
mButtonState[ i ] = false;
if ( mCursorType == CursorType::TOUCH &&
mCursorPosition.distance( mButtonPosition[ i ] ) < (float)mButton[ 0 ].getSize().length() * 0.5f ) {
mButtonState[ i ] = true;
}
}
// Slider
if ( mCursorType == CursorType::GRAB &&
math<float>::abs( mCursorPosition.x - mSliderPosition.x ) < (float)mSlider.getWidth() * 0.5f &&
math<float>::abs( mCursorPosition.y - mSliderPosition.y ) < (float)mSlider.getHeight() * 0.5f ) {
float x1 = mTrackPosition.x;
float x2 = mTrackPosition.x + (float)( mTrack.getWidth() - mSlider.getWidth() );
mSliderPosition.x = math<float>::clamp( mCursorPosition.x, x1, x2 );
}
}