GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
font_loader.cpp
[詳解]
1
3
4// Copyright(c) 2023-2025 Design Engineering Laboratory, Saitama University
5// Released under the MIT license
6// https://opensource.org/licenses/mit-license.php
7
8#include "font_loader.h"
9
10#include <DxLib.h>
11
12
13namespace designlab
14{
15
16int FontLoader::GetFontHandle(const std::string& file_path)
17{
18 // すでに読み込み済みのフォントの場合は,ハンドル番号を返す.
19 if (font_handle_map_.count(file_path) != 0)
20 {
21 return font_handle_map_[file_path];
22 }
23
24 // フォントを読み込む.
25 int handle = CreateFontToHandle(file_path.c_str(), 16, 1);
26
27 // 読み込みに失敗した場合は-1を返す.
28 if (handle == -1)
29 {
30 return -1;
31 }
32
33 // 読み込みに成功した場合は,対応表に追加する.
34 font_handle_map_[file_path] = handle;
35
36 return handle;
37}
38
39} // namespace designlab
int GetFontHandle(const std::string &file_path)
Dxlibでは特定のフォントで描画する際に,フォントのハンドルを指定する. この関数では,フォントのファイルパスを指定すると, フォントのハンドル番号を返す. フォントがまだ読み込まれていない場...