mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 23:00:04 +00:00
Add ImGui Font class and dedicated Font Manager
This commit is contained in:
parent
d1a478ad12
commit
190bd95781
5 changed files with 205 additions and 2 deletions
45
scwx-qt/source/scwx/qt/manager/font_manager.cpp
Normal file
45
scwx-qt/source/scwx/qt/manager/font_manager.cpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#include <scwx/qt/manager/font_manager.hpp>
|
||||
#include <scwx/util/logger.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace manager
|
||||
{
|
||||
|
||||
static const std::string logPrefix_ = "scwx::qt::manager::font_manager";
|
||||
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
||||
|
||||
class FontManager::Impl
|
||||
{
|
||||
public:
|
||||
explicit Impl() {}
|
||||
~Impl() {}
|
||||
};
|
||||
|
||||
FontManager::FontManager() : p(std::make_unique<Impl>()) {}
|
||||
|
||||
FontManager::~FontManager() {};
|
||||
|
||||
std::shared_ptr<FontManager> FontManager::Instance()
|
||||
{
|
||||
static std::weak_ptr<FontManager> fontManagerReference_ {};
|
||||
static std::mutex instanceMutex_ {};
|
||||
|
||||
std::unique_lock lock(instanceMutex_);
|
||||
|
||||
std::shared_ptr<FontManager> fontManager = fontManagerReference_.lock();
|
||||
|
||||
if (fontManager == nullptr)
|
||||
{
|
||||
fontManager = std::make_shared<FontManager>();
|
||||
fontManagerReference_ = fontManager;
|
||||
}
|
||||
|
||||
return fontManager;
|
||||
}
|
||||
|
||||
} // namespace manager
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
31
scwx-qt/source/scwx/qt/manager/font_manager.hpp
Normal file
31
scwx-qt/source/scwx/qt/manager/font_manager.hpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
|
||||
#include <scwx/qt/types/imgui_font.hpp>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace manager
|
||||
{
|
||||
|
||||
class FontManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FontManager();
|
||||
~FontManager();
|
||||
|
||||
static std::shared_ptr<FontManager> Instance();
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace manager
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
Loading…
Add table
Add a link
Reference in a new issue