KisaragiLibrary
 
読み取り中…
検索中…
一致する文字列を見つけられません
FontFacade.hpp
[詳解]
1#pragma once
3#include <string>
4#include <memory>
5#include "DxLib.h"
6
7namespace Kisaragi_Lib
8{
9
12
14 {
15 NORMAL = DX_FONTTYPE_NORMAL, //ノーマルフォント(デフォルト)
16 EDGE = DX_FONTTYPE_EDGE, //エッジつきフォント
17 ANTIALIASING = DX_FONTTYPE_ANTIALIASING, //アンチエイリアスフォント
18 ANTIALIASING_4X4 = DX_FONTTYPE_ANTIALIASING_4X4, //アンチエイリアスフォント( 4x4サンプリング )
19 ANTIALIASING_8X8 = DX_FONTTYPE_ANTIALIASING_8X8, //アンチエイリアスフォント( 8x8サンプリング )
20 ANTIALIASING_16X16 = DX_FONTTYPE_ANTIALIASING_16X16, //アンチエイリアスフォント( 16x16サンプリング )
21 ANTIALIASING_EDGE = DX_FONTTYPE_ANTIALIASING_EDGE, //アンチエイリアス&エッジ付きフォント
22 ANTIALIASING_EDGE_4X4 = DX_FONTTYPE_ANTIALIASING_EDGE_4X4, //アンチエイリアス&エッジ付きフォント( 4x4サンプリング )
23 ANTIALIASING_EDGE_8X8 = DX_FONTTYPE_ANTIALIASING_EDGE_8X8, //アンチエイリアス&エッジ付きフォント( 8x8サンプリング ) )
24 ANTIALIASING_EDGE_16X16 = DX_FONTTYPE_ANTIALIASING_EDGE_16X16, //アンチエイリアス&エッジ付きフォント( 16x16サンプリング ) )
25 };
26
27
28
29 class Font
30 {
31 private:
32
33 ////使用するフォントの名前
34 //std::string fontName;
35
36 ////フォントサイズ(およそドット数)
37 //FontSize size{ -1,514 };
38
39 ////フォントの太さ
40 //FontThick thick{ -1,9 };
41
42 //作成したフォントデータ
44
46 {
47
48 }
49
50 public:
51
52 static std::shared_ptr<Font> CreateMyFont(std::string _fontName, int _fontSize, int _fontThick, FontType _fontType = NORMAL)
53 {
54 std::shared_ptr<Font> myFont{ new Font{} };
55 myFont->fontData = CreateFontToHandle(_fontName.c_str(), _fontSize, _fontThick, _fontType);
56
57 if (myFont->fontData == -1)
58 {
59 Debug::PrintAssertStatic("フォント生成に失敗しました");
60 return nullptr;
61 }
62
63 return myFont;
64 }
65
67 {
68 if (fontData != -1)
69 {
70 DeleteFontToHandle(fontData);
71 }
72 }
73
74 operator int() const
75 {
76 return fontData;
77 }
78 };
79
80 class FontFacadeImpl;
81
82 //TODO Facadeではないかも
84 {
85
86 public:
87 /// <summary>
88 /// Fontを追加する
89 /// </summary>
90 /// <param name="_key"></param>
91 /// <param name="_font"></param>
92 static void Add(std::string _key, std::shared_ptr<Font> _font);
93
94 /// <summary>
95 /// Fontを生成して追加する
96 /// </summary>
97 /// <param name="_key"></param>
98 /// <param name="_fontName"></param>
99 /// <param name="_fontSize"></param>
100 /// <param name="_fontThick"></param>
101 /// <param name="_fontType"></param>
102 static void Add(std::string _key, std::string _fontName, int _fontSize, int _fontThick, FontType _fontType = NORMAL);
103
104 /// <summary>
105 /// Fontを取得する
106 /// </summary>
107 /// <param name="_key"></param>
108 /// <returns></returns>
109 static std::shared_ptr<Font> Get(std::string _key);
110
111 /// <summary>
112 /// Fontを削除する
113 /// </summary>
114 /// <param name="_key"></param>
115 static void Pop(std::string _key);
116
117 static void FontFileInport(std::string _file);
118
119 };
120}
範囲指定の値型を提供します。
static void PrintAssertStatic(const std::string _in)
エラー出力用コンソール出力(文字色しか変わらない)
Definition Debug.cpp:152
Definition FontFacade.hpp:84
static void FontFileInport(std::string _file)
Definition FontFacade.cpp:124
static std::shared_ptr< Font > Get(std::string _key)
Fontを取得する
Definition FontFacade.cpp:112
static void Pop(std::string _key)
Fontを削除する
Definition FontFacade.cpp:118
static void Add(std::string _key, std::shared_ptr< Font > _font)
Fontを追加する
Definition FontFacade.cpp:100
Font()
Definition FontFacade.hpp:45
int fontData
Definition FontFacade.hpp:43
static std::shared_ptr< Font > CreateMyFont(std::string _fontName, int _fontSize, int _fontThick, FontType _fontType=NORMAL)
Definition FontFacade.hpp:52
~Font()
Definition FontFacade.hpp:66
特定範囲の値を管理するための数値型
Definition RangeNum.hpp:123
Definition Accessor.hpp:110
Kisaragi_Lib::RangeNum< int, ClampOnOutOfRange > FontSize
Definition FontFacade.hpp:11
Kisaragi_Lib::RangeNum< int, ClampOnOutOfRange > FontThick
Definition FontFacade.hpp:10
FontType
Definition FontFacade.hpp:14
@ ANTIALIASING_EDGE_8X8
Definition FontFacade.hpp:23
@ ANTIALIASING_8X8
Definition FontFacade.hpp:19
@ NORMAL
Definition FontFacade.hpp:15
@ ANTIALIASING_16X16
Definition FontFacade.hpp:20
@ ANTIALIASING_EDGE_4X4
Definition FontFacade.hpp:22
@ ANTIALIASING_4X4
Definition FontFacade.hpp:18
@ EDGE
Definition FontFacade.hpp:16
@ ANTIALIASING_EDGE_16X16
Definition FontFacade.hpp:24
@ ANTIALIASING_EDGE
Definition FontFacade.hpp:21
@ ANTIALIASING
Definition FontFacade.hpp:17