mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:40:05 +00:00
First pass fixes from discussions. Mostly linter fixes
This commit is contained in:
parent
91b4d6c2c2
commit
dc284974b3
14 changed files with 107 additions and 74 deletions
|
|
@ -203,9 +203,7 @@ void MarkerManager::Impl::ReadMarkerSettings()
|
|||
}
|
||||
}
|
||||
|
||||
util::TextureAtlas& textureAtlas = util::TextureAtlas::Instance();
|
||||
textureAtlas.BuildAtlas(
|
||||
2048, 2048); // Should this code be moved to ResourceManager?
|
||||
ResourceManager::BuildAtlas();
|
||||
|
||||
logger_->debug("{} location marker entries", markerRecords_.size());
|
||||
}
|
||||
|
|
@ -239,7 +237,7 @@ MarkerManager::Impl::GetMarkerByName(const std::string& name)
|
|||
|
||||
MarkerManager::MarkerManager() : p(std::make_unique<Impl>(this))
|
||||
{
|
||||
const std::vector<types::MarkerIconInfo> defaultMarkerIcons_ {
|
||||
static const std::vector<types::MarkerIconInfo> defaultMarkerIcons_ {
|
||||
types::MarkerIconInfo(types::ImageTexture::LocationMarker, -1, -1),
|
||||
types::MarkerIconInfo(types::ImageTexture::LocationPin, 6, 16),
|
||||
types::MarkerIconInfo(types::ImageTexture::LocationCrosshair, -1, -1),
|
||||
|
|
@ -256,7 +254,7 @@ MarkerManager::MarkerManager() : p(std::make_unique<Impl>(this))
|
|||
p->InitializeMarkerSettings();
|
||||
|
||||
boost::asio::post(p->threadPool_,
|
||||
[this, defaultMarkerIcons_]()
|
||||
[this]()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -454,9 +452,7 @@ void MarkerManager::add_icon(const std::string& name, bool startup)
|
|||
|
||||
if (!startup)
|
||||
{
|
||||
util::TextureAtlas& textureAtlas = util::TextureAtlas::Instance();
|
||||
textureAtlas.BuildAtlas(
|
||||
2048, 2048); // Should this code be moved to ResourceManager?
|
||||
ResourceManager::BuildAtlas();
|
||||
Q_EMIT IconAdded(name);
|
||||
}
|
||||
}
|
||||
|
|
@ -465,9 +461,10 @@ std::optional<types::MarkerIconInfo>
|
|||
MarkerManager::get_icon(const std::string& name)
|
||||
{
|
||||
const std::shared_lock lock(p->markerIconsLock_);
|
||||
if (p->markerIcons_.contains(name))
|
||||
auto it = p->markerIcons_.find(name);
|
||||
if (it != p->markerIcons_.end())
|
||||
{
|
||||
return p->markerIcons_.at(name);
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ namespace ResourceManager
|
|||
static const std::string logPrefix_ = "scwx::qt::manager::resource_manager";
|
||||
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
||||
|
||||
static const size_t atlasWidth = 2048;
|
||||
static const size_t atlasHeight = 2048;
|
||||
|
||||
static void LoadFonts();
|
||||
static void LoadTextures();
|
||||
|
||||
|
|
@ -68,8 +71,7 @@ LoadImageResources(const std::vector<std::string>& urlStrings)
|
|||
|
||||
if (!images.empty())
|
||||
{
|
||||
util::TextureAtlas& textureAtlas = util::TextureAtlas::Instance();
|
||||
textureAtlas.BuildAtlas(2048, 2048);
|
||||
BuildAtlas();
|
||||
}
|
||||
|
||||
return images;
|
||||
|
|
@ -103,7 +105,13 @@ static void LoadTextures()
|
|||
GetTexturePath(lineTexture));
|
||||
}
|
||||
|
||||
textureAtlas.BuildAtlas(2048, 2048);
|
||||
BuildAtlas();
|
||||
}
|
||||
|
||||
void BuildAtlas()
|
||||
{
|
||||
util::TextureAtlas& textureAtlas = util::TextureAtlas::Instance();
|
||||
textureAtlas.BuildAtlas(atlasWidth, atlasHeight);
|
||||
}
|
||||
|
||||
} // namespace ResourceManager
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ std::shared_ptr<boost::gil::rgba8_image_t>
|
|||
LoadImageResource(const std::string& urlString);
|
||||
std::vector<std::shared_ptr<boost::gil::rgba8_image_t>>
|
||||
LoadImageResources(const std::vector<std::string>& urlStrings);
|
||||
void BuildAtlas();
|
||||
|
||||
} // namespace ResourceManager
|
||||
} // namespace manager
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue