本文整理汇总了C++中ImageManager类的典型用法代码示例。如果您正苦于以下问题:C++ ImageManager类的具体用法?C++ ImageManager怎么用?C++ ImageManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImageManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clean
void PreviewToggleCommand::clean() {
// Release all previewed images
if (m_sl) {
int i, fidsCount = m_fids.size();
for (i = 0; i < fidsCount; ++i) {
const TFrameId &fid = m_fids[i];
int status = m_sl->getFrameStatus(fid);
if (status & TXshSimpleLevel::CleanupPreview) {
// Preview images are not just invalidated, but *unbound* from the IM.
// This is currently done hard here - should be skipped to m_sl,
// though...
ImageManager *im = ImageManager::instance();
im->unbind(m_sl->getImageId(fid, TXshSimpleLevel::CleanupPreview));
IconGenerator::instance()->remove(m_sl.getPointer(), fid);
m_sl->setFrameStatus(fid, status & ~TXshSimpleLevel::CleanupPreview);
}
}
}
m_sl = TXshSimpleLevelP();
m_fids.clear();
}
示例2: UpdatesImage
/**
* Se actualizan las imagenes nuevas y las viejas.
*/
void Console::UpdatesImage()
{
ImageManager* iManager = ImageManager::GetInstance();
pListUpdate listUpdate= iManager->UpdateImages();
tVecStr* removeList= listUpdate.first;
tVecStr* addList= listUpdate.second;
if (removeList->size()!=0)
{
cout<< MSG_DELETED_DIRECTORIES;
}
for(unsigned int i=0;i<removeList->size(); i++)
{
std::cout<< "\t" << CIRCLE << (*removeList)[i]<<"\n";
}
if (addList->size()!=0)
{
cout<< MSG_ADDED_DIRECTORIES;
}
for(unsigned int i=0;i<addList->size(); i++)
{
std::cout<< "\t" << CIRCLE << (*addList)[i]<<"\n";
}
std::cout << "\n";
delete addList;
delete removeList;
}
示例3:
void Image::setBitmap(std::string const & imagePath)
{
ImageManager *imageManager;
imageManager = ImageManager::getInstance();
this->bitmap = imageManager->load(imagePath);
}
示例4: init
void GameOver::init()
{
ImageManager* im = Locator::getImageManager();
_texture = im->getTexture(IMAGES_PATH"gameover.png");
assert(_texture != NULL);
_sprite.setTexture(*_texture, true);
}
示例5: 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);
}
示例6: LoadResources
void SkImageManager::LoadResources(const RuntimeScene & scene, const ImageManager & imageMgr)
{
UnloadAllImages();
while(m_needToBeLoaded.size() > 0)
{
if(imageMgr.HasImage(m_needToBeLoaded.front()))
{
m_images[m_needToBeLoaded.front()] = imageMgr.GetSFMLTexture(m_needToBeLoaded.front());
}
m_needToBeLoaded.pop();
}
}
示例7: TEST
TEST(ImageManager, NotifiesRequestorImmediatelyIfDependenciesAreSatisfied) {
ImageManager imageManager;
StubImageRequestor requestor;
bool notified = false;
requestor.imagesAvailable = [&] (ImageMap) {
notified = true;
};
uint64_t imageCorrelationID = 0;
imageManager.addImage(makeMutable<style::Image::Impl>("one", PremultipliedImage({ 16, 16 }), 2));
imageManager.getImages(requestor, std::make_pair(std::set<std::string> {"one"}, imageCorrelationID));
ASSERT_TRUE(notified);
}
示例8:
Carte::Carte(ImageManager &IM, std::string adr1, std::string adr2, std::string adr3,int w,int h)
{
//hb = new Hitbox(IM,adr);
Iinf.SetImage(*(IM.GetImage(adr1)));
Isup.SetImage(*(IM.GetImage(adr2)));
hitbox.SetImage(*(IM.GetImage(adr3)));
Iinf.Resize(w,h);
Isup.Resize(w,h);
hitbox.Resize(w,h);
}
示例9: 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"));
}
}
示例10: levelInfoRender
/////////////////////LEVEL SELECT/////////////////////
LevelPlaySelect::LevelPlaySelect(ImageManager& imageManager, SDL_Renderer& renderer)
:LevelSelect(imageManager,renderer,_("Select Level")),
levelInfoRender(imageManager,renderer,getDataPath(),*fontText,themeTextColor){
//Load the play button if needed.
playButtonImage=imageManager.loadTexture(getDataPath()+"gfx/playbutton.png", renderer);
//Create the gui.
createGUI(imageManager,renderer, true);
//Show level list
refresh(imageManager,renderer);
}
示例11: ArenaDocument
TileMap::TileMap(string sourceFile, ImageManager &ImageManager_)
{
//Load the XML source file.
string str = "Data/Arenas/";
str = str + sourceFile;
TiXmlDocument ArenaDocument(str.c_str());
if(!ArenaDocument.LoadFile())
{
cerr<<"Error while loading "<<sourceFile<<endl;
cerr<<ArenaDocument.ErrorDesc()<<endl;
}
TiXmlHandle ArenaHandle(&ArenaDocument);
//Load the tile set.
TiXmlNode* TileSetNode = ArenaHandle.FirstChild("Arena").FirstChild("TileSet").ToNode();
TiXmlElement* TileElement = NULL;
while(TileSetNode->IterateChildren("Tile", TileElement) != NULL)
{
TileElement = TileSetNode->IterateChildren("Tile", TileElement)->ToElement();
str = "Data/Tiles/";
str = str + TileElement->Attribute("file");
TileSet.push_back(Tile(ImageManager_.Get(str)));
TileSet.back().sourceFile = str;
if(strcmp(TileElement->Attribute("isBlockingCharacters"),"true") == 0)
{
TileSet.back().blocksCharacters = true;
}
else
TileSet.back().blocksCharacters = false;
if(strcmp(TileElement->Attribute("isBlockingSpells"), "true") == 0)
TileSet.back().blocksSpells = true;
else
TileSet.back().blocksSpells = false;
}
//Load the tile map.
TiXmlNode* MapNode = ArenaHandle.FirstChildElement("Arena").FirstChild("Map").ToNode();
TiXmlElement* Line = NULL;
string tileLine;
int temp;
while(MapNode->IterateChildren("Line", Line) != NULL)
{
Line = MapNode->IterateChildren("Line", Line)->ToElement();
tileLine = Line->Attribute("TileLine");
Tiles.push_back(vector<int>(tileLine.size()));
for(int i=0; i<tileLine.size(); i++)
{
temp = tileLine.c_str()[i] - '0';
Tiles.back()[i] = temp;
}
}
}
示例12: getTileset
bool Map::getTileset(const ImageManager& img){
tileset = img.getImagePtr(handle);
//tileset->SetSmooth(false);
if(tileset == NULL) return false;
for(int i=0;i<mWidth*mHeight;i++){
grid[i].img.SetImage(*tileset);
int y = i / mWidth;
int x = i - (y*mWidth);
grid[i].img.SetX((float) x*16);
grid[i].img.SetY((float) y*16);
y = grid[i].tileId / 9;
x = grid[i].tileId - (y * 9) - 1;
y = y * 16 + 2 + y;
x = x * 16 + 2 + x;
grid[i].img.SetSubRect(sf::IntRect(x,y,x+16,y+16));
}
return true;
}
示例13: lk
irr::video::ITexture* ImageManager::GetFieldTexture(int code, int player) {
if(code == 0)
return NULL;
ScopedLock lk(mutex);
int fieldcode = code + player;
auto tit = tSpellFields.find(fieldcode);
if(tit == tSpellFields.end()) {
irr::video::ITexture* rt = 0;
rt = driver->addRenderTargetTexture(core::dimension2d<u32>(512,512));
driver->setRenderTarget(rt, false, false, video::SColor(0,0,0,255));
ITexture *texture = imageManager.GetTextureField(code);
if(texture)
driver->draw2DImage(texture, irr::core::rect<s32>(0,0,512,512),player == 0 ? irr::core::rect<s32>(0,256,512,512) : irr::core::rect<s32>(0,0,512,256));
driver->setRenderTarget(0, false, false, 0);
tSpellFields[fieldcode] = rt;
return rt;
}
if(tit->second)
return tit->second;
return NULL;
}
示例14: load
fcn::Image* GuiImageLoader::load(const std::string& filename, bool convertToDisplayFormat) {
ImageManager* imgManager = ImageManager::instance();
if(imgManager->exists(filename)) {
return new GuiImage(imgManager->get(filename));
}
// load demanded image
ImagePtr tmpimg = imgManager->load(filename);
if(tmpimg->getWidth() >= ATLAS_SIZE || tmpimg->getHeight() >= ATLAS_SIZE) {
return new GuiImage(tmpimg);
}
// look for a place for an image of given size
AtlasBlock* block = m_atlasbook->getBlock(tmpimg->getWidth(), tmpimg->getHeight());
// if it can't fit, we need to add new 'page'
if(block->page >= m_atlases.size()) {
m_atlases.push_back(imgManager->loadBlank(ATLAS_SIZE, ATLAS_SIZE));
// because we gonna update texture on-the fly (via TexSubImage)
// we cant really use compressed texture
RenderBackend* rb = RenderBackend::instance();
bool prev = rb->isImageCompressingEnabled();
rb->setImageCompressingEnabled(false);
m_atlases[block->page]->forceLoadInternal();
rb->setImageCompressingEnabled(prev);
}
// update atlas page with given image
m_atlases[block->page]->copySubimage(block->left, block->top, tmpimg);
// we dont really need this image anymore
tmpimg->free();
imgManager->remove(tmpimg);
// create shared image and return it
ImagePtr img = imgManager->create(filename);
Rect region(block->left, block->top, block->getWidth(), block->getHeight());
img->useSharedImage(m_atlases[block->page], region);
return new GuiImage(img);
}
示例15: updateImageSize
void ToolbarButton::updateImageSize(ImageManager& im){
imageSize = (sf::Vector2f)(*im.getImage(filename)).getSize();
}