Skip to content

Commit

Permalink
perf: 保存字体数据在内存中而不是每次进入全屏时都会读取
Browse files Browse the repository at this point in the history
3D 游戏模式下不使用鼠标钩子
  • Loading branch information
Blinue committed May 7, 2022
1 parent edc2a31 commit bb73e2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Runtime/ImGuiImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ bool ImGuiImpl::Initialize() {
}

// 断点模式下不注册鼠标钩子,否则调试时鼠标无法使用
if (!App::Get().GetConfig().IsBreakpointMode()) {
if (!App::Get().GetConfig().IsBreakpointMode() && !App::Get().GetConfig().Is3DMode()) {
_hHookThread = CreateThread(nullptr, 0, ThreadProc, nullptr, 0, &_hookThreadId);
if (!_hHookThread) {
Logger::Get().Win32Error("创建线程失败");
Expand Down
10 changes: 6 additions & 4 deletions Runtime/OverlayDrawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,12 @@ bool OverlayDrawer::Initialize() {
style.WindowMinSize = ImVec2(10, 10);
style.ScaleAllSizes(_dpiScale);

std::vector<BYTE> fontData;
if (!Utils::ReadFile(L".\\assets\\NotoSansSC-Regular.otf", fontData)) {
Logger::Get().Error("读取字体文件失败");
return false;
static std::vector<BYTE> fontData;
if (fontData.empty()) {
if (!Utils::ReadFile(L".\\assets\\NotoSansSC-Regular.otf", fontData)) {
Logger::Get().Error("读取字体文件失败");
return false;
}
}

ImFontConfig config;
Expand Down

0 comments on commit bb73e2d

Please sign in to comment.