UpdatableTile* TiledLayerChromium::createTile(int i, int j) { OwnPtr<UpdatableTile> tile(UpdatableTile::create(textureUpdater()->createTexture(textureManager()))); UpdatableTile* addedTile = tile.get(); m_tiler->addTile(tile.release(), i, j); addedTile->m_dirtyRect = m_tiler->tileRect(addedTile); return addedTile; }
UpdatableTile* TiledLayerChromium::createTile(int i, int j) { RefPtr<UpdatableTile> tile; if (m_unusedTiles.size() > 0) { tile = m_unusedTiles.last().release(); m_unusedTiles.removeLast(); ASSERT(tile->refCount() == 1); } else { TextureManager* manager = textureManager(); tile = adoptRef(new UpdatableTile(ManagedTexture::create(manager))); } m_tiler->addTile(tile, i, j); tile->m_dirtyLayerRect = m_tiler->tileLayerRect(tile.get()); return tile.get(); }
int main() { std::cout << "Hello world!" << std::endl; srand(time(0)); sf::RenderWindow win = {videoMode, "STU", sf::Style::Close, sf::ContextSettings(0,0,8)}; sf::Time prev_show_t; sf::Clock showClock; TextureManager textureManager("textures/"); Game game(textureManager); <<<<<<< HEAD
void CArchiveBuilder::Build(const OsPath& archive, bool compress) { // By default we disable zip compression because it significantly hurts download // size for releases (which re-compress all files with better compression // algorithms) - it's probably most important currently to optimise for // download size rather than install size or startup performance. // (See http://trac.wildfiregames.com/ticket/671) const bool noDeflate = !compress; PIArchiveWriter writer = CreateArchiveWriter_Zip(archive, noDeflate); // Use CTextureManager instead of CTextureConverter directly, // so it can deal with all the loading of settings.xml files CTextureManager textureManager(m_VFS, true, true); CColladaManager colladaManager(m_VFS); CXeromyces xero; for (size_t i = 0; i < m_Files.size(); ++i) { Status ret; const VfsPath path = m_Files[i]; OsPath realPath; ret = m_VFS->GetRealPath(path, realPath); ENSURE(ret == INFO::OK); // Compress textures and store the new cached version instead of the original if ((boost::algorithm::starts_with(path.string(), L"art/textures/") || boost::algorithm::starts_with(path.string(), L"fonts/") ) && tex_is_known_extension(path) && // Skip some subdirectories where the engine doesn't use CTextureManager yet: !boost::algorithm::starts_with(path.string(), L"art/textures/cursors/") && !boost::algorithm::starts_with(path.string(), L"art/textures/terrain/alphamaps/") ) { VfsPath cachedPath; debug_printf(L"Converting texture %ls\n", realPath.string().c_str()); bool ok = textureManager.GenerateCachedTexture(path, cachedPath); ENSURE(ok); OsPath cachedRealPath; ret = m_VFS->GetRealPath(VfsPath("cache")/cachedPath, cachedRealPath); ENSURE(ret == INFO::OK); writer->AddFile(cachedRealPath, cachedPath); // We don't want to store the original file too (since it's a // large waste of space), so skip to the next file continue; } // Convert DAE models and store the new cached version instead of the original if (path.Extension() == L".dae") { CColladaManager::FileType type; if (boost::algorithm::starts_with(path.string(), L"art/meshes/")) type = CColladaManager::PMD; else if (boost::algorithm::starts_with(path.string(), L"art/animation/")) type = CColladaManager::PSA; else { // Unknown type of DAE, just add to archive and continue writer->AddFile(realPath, path); continue; } VfsPath cachedPath; debug_printf(L"Converting model %ls\n", realPath.string().c_str()); bool ok = colladaManager.GenerateCachedFile(path, type, cachedPath); // The DAE might fail to convert for whatever reason, and in that case // it can't be used in the game, so we just exclude it // (alternatively we could throw release blocking errors on useless files) if (ok) { OsPath cachedRealPath; ret = m_VFS->GetRealPath(VfsPath("cache")/cachedPath, cachedRealPath); ENSURE(ret == INFO::OK); writer->AddFile(cachedRealPath, cachedPath); } // We don't want to store the original file too (since it's a // large waste of space), so skip to the next file continue; } debug_printf(L"Adding %ls\n", realPath.string().c_str()); writer->AddFile(realPath, path); // Also cache XMB versions of all XML files if (path.Extension() == L".xml") { VfsPath cachedPath; debug_printf(L"Converting XML file %ls\n", realPath.string().c_str()); bool ok = xero.GenerateCachedXMB(m_VFS, path, cachedPath); ENSURE(ok); OsPath cachedRealPath; ret = m_VFS->GetRealPath(VfsPath("cache")/cachedPath, cachedRealPath); ENSURE(ret == INFO::OK); writer->AddFile(cachedRealPath, cachedPath); } } }
UpdatableTile* TiledLayerChromium::createTile(int i, int j) { RefPtr<UpdatableTile> tile = adoptRef(new UpdatableTile(textureUpdater()->createTexture(textureManager()))); m_tiler->addTile(tile, i, j); tile->m_dirtyRect = m_tiler->tileRect(tile.get()); return tile.get(); }