本文整理汇总了C++中AnimatedSprite::SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimatedSprite::SetPosition方法的具体用法?C++ AnimatedSprite::SetPosition怎么用?C++ AnimatedSprite::SetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimatedSprite
的用法示例。
在下文中一共展示了AnimatedSprite::SetPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
default: break;
}
break;
case sf::Event::MouseButtonReleased:
if( ev.MouseButton.Button == sf::Mouse::Right ) {
if( vpMouseScroller ) {
delete vpMouseScroller;
vpMouseScroller = 0;
win.ShowMouseCursor(true);
}
} else if( ev.MouseButton.Button == sf::Mouse::Left ) {
kittenMode = !kittenMode;
}
break;
case sf::Event::MouseButtonPressed:
if( ev.MouseButton.Button == sf::Mouse::Right ) {
if( !vpMouseScroller ) {
win.ShowMouseCursor(false);
vpMouseScroller = new ViewportMouseScroller( viewport, win.GetInput() );
}
} else if( ev.MouseButton.Button == sf::Mouse::Left ) {
if( blitter.getTGMode() ) {
int x = win.GetInput().GetMouseX(),
y = win.GetInput().GetMouseY();
if( viewport.translateCoordinates( x, y ) ) {
grid.screenToHex( x, y, 0, 0 );
if( myTorusMap.putWouldBeLegal( x, y, myCurrentColour ) ) {
myTorusMap.put( x, y, myCurrentColour );
myCurrentColour = ( myCurrentColour == HtGoTile::BLACK ) ? HtGoTile::WHITE : HtGoTile::BLACK;
} else {
failSound.Play();
}
}
}
}
break;
case sf::Event::MouseMoved:
if( vpMouseScroller ) {
vpMouseScroller->scroll();
} else {
int x = win.GetInput().GetMouseX(),
y = win.GetInput().GetMouseY();
int ix, iy;
ix = x;
iy = y;
if( viewport.translateCoordinates( ix, iy ) ) {
grid.screenToHex( ix, iy, 0, 0 );
blitter.setSelected( ix, iy );
int selectedHexX = ix, selectedHexY = iy;
if( flattenHexCoordinate( selectedHexX, selectedHexY ) == 42 ) {
sf::FloatRect rect = fitRectangleAt( x, y, sf::FloatRect( 0, 0, win.GetWidth(), win.GetHeight() ), kittenImage.GetWidth(), kittenImage.GetHeight() );
showingKitten = true;
kittenBlink.SetPosition( rect.Left, rect.Top );
rect = fitRectangleAt( x, y, sf::FloatRect( 0, 0, win.GetWidth(), win.GetHeight() ), textPopup->GetWidth(), textPopup->GetHeight() );
textSprite.SetPosition( rect.Left, rect.Top );
textBackgroundBox = sf::Shape::Rectangle( rect.Left, rect.Top, rect.Right, rect.Bottom, sf::Color(64,64,64) );
} else {
showingKitten = false;
}
}
}
break;
default: break; // shuts up g++
}
win.Clear( sf::Color(0,100,0) );
viewport.draw( blitter, win, mainView );
mainView.SetFromRect( sf::FloatRect( 0, 0, win.GetWidth(), win.GetHeight() ) );
helloWorldSprite.setPosition(0,0);
helloWorldSprite.noRestrictToWidth();
helloWorldSprite.draw( win );
helloWorldSprite.setPosition(0,100);
helloWorldSprite.restrictToWidth(320);
helloWorldSprite.draw( win );
chatbox.draw( win );
if( chatInput ) {
chatInput->setPosition( 0, win.GetHeight() - chatbox.getHeight() - chatInput->getHeight() );
chatInput->draw( win );
}
if( showingKitten ) {
if( kittenMode ) {
win.Draw( kittenBlink );
} else {
win.Draw( textBackgroundBox );
win.Draw( textSprite );
}
}
win.Display();
}
delete textPopup;
return 0;
}