mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 18:40:05 +00:00
Preload font resources
This commit is contained in:
parent
6ff4718ef4
commit
28ea12cbfe
7 changed files with 53 additions and 3 deletions
BIN
scwx-qt/res/fonts/din1451alt_g.ttf
Normal file
BIN
scwx-qt/res/fonts/din1451alt_g.ttf
Normal file
Binary file not shown.
|
|
@ -57,8 +57,10 @@ set(HDR_GL source/scwx/qt/gl/gl.hpp
|
||||||
source/scwx/qt/gl/text_shader.hpp)
|
source/scwx/qt/gl/text_shader.hpp)
|
||||||
set(SRC_GL source/scwx/qt/gl/shader_program.cpp
|
set(SRC_GL source/scwx/qt/gl/shader_program.cpp
|
||||||
source/scwx/qt/gl/text_shader.cpp)
|
source/scwx/qt/gl/text_shader.cpp)
|
||||||
set(HDR_MANAGER source/scwx/qt/manager/radar_manager.hpp)
|
set(HDR_MANAGER source/scwx/qt/manager/radar_manager.hpp
|
||||||
set(SRC_MANAGER source/scwx/qt/manager/radar_manager.cpp)
|
source/scwx/qt/manager/resource_manager.hpp)
|
||||||
|
set(SRC_MANAGER source/scwx/qt/manager/radar_manager.cpp
|
||||||
|
source/scwx/qt/manager/resource_manager.cpp)
|
||||||
set(HDR_MAP source/scwx/qt/map/map_widget.hpp
|
set(HDR_MAP source/scwx/qt/map/map_widget.hpp
|
||||||
source/scwx/qt/map/overlay_layer.hpp
|
source/scwx/qt/map/overlay_layer.hpp
|
||||||
source/scwx/qt/map/radar_layer.hpp
|
source/scwx/qt/map/radar_layer.hpp
|
||||||
|
|
|
||||||
|
|
@ -7,5 +7,6 @@
|
||||||
<file>gl/text.frag</file>
|
<file>gl/text.frag</file>
|
||||||
<file>gl/text.vert</file>
|
<file>gl/text.vert</file>
|
||||||
<file>res/fonts/din1451alt.ttf</file>
|
<file>res/fonts/din1451alt.ttf</file>
|
||||||
|
<file>res/fonts/din1451alt_g.ttf</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
#include "main_window.hpp"
|
#include <scwx/qt/main/main_window.hpp>
|
||||||
|
#include <scwx/qt/manager/resource_manager.hpp>
|
||||||
|
|
||||||
#include <boost/log/expressions.hpp>
|
#include <boost/log/expressions.hpp>
|
||||||
#include <boost/log/trivial.hpp>
|
#include <boost/log/trivial.hpp>
|
||||||
|
|
@ -9,6 +10,8 @@ int main(int argc, char* argv[])
|
||||||
boost::log::core::get()->set_filter(boost::log::trivial::severity >=
|
boost::log::core::get()->set_filter(boost::log::trivial::severity >=
|
||||||
boost::log::trivial::debug);
|
boost::log::trivial::debug);
|
||||||
|
|
||||||
|
scwx::qt::manager::ResourceManager::PreLoad();
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
scwx::qt::main::MainWindow w;
|
scwx::qt::main::MainWindow w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|
|
||||||
28
scwx-qt/source/scwx/qt/manager/resource_manager.cpp
Normal file
28
scwx-qt/source/scwx/qt/manager/resource_manager.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
#include <scwx/qt/manager/resource_manager.hpp>
|
||||||
|
#include <scwx/qt/util/font.hpp>
|
||||||
|
|
||||||
|
namespace scwx
|
||||||
|
{
|
||||||
|
namespace qt
|
||||||
|
{
|
||||||
|
namespace manager
|
||||||
|
{
|
||||||
|
namespace ResourceManager
|
||||||
|
{
|
||||||
|
static void LoadFonts();
|
||||||
|
|
||||||
|
void PreLoad()
|
||||||
|
{
|
||||||
|
LoadFonts();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void LoadFonts()
|
||||||
|
{
|
||||||
|
util::Font::Create(":/res/fonts/din1451alt.ttf");
|
||||||
|
util::Font::Create(":/res/fonts/din1451alt_g.ttf");
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ResourceManager
|
||||||
|
} // namespace manager
|
||||||
|
} // namespace qt
|
||||||
|
} // namespace scwx
|
||||||
15
scwx-qt/source/scwx/qt/manager/resource_manager.hpp
Normal file
15
scwx-qt/source/scwx/qt/manager/resource_manager.hpp
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace scwx
|
||||||
|
{
|
||||||
|
namespace qt
|
||||||
|
{
|
||||||
|
namespace manager
|
||||||
|
{
|
||||||
|
namespace ResourceManager
|
||||||
|
{
|
||||||
|
void PreLoad();
|
||||||
|
} // namespace ResourceManager
|
||||||
|
} // namespace manager
|
||||||
|
} // namespace qt
|
||||||
|
} // namespace scwx
|
||||||
|
|
@ -250,6 +250,7 @@ std::shared_ptr<Font> Font::Create(const std::string& resource)
|
||||||
auto it = fontMap_.find(resource);
|
auto it = fontMap_.find(resource);
|
||||||
if (it != fontMap_.end())
|
if (it != fontMap_.end())
|
||||||
{
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(debug) << logPrefix_ << "Font already created";
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue