本文整理汇总了C++中ImageManager::getTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageManager::getTexture方法的具体用法?C++ ImageManager::getTexture怎么用?C++ ImageManager::getTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageManager
的用法示例。
在下文中一共展示了ImageManager::getTexture方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
/** \brief Initialize textures and sprites
*
* \return void
*
*/
void SplashScreen::init()
{
ImageManager* im = Locator::getImageManager();
_splashTexture = im->getTexture(IMAGES_PATH"splashscreen.png");
assert(_splashTexture != NULL);
_splash.setTexture(*_splashTexture, true);
}
示例2: init
void GameOver::init()
{
ImageManager* im = Locator::getImageManager();
_texture = im->getTexture(IMAGES_PATH"gameover.png");
assert(_texture != NULL);
_sprite.setTexture(*_texture, true);
}
示例3: initInterface
void UserInterface::initInterface(Screen newScreen, ImageManager& imageManager)
{
// Clearing the previous UI elements
elements.clear();
// Updating the screenstate
screenState = newScreen;
// Populating the screen based on the input
switch(newScreen)
{
case Screen::TITLE:
elements["exitButton"] = InterfaceElement(resolution.x - 150, resolution.y - 50,"exit",font,10,10);
elements["exitButton"].sprite.setTexture(imageManager.getTexture("button"));
elements["startButton"] = InterfaceElement(50,resolution.y - 50,"start",font,10,10);
elements["startButton"].sprite.setTexture(imageManager.getTexture("button"));
elements["titleText"] = InterfaceElement(resolution.x / 2 - 150, 50, "BoulderDash",font,0,0);
backgroundSprite.setTexture(imageManager.getTexture("titleBG"));
break;
case Screen::PLAY:
elements["livesText"] = InterfaceElement(0,0,"",font,64,0,true);
elements["livesText"].headerText.setColor(sf::Color::Transparent);
elements["diamondsText"] = InterfaceElement(0,0,"",font,64,0,true);
elements["diamondsText"].headerText.setColor(sf::Color::Transparent);
backgroundSprite.setTexture(sf::Texture());
break;
case Screen::GAMEOVER:
elements["endText"] = InterfaceElement(resolution.x / 2 - 150, 50, "Game Over",font,0,0);
backgroundSprite.setTexture(imageManager.getTexture("endBG"));
break;
case Screen::WIN:
elements["winText"] = InterfaceElement(resolution.x / 2 - 150, 50, "Congratulations!",font,0,0);
elements["winText"].headerText.setColor(sf::Color::Green);
backgroundSprite.setTexture(imageManager.getTexture("titleBG"));
}
}