Révision | 88a6358a93f8d3f5cb544ff1f4a66943093743e7 (tree) |
---|---|
l'heure | 2012-11-18 23:56:50 |
Auteur | shom5xg <shom@.(no...> |
Commiter | shom5xg |
Arrange the font classes
@@ -15,8 +15,12 @@ | ||
15 | 15 | <ClInclude Include="..\..\src\core\debug\debug_dip\debug_dip.h" /> |
16 | 16 | <ClInclude Include="..\..\src\core\debug\debug_dip\debug_dip_def.h" /> |
17 | 17 | <ClInclude Include="..\..\src\core\debug\fps_counter\fps_counter.h" /> |
18 | - <ClInclude Include="..\..\src\core\font\font.h" /> | |
19 | - <ClInclude Include="..\..\src\core\font\font_gdi.h" /> | |
18 | + <ClInclude Include="..\..\src\core\font\Font_Base.h" /> | |
19 | + <ClInclude Include="..\..\src\core\font\Font_Def.h" /> | |
20 | + <ClInclude Include="..\..\src\core\font\Font_Gdi.h" /> | |
21 | + <ClInclude Include="..\..\src\core\font\Font_Gdi_Raw.h" /> | |
22 | + <ClInclude Include="..\..\src\core\font\Font_Texture.h" /> | |
23 | + <ClInclude Include="..\..\src\core\font\Font_Texture_Raw.h" /> | |
20 | 24 | <ClInclude Include="..\..\src\core\graphic\2d\board.h" /> |
21 | 25 | <ClInclude Include="..\..\src\core\graphic\2d\board_def.h" /> |
22 | 26 | <ClInclude Include="..\..\src\core\graphic\2d\image_board.h" /> |
@@ -43,8 +47,7 @@ | ||
43 | 47 | <ClCompile Include="..\..\src\core\app_dx.cpp" /> |
44 | 48 | <ClCompile Include="..\..\src\core\debug\debug_dip\debug_dip.cpp" /> |
45 | 49 | <ClCompile Include="..\..\src\core\debug\fps_counter\fps_counter.cpp" /> |
46 | - <ClCompile Include="..\..\src\core\font\font.cpp" /> | |
47 | - <ClCompile Include="..\..\src\core\font\font_gdi.cpp" /> | |
50 | + <ClCompile Include="..\..\src\core\font\Font_inls.cpp" /> | |
48 | 51 | <ClCompile Include="..\..\src\core\graphic\2d\board.cpp" /> |
49 | 52 | <ClCompile Include="..\..\src\core\graphic\2d\image_board.cpp" /> |
50 | 53 | <ClCompile Include="..\..\src\core\graphic\render_dx.cpp" /> |
@@ -64,6 +67,13 @@ | ||
64 | 67 | <ClCompile Include="..\..\src\core\sound\WaveFile.cpp" /> |
65 | 68 | <ClCompile Include="..\..\src\core\window.cpp" /> |
66 | 69 | </ItemGroup> |
70 | + <ItemGroup> | |
71 | + <None Include="..\..\src\core\font\Font_Base.inl" /> | |
72 | + <None Include="..\..\src\core\font\Font_Gdi.inl" /> | |
73 | + <None Include="..\..\src\core\font\Font_Gdi_Raw.inl" /> | |
74 | + <None Include="..\..\src\core\font\Font_Texture.inl" /> | |
75 | + <None Include="..\..\src\core\font\Font_Texture_Raw.inl" /> | |
76 | + </ItemGroup> | |
67 | 77 | <PropertyGroup Label="Globals"> |
68 | 78 | <ProjectGuid>{F9BA43E0-B71E-429A-B986-16B49D5FC334}</ProjectGuid> |
69 | 79 | <Keyword>Win32Proj</Keyword> |
@@ -94,7 +104,7 @@ | ||
94 | 104 | <PropertyGroup Label="UserMacros" /> |
95 | 105 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
96 | 106 | <LinkIncremental>true</LinkIncremental> |
97 | - <LibraryPath>C:\work\doc\program\shomlib\_release;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib;C:\Program Files\Microsoft DirectX SDK %28November 2008%29\Lib\x86;$(LibraryPath)</LibraryPath> | |
107 | + <LibraryPath>G:\Work\doc\program\DirectX\shomlib\_release;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib;C:\Program Files\Microsoft DirectX SDK %28November 2008%29\Lib\x86;$(LibraryPath)</LibraryPath> | |
98 | 108 | <IncludePath>C:\Program Files\boost\boost_1_42;C:\Program Files\Microsoft DirectX SDK %28November 2008%29\Include;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include;$(VCInstallDir)include</IncludePath> |
99 | 109 | <OutDir>$(ProjectDir)$(Configuration)_Output\</OutDir> |
100 | 110 | <TargetName>core_dx_$(Configuration)</TargetName> |
@@ -102,7 +112,7 @@ | ||
102 | 112 | </PropertyGroup> |
103 | 113 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
104 | 114 | <LinkIncremental>false</LinkIncremental> |
105 | - <LibraryPath>C:\work\doc\program\shomlib\_release;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib;C:\Program Files\Microsoft DirectX SDK %28November 2008%29\Lib\x86;$(LibraryPath)</LibraryPath> | |
115 | + <LibraryPath>G:\Work\doc\program\DirectX\shomlib\_release;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib;C:\Program Files\Microsoft DirectX SDK %28November 2008%29\Lib\x86;$(LibraryPath)</LibraryPath> | |
106 | 116 | <IncludePath>C:\Program Files\boost\boost_1_42;C:\Program Files\Microsoft DirectX SDK %28November 2008%29\Include;C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include;$(VCInstallDir)include</IncludePath> |
107 | 117 | <OutDir>$(ProjectDir)$(Configuration)_Output\</OutDir> |
108 | 118 | <TargetName>core_dx</TargetName> |
@@ -116,7 +126,7 @@ | ||
116 | 126 | <PreprocessorDefinitions>WIN32;DX;_DEBUG;_WINDOWS;_USRDLL;MM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
117 | 127 | <TreatWarningAsError>true</TreatWarningAsError> |
118 | 128 | <PrecompiledHeaderFile>pch_core.h</PrecompiledHeaderFile> |
119 | - <AdditionalIncludeDirectories>C:\work\doc\program\shomlib\util\src;$(ProjectDir)..\..\src;$(ProjectDir)..\..\lib\lua5.1\include</AdditionalIncludeDirectories> | |
129 | + <AdditionalIncludeDirectories>$(ProjectDir)..\..\..\util\src;$(ProjectDir)..\..\src;$(ProjectDir)..\..\lib\sqlite;$(ProjectDir)..\..\lib\lua5.1\include</AdditionalIncludeDirectories> | |
120 | 130 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
121 | 131 | </ClCompile> |
122 | 132 | <Link> |
@@ -132,6 +142,10 @@ | ||
132 | 142 | <PostBuildEvent> |
133 | 143 | <Command>copy $(OutDir)core_dx_Debug.lib $(ProjectDir)..\..\..\_release\core_dx_Debug.lib</Command> |
134 | 144 | </PostBuildEvent> |
145 | + <Lib> | |
146 | + <AdditionalDependencies>sqlite3.lib</AdditionalDependencies> | |
147 | + <AdditionalLibraryDirectories>$(ProjectDir)..\..\lib\sqlite</AdditionalLibraryDirectories> | |
148 | + </Lib> | |
135 | 149 | </ItemDefinitionGroup> |
136 | 150 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
137 | 151 | <ClCompile> |
@@ -142,7 +156,7 @@ | ||
142 | 156 | <IntrinsicFunctions>true</IntrinsicFunctions> |
143 | 157 | <PreprocessorDefinitions>WIN32;DX;NDEBUG;_WINDOWS;_USRDLL;MM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
144 | 158 | <PrecompiledHeaderFile>pch_core.h</PrecompiledHeaderFile> |
145 | - <AdditionalIncludeDirectories>C:\work\doc\program\shomlib\util\src;$(ProjectDir)..\..\src;$(ProjectDir)..\..\lib\lua5.1\include</AdditionalIncludeDirectories> | |
159 | + <AdditionalIncludeDirectories>$(ProjectDir)..\..\..\util\src;$(ProjectDir)..\..\src;$(ProjectDir)..\..\lib\sqlite;$(ProjectDir)..\..\lib\lua5.1\include</AdditionalIncludeDirectories> | |
146 | 160 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
147 | 161 | <TreatWarningAsError>true</TreatWarningAsError> |
148 | 162 | </ClCompile> |
@@ -159,6 +173,10 @@ | ||
159 | 173 | <PostBuildEvent> |
160 | 174 | <Command>copy $(OutDir)core_dx.lib $(ProjectDir)..\..\..\_release\core_dx.lib</Command> |
161 | 175 | </PostBuildEvent> |
176 | + <Lib> | |
177 | + <AdditionalDependencies>sqlite3.lib</AdditionalDependencies> | |
178 | + <AdditionalLibraryDirectories>$(ProjectDir)..\..\lib\sqlite</AdditionalLibraryDirectories> | |
179 | + </Lib> | |
162 | 180 | </ItemDefinitionGroup> |
163 | 181 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
164 | 182 | <ImportGroup Label="ExtensionTargets"> |
@@ -13,9 +13,6 @@ | ||
13 | 13 | <Filter Include="src\core\debug"> |
14 | 14 | <UniqueIdentifier>{8cbe1cd9-071b-4e8f-8a66-76d057613a05}</UniqueIdentifier> |
15 | 15 | </Filter> |
16 | - <Filter Include="src\core\font"> | |
17 | - <UniqueIdentifier>{3761d01a-03af-47c7-bdf3-4aa0403dfc4a}</UniqueIdentifier> | |
18 | - </Filter> | |
19 | 16 | <Filter Include="src\core\graphic"> |
20 | 17 | <UniqueIdentifier>{89657cac-6792-44f8-8c89-92843c80bcf0}</UniqueIdentifier> |
21 | 18 | </Filter> |
@@ -40,6 +37,9 @@ | ||
40 | 37 | <Filter Include="src\core\debug\prompt"> |
41 | 38 | <UniqueIdentifier>{f5b17539-2def-4f09-9fd5-de3e81c77a44}</UniqueIdentifier> |
42 | 39 | </Filter> |
40 | + <Filter Include="src\core\font"> | |
41 | + <UniqueIdentifier>{c477a949-4195-4195-ac72-1affe7c8fecf}</UniqueIdentifier> | |
42 | + </Filter> | |
43 | 43 | </ItemGroup> |
44 | 44 | <ItemGroup> |
45 | 45 | <ClInclude Include="..\..\src\core\graphic\2d\board.h"> |
@@ -48,12 +48,6 @@ | ||
48 | 48 | <ClInclude Include="..\..\src\core\graphic\2d\board_def.h"> |
49 | 49 | <Filter>src\core\graphic\2d</Filter> |
50 | 50 | </ClInclude> |
51 | - <ClInclude Include="..\..\src\core\font\font_gdi.h"> | |
52 | - <Filter>src\core\font</Filter> | |
53 | - </ClInclude> | |
54 | - <ClInclude Include="..\..\src\core\font\font.h"> | |
55 | - <Filter>src\core\font</Filter> | |
56 | - </ClInclude> | |
57 | 51 | <ClInclude Include="..\..\src\core\graphic\2d\image_board.h"> |
58 | 52 | <Filter>src\core\graphic\2d</Filter> |
59 | 53 | </ClInclude> |
@@ -123,14 +117,26 @@ | ||
123 | 117 | <ClInclude Include="..\..\src\core\debug\debug_dip\debug_dip_def.h"> |
124 | 118 | <Filter>src\core\debug\debug_dip</Filter> |
125 | 119 | </ClInclude> |
126 | - </ItemGroup> | |
127 | - <ItemGroup> | |
128 | - <ClCompile Include="..\..\src\core\font\font.cpp"> | |
120 | + <ClInclude Include="..\..\src\core\font\Font_Gdi_Raw.h"> | |
129 | 121 | <Filter>src\core\font</Filter> |
130 | - </ClCompile> | |
131 | - <ClCompile Include="..\..\src\core\font\font_gdi.cpp"> | |
122 | + </ClInclude> | |
123 | + <ClInclude Include="..\..\src\core\font\Font_Texture.h"> | |
132 | 124 | <Filter>src\core\font</Filter> |
133 | - </ClCompile> | |
125 | + </ClInclude> | |
126 | + <ClInclude Include="..\..\src\core\font\Font_Texture_Raw.h"> | |
127 | + <Filter>src\core\font</Filter> | |
128 | + </ClInclude> | |
129 | + <ClInclude Include="..\..\src\core\font\Font_Base.h"> | |
130 | + <Filter>src\core\font</Filter> | |
131 | + </ClInclude> | |
132 | + <ClInclude Include="..\..\src\core\font\Font_Def.h"> | |
133 | + <Filter>src\core\font</Filter> | |
134 | + </ClInclude> | |
135 | + <ClInclude Include="..\..\src\core\font\Font_Gdi.h"> | |
136 | + <Filter>src\core\font</Filter> | |
137 | + </ClInclude> | |
138 | + </ItemGroup> | |
139 | + <ItemGroup> | |
134 | 140 | <ClCompile Include="..\..\src\core\graphic\2d\image_board.cpp"> |
135 | 141 | <Filter>src\core\graphic\2d</Filter> |
136 | 142 | </ClCompile> |
@@ -185,5 +191,25 @@ | ||
185 | 191 | <ClCompile Include="..\..\src\core\debug\debug_dip\debug_dip.cpp"> |
186 | 192 | <Filter>src\core\debug\debug_dip</Filter> |
187 | 193 | </ClCompile> |
194 | + <ClCompile Include="..\..\src\core\font\Font_inls.cpp"> | |
195 | + <Filter>src\core\font</Filter> | |
196 | + </ClCompile> | |
197 | + </ItemGroup> | |
198 | + <ItemGroup> | |
199 | + <None Include="..\..\src\core\font\Font_Gdi.inl"> | |
200 | + <Filter>src\core\font</Filter> | |
201 | + </None> | |
202 | + <None Include="..\..\src\core\font\Font_Gdi_Raw.inl"> | |
203 | + <Filter>src\core\font</Filter> | |
204 | + </None> | |
205 | + <None Include="..\..\src\core\font\Font_Texture.inl"> | |
206 | + <Filter>src\core\font</Filter> | |
207 | + </None> | |
208 | + <None Include="..\..\src\core\font\Font_Texture_Raw.inl"> | |
209 | + <Filter>src\core\font</Filter> | |
210 | + </None> | |
211 | + <None Include="..\..\src\core\font\Font_Base.inl"> | |
212 | + <Filter>src\core\font</Filter> | |
213 | + </None> | |
188 | 214 | </ItemGroup> |
189 | 215 | </Project> |
\ No newline at end of file |
@@ -0,0 +1,18 @@ | ||
1 | +/***************************************************************************/ | |
2 | +/** @file Font_Base.h | |
3 | + @brief | |
4 | + @author shom | |
5 | +****************************************************************************/ | |
6 | + | |
7 | +#pragma once | |
8 | + | |
9 | +#include "Font_Def.h" | |
10 | + | |
11 | + | |
12 | +class CFont_Base | |
13 | +{ | |
14 | +public: | |
15 | + CFont_Base(); | |
16 | + | |
17 | + virtual void Draw( const TCHAR* in_szText, const font_def::FontContext_t& in_Context ) = 0; | |
18 | +}; |
@@ -0,0 +1,16 @@ | ||
1 | +/***************************************************************************/ | |
2 | +/** @file Font_Base.inl | |
3 | + @brief | |
4 | + @author shom | |
5 | +****************************************************************************/ | |
6 | + | |
7 | +#include "Font_Base.h" | |
8 | + | |
9 | +/*************************************************************************** | |
10 | + CFont_Base | |
11 | +****************************************************************************/ | |
12 | + | |
13 | +CFont_Base::CFont_Base() | |
14 | +{ | |
15 | +} | |
16 | + |
@@ -0,0 +1,39 @@ | ||
1 | +/***************************************************************************/ | |
2 | +/** @file font_def.h | |
3 | + @brief | |
4 | + @author shom | |
5 | +****************************************************************************/ | |
6 | + | |
7 | +#pragma once | |
8 | + | |
9 | +namespace font_def | |
10 | +{ | |
11 | + struct FontContext_t | |
12 | + { | |
13 | + FontContext_t() | |
14 | + : | |
15 | + uPosX( 0 ) | |
16 | + , uPosY( 0 ) | |
17 | + , v2Size( 32.0f, 32.0f ) | |
18 | + , uColor( COLOR_WHITE ) | |
19 | + | |
20 | + , bItalic( FALSE ) | |
21 | + , bWeight( FALSE ) | |
22 | + , bUseAnci( FALSE/*日本語使用*/ ) | |
23 | + , bShadow( FALSE ) | |
24 | + { | |
25 | + } | |
26 | + | |
27 | + u16 uPosX, uPosY; | |
28 | + vec2f v2Size; //floating value supported by only font-texture | |
29 | + u32 uColor; | |
30 | + | |
31 | + //-- supported by only font-gdi | |
32 | + b8 bItalic; | |
33 | + b8 bWeight; | |
34 | + b8 bUseAnci; | |
35 | + b8 bShadow; | |
36 | + //-- | |
37 | + }; | |
38 | +} | |
39 | + |
@@ -0,0 +1,39 @@ | ||
1 | +/***************************************************************************/ | |
2 | +/** @file Font_Gdi.inl | |
3 | + @brief font rendering by gdi | |
4 | + @author shom | |
5 | +****************************************************************************/ | |
6 | + | |
7 | +#include "Font_Gdi.h" | |
8 | + | |
9 | +#include "Font_Gdi_Raw.h" | |
10 | + | |
11 | + | |
12 | +/*************************************************************************** | |
13 | + CFont_Gdi | |
14 | +****************************************************************************/ | |
15 | + | |
16 | +CFont_Gdi::CFont_Gdi() | |
17 | +: | |
18 | + m_pRaw( new CFont_Gdi_Raw() ) | |
19 | +, m_pD3dxFont( NULL ) | |
20 | +, m_pD3xdSprite( NULL ) | |
21 | +{ | |
22 | + m_pRaw->Create( &m_pD3dxFont ); | |
23 | +} | |
24 | + | |
25 | +void CFont_Gdi::Draw( | |
26 | + const TCHAR* in_szText, const font_def::FontContext_t& in_Context | |
27 | + ) | |
28 | +{ | |
29 | + m_pRaw->SetPos( SCAST<u32>( in_Context.uPosX ), SCAST<u32>( in_Context.uPosY ) ); | |
30 | + m_pRaw->SetSize( SCAST<u32>( in_Context.v2Size.y ), SCAST<u32>( in_Context.v2Size.x ) ); | |
31 | + m_pRaw->SetStyle( in_Context.bItalic, in_Context.bWeight, in_Context.bUseAnci ); | |
32 | + | |
33 | + m_pRaw->Draw( | |
34 | + m_pD3dxFont, in_szText, | |
35 | + in_Context.uColor, in_Context.bShadow, m_pD3xdSprite | |
36 | + ); | |
37 | +} | |
38 | + | |
39 | + | |
\ No newline at end of file |
@@ -0,0 +1,39 @@ | ||
1 | +/***************************************************************************/ | |
2 | +/** @file Font_Gdi_Raw.h | |
3 | + @brief font rendering by gdi | |
4 | + @author shom | |
5 | + @internal | |
6 | +****************************************************************************/ | |
7 | + | |
8 | +#pragma once | |
9 | + | |
10 | +#include "d3dx9core.h" | |
11 | +#include "d3d9types.h" | |
12 | + | |
13 | +class crender; | |
14 | + | |
15 | +class CFont_Gdi_Raw | |
16 | +{ | |
17 | +public: | |
18 | + CFont_Gdi_Raw(); | |
19 | + | |
20 | + void SetDefault(); | |
21 | + | |
22 | + void SetPos( u32 in_uPosX, u32 in_uPosY ); | |
23 | + void SetSize( u32 height, u32 width = 0 ); | |
24 | + void SetStyle( b32 b_italic, b32 b_weight, b32 b_use_ansi ); | |
25 | + | |
26 | + void Create( LPD3DXFONT* out_ppD3dxFont ); | |
27 | + | |
28 | + void Draw( | |
29 | + const LPD3DXFONT p_d3dx_font, | |
30 | + const LPCWSTR sz_msg, | |
31 | + u32 color = COLOR_BLACK, | |
32 | + b32 b_shadow = FALSE, | |
33 | + const LPD3DXSPRITE p_sprite = NULL | |
34 | + ); | |
35 | + | |
36 | +private: | |
37 | + u32 m_uPosX, m_uPosY; | |
38 | + D3DXFONT_DESC m_font_desc; | |
39 | +}; |
@@ -1,30 +1,32 @@ | ||
1 | 1 | /***************************************************************************/ |
2 | -/** @file font_gdi.cpp | |
2 | +/** @file Font_Gdi_Raw.inl | |
3 | 3 | @brief font rendering by gdi |
4 | 4 | @author shom |
5 | 5 | @internal |
6 | 6 | ****************************************************************************/ |
7 | 7 | |
8 | -#include "pch_core.h" | |
9 | - | |
10 | 8 | #include "font_gdi.h" |
11 | 9 | |
12 | 10 | #include "core/graphic/render_dx.h" |
13 | 11 | |
14 | 12 | |
15 | 13 | /*************************************************************************** |
16 | - Font | |
14 | + CFont_Gdi_Raw | |
17 | 15 | ****************************************************************************/ |
18 | 16 | |
19 | -cfont_gdi::cfont_gdi() | |
17 | +CFont_Gdi_Raw::CFont_Gdi_Raw() | |
20 | 18 | : |
19 | +m_uPosX( 0 ), | |
20 | +m_uPosY( 0 ), | |
21 | 21 | m_font_desc()//, |
22 | 22 | { |
23 | 23 | SetDefault(); |
24 | 24 | } |
25 | 25 | |
26 | -void cfont_gdi::SetDefault() | |
26 | +void CFont_Gdi_Raw::SetDefault() | |
27 | 27 | { |
28 | + m_uPosX = 0; | |
29 | + m_uPosY = 0; | |
28 | 30 | m_font_desc.Height = 24; |
29 | 31 | m_font_desc.Width = 0; |
30 | 32 | m_font_desc.Italic = false; |
@@ -38,41 +40,36 @@ void cfont_gdi::SetDefault() | ||
38 | 40 | #endif |
39 | 41 | } |
40 | 42 | |
41 | -void cfont_gdi::SetSize( u32 height, u32 width ) | |
43 | +void CFont_Gdi_Raw::SetPos( u32 in_uPosX, u32 in_uPosY ) | |
44 | +{ | |
45 | + m_uPosX = in_uPosX; | |
46 | + m_uPosY = in_uPosY; | |
47 | +} | |
48 | + | |
49 | +void CFont_Gdi_Raw::SetSize( u32 height, u32 width ) | |
42 | 50 | { |
43 | 51 | m_font_desc.Height = height; |
44 | 52 | m_font_desc.Width = width; |
45 | 53 | } |
46 | 54 | |
47 | -void cfont_gdi::SetStyle( | |
48 | - b32 b_italic, | |
49 | - b32 b_weight, | |
50 | - b32 b_use_anci/* | |
51 | - b32 b_shadow*/ | |
52 | - ) | |
55 | +void CFont_Gdi_Raw::SetStyle( b32 b_italic, b32 b_weight, b32 b_use_anci ) | |
53 | 56 | { |
54 | 57 | m_font_desc.Italic = b_italic; |
55 | 58 | m_font_desc.Weight = ( b_weight ) ? 1000 : 500; |
56 | 59 | m_font_desc.CharSet = ( b_use_anci ) ? ANSI_CHARSET : SHIFTJIS_CHARSET; |
57 | - //b_shadow; | |
58 | 60 | } |
59 | 61 | |
60 | -void cfont_gdi::Create( LPD3DXFONT* pp_out, crender* in_p_render ) | |
62 | +void CFont_Gdi_Raw::Create( LPD3DXFONT* out_ppD3dxFont ) | |
61 | 63 | { |
62 | 64 | ///論理フォントの作成 |
63 | - const HRESULT hr = | |
64 | - D3DXCreateFontIndirect( | |
65 | - in_p_render->GetDevice(), | |
66 | - &m_font_desc, | |
67 | - pp_out | |
68 | - ); | |
65 | + const HRESULT hr = | |
66 | + D3DXCreateFontIndirect( g_p_render->GetDevice(), &m_font_desc, out_ppD3dxFont ); | |
69 | 67 | DBREAK_IF_FAILED( hr ); |
70 | 68 | } |
71 | 69 | |
72 | -void cfont_gdi::Draw( | |
70 | +void CFont_Gdi_Raw::Draw( | |
73 | 71 | const LPD3DXFONT p_d3dx_font, |
74 | 72 | const LPCWSTR sz_msg, |
75 | - RECT rect, | |
76 | 73 | u32 color, |
77 | 74 | b32 b_shadow, |
78 | 75 | const LPD3DXSPRITE p_sprite |
@@ -83,6 +80,10 @@ void cfont_gdi::Draw( | ||
83 | 80 | p_sprite->Begin( D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE ); |
84 | 81 | } |
85 | 82 | |
83 | + const u32 uWidth ( ( m_font_desc.Width == 0 ) ? m_font_desc.Height : m_font_desc.Width ); | |
84 | + RECT rect = | |
85 | + { m_uPosX, m_uPosY, m_uPosX + uWidth, m_uPosY + m_font_desc.Height }; | |
86 | + | |
86 | 87 | if( b_shadow ) |
87 | 88 | { |
88 | 89 | RECT rect_shadow = {0}; |
@@ -0,0 +1,24 @@ | ||
1 | +/***************************************************************************/ | |
2 | +/** @file Font_Texture.h | |
3 | + @brief font rendering by texture | |
4 | + @author shom | |
5 | +****************************************************************************/ | |
6 | + | |
7 | +#pragma once | |
8 | + | |
9 | +#include "Font_Base.h" | |
10 | + | |
11 | +class CFont_Texture_Raw; | |
12 | + | |
13 | +class CFont_Texture | |
14 | +: | |
15 | +public CFont_Base | |
16 | +{ | |
17 | +public: | |
18 | + CFont_Texture(); | |
19 | + | |
20 | + virtual void Draw( const TCHAR* in_szText, const font_def::FontContext_t& in_Context ); | |
21 | + | |
22 | +private: | |
23 | + SPTR_T( CFont_Texture_Raw ) m_pRaw; | |
24 | +}; |
@@ -0,0 +1,30 @@ | ||
1 | +/***************************************************************************/ | |
2 | +/** @file Font_Texture.inl | |
3 | + @brief font rendering by texture | |
4 | + @author shom | |
5 | +****************************************************************************/ | |
6 | + | |
7 | +#include "Font_Texture.h" | |
8 | + | |
9 | +#include "Font_Texture_Raw.h" | |
10 | + | |
11 | + | |
12 | +/*************************************************************************** | |
13 | + CFont_Texture | |
14 | +****************************************************************************/ | |
15 | + | |
16 | +CFont_Texture::CFont_Texture() | |
17 | +: | |
18 | + m_pRaw( new CFont_Texture_Raw() ) | |
19 | +{ | |
20 | + m_pRaw->Initialize(); | |
21 | +} | |
22 | + | |
23 | +void CFont_Texture::Draw( | |
24 | + const TCHAR* in_szText, const font_def::FontContext_t& in_Context | |
25 | + ) | |
26 | +{ | |
27 | + UNUSED( in_szText ); | |
28 | + UNUSED( in_Context ); | |
29 | +} | |
30 | + |
@@ -0,0 +1,80 @@ | ||
1 | +/***************************************************************************/ | |
2 | +/** @file font.h | |
3 | + @brief | |
4 | + @author shom | |
5 | + @internal | |
6 | +****************************************************************************/ | |
7 | + | |
8 | +#pragma once | |
9 | + | |
10 | +class cimage_board; | |
11 | + | |
12 | + | |
13 | +class CFontCharacter_Base | |
14 | +{ | |
15 | +public: | |
16 | + CFontCharacter_Base(); | |
17 | + | |
18 | + virtual void Initialize( const TCHAR* sz_path_texture ); | |
19 | + virtual void Finalize(); | |
20 | + | |
21 | + virtual void SetContext( const font_def::FontContext_t& in_context ); | |
22 | + | |
23 | + virtual void Draw( u32 in_character, const vec2f& in_v2_pos ); | |
24 | + | |
25 | +protected: | |
26 | + virtual void calc_texture_uv( | |
27 | + u32 in_character, | |
28 | + vec2f& out_v2_start, vec2f& out_v2_end | |
29 | + ) = 0; | |
30 | + | |
31 | + SPTR_T( cimage_board ) m_p_iboard_font; | |
32 | +}; | |
33 | + | |
34 | +class CFontCharacter_Ascii | |
35 | +: | |
36 | +public CFontCharacter_Base | |
37 | +{ | |
38 | +public: | |
39 | + CFontCharacter_Ascii(); | |
40 | + | |
41 | + virtual void Initialize(); | |
42 | + | |
43 | +protected: | |
44 | + virtual void calc_texture_uv( | |
45 | + u32 in_character, | |
46 | + vec2f& out_v2_start, vec2f& out_v2_end | |
47 | + ); | |
48 | +}; | |
49 | + | |
50 | +class CFontCharacter_Sjis | |
51 | +: | |
52 | +public CFontCharacter_Base | |
53 | +{ | |
54 | +public: | |
55 | + CFontCharacter_Sjis(); | |
56 | + | |
57 | + virtual void Initialize(); | |
58 | + | |
59 | +protected: | |
60 | + virtual void calc_texture_uv( | |
61 | + u32 in_character, | |
62 | + vec2f& out_v2_start, vec2f& out_v2_end | |
63 | + ); | |
64 | +}; | |
65 | + | |
66 | + | |
67 | +class CFont_Texture_Raw | |
68 | +{ | |
69 | +public: | |
70 | + CFont_Texture_Raw(); | |
71 | + | |
72 | + void Initialize(); | |
73 | + void Finalize(); | |
74 | + | |
75 | + void Draw( const char* const in_sz_msg, const font_def::FontContext_t& in_context ); | |
76 | + | |
77 | +private: | |
78 | + SPTR_T( CFontCharacter_Ascii ) m_p_character_ascii; | |
79 | + SPTR_T( CFontCharacter_Sjis ) m_p_character_sjis; | |
80 | +}; |
@@ -1,13 +1,11 @@ | ||
1 | 1 | /***************************************************************************/ |
2 | -/** @file font.cpp | |
2 | +/** @file Font_Texture_Raw.inl | |
3 | 3 | @brief |
4 | 4 | @author shom |
5 | 5 | @internal |
6 | 6 | ****************************************************************************/ |
7 | 7 | |
8 | -#include "pch_core.h" | |
9 | - | |
10 | -#include "font.h" | |
8 | +#include "Font_Texture_Raw.h" | |
11 | 9 | |
12 | 10 | #include "core/graphic/2d/image_board.h" |
13 | 11 |
@@ -16,35 +14,32 @@ using namespace font_def; | ||
16 | 14 | |
17 | 15 | |
18 | 16 | /*************************************************************************** |
19 | - cfont_character_base | |
17 | + CFontCharacter_Base | |
20 | 18 | ****************************************************************************/ |
21 | 19 | |
22 | -cfont_character_base::cfont_character_base() | |
20 | +CFontCharacter_Base::CFontCharacter_Base() | |
23 | 21 | : |
24 | 22 | m_p_iboard_font( CREATE_SPTR( cimage_board ) )//, |
25 | 23 | { |
26 | 24 | } |
27 | 25 | |
28 | -void cfont_character_base::Initialize( | |
29 | - crender* in_p_render, | |
30 | - const TCHAR* sz_path_texture | |
31 | - ) | |
26 | +void CFontCharacter_Base::Initialize( const TCHAR* sz_path_texture ) | |
32 | 27 | { |
33 | - m_p_iboard_font->Initialize( in_p_render, sz_path_texture ); | |
28 | + m_p_iboard_font->Initialize( sz_path_texture ); | |
34 | 29 | } |
35 | 30 | |
36 | -void cfont_character_base::Finalize() | |
31 | +void CFontCharacter_Base::Finalize() | |
37 | 32 | { |
38 | 33 | m_p_iboard_font->Finalize(); |
39 | 34 | } |
40 | 35 | |
41 | -void cfont_character_base::SetContext( const font_context_t& in_context ) | |
36 | +void CFontCharacter_Base::SetContext( const FontContext_t& in_context ) | |
42 | 37 | { |
43 | - m_p_iboard_font->SetSize( in_context.v2_size ); | |
44 | - m_p_iboard_font->SetColor( in_context.color ); | |
38 | + m_p_iboard_font->SetSize( in_context.v2Size ); | |
39 | + m_p_iboard_font->SetColor( in_context.uColor ); | |
45 | 40 | } |
46 | 41 | |
47 | -void cfont_character_base::Draw( crender* in_p_render, u32 in_character, const vec2f& in_v2_pos ) | |
42 | +void CFontCharacter_Base::Draw( u32 in_character, const vec2f& in_v2_pos ) | |
48 | 43 | { |
49 | 44 | ///-- |
50 | 45 | vec2f v2_uv_start, v2_uv_end; |
@@ -57,22 +52,22 @@ void cfont_character_base::Draw( crender* in_p_render, u32 in_character, const v | ||
57 | 52 | ///-- |
58 | 53 | |
59 | 54 | ///-- |
60 | - m_p_iboard_font->Draw( in_p_render ); | |
55 | + m_p_iboard_font->Draw(); | |
61 | 56 | ///-- |
62 | 57 | } |
63 | 58 | |
64 | 59 | |
65 | 60 | /*************************************************************************** |
66 | - cfont_character_ascii | |
61 | + CFontCharacter_Ascii | |
67 | 62 | ****************************************************************************/ |
68 | 63 | |
69 | -cfont_character_ascii::cfont_character_ascii() | |
64 | +CFontCharacter_Ascii::CFontCharacter_Ascii() | |
70 | 65 | { |
71 | 66 | } |
72 | 67 | |
73 | -void cfont_character_ascii::Initialize( crender* in_p_render ) | |
68 | +void CFontCharacter_Ascii::Initialize() | |
74 | 69 | { |
75 | - cfont_character_base::Initialize( in_p_render, _T( "texture/font/font_ascii.png" ) ); | |
70 | + CFontCharacter_Base::Initialize( _T( "texture/font/font_ascii.png" ) ); | |
76 | 71 | } |
77 | 72 | |
78 | 73 | /*------------------------------------------------------------------------*/ |
@@ -82,7 +77,7 @@ namespace | ||
82 | 77 | const u32 sc_nof_chara_on_row_in_texture_ascii = 16; |
83 | 78 | } |
84 | 79 | /*------------------------------------------------------------------------*/ |
85 | -void cfont_character_ascii::calc_texture_uv( | |
80 | +void CFontCharacter_Ascii::calc_texture_uv( | |
86 | 81 | u32 in_character, |
87 | 82 | vec2f& out_v2_start, vec2f& out_v2_end |
88 | 83 | ) |
@@ -103,16 +98,16 @@ void cfont_character_ascii::calc_texture_uv( | ||
103 | 98 | |
104 | 99 | |
105 | 100 | /*************************************************************************** |
106 | - cfont_character_sjis | |
101 | + CFontCharacter_Sjis | |
107 | 102 | ****************************************************************************/ |
108 | 103 | |
109 | -cfont_character_sjis::cfont_character_sjis() | |
104 | +CFontCharacter_Sjis::CFontCharacter_Sjis() | |
110 | 105 | { |
111 | 106 | } |
112 | 107 | |
113 | -void cfont_character_sjis::Initialize( crender* in_p_render ) | |
108 | +void CFontCharacter_Sjis::Initialize() | |
114 | 109 | { |
115 | - cfont_character_base::Initialize( in_p_render, _T( "texture/font/hiragana_katakana.png" ) ); | |
110 | + CFontCharacter_Base::Initialize( _T( "texture/font/hiragana_katakana.png" ) ); | |
116 | 111 | } |
117 | 112 | |
118 | 113 | /*------------------------------------------------------------------------*/ |
@@ -129,7 +124,7 @@ namespace | ||
129 | 124 | sc_nof_chara_on_column_in_texture_sjis * sc_nof_chara_on_row_in_texture_sjis - 1; |
130 | 125 | } |
131 | 126 | /*------------------------------------------------------------------------*/ |
132 | -void cfont_character_sjis::calc_texture_uv( | |
127 | +void CFontCharacter_Sjis::calc_texture_uv( | |
133 | 128 | u32 in_character, |
134 | 129 | vec2f& out_v2_start, vec2f& out_v2_end |
135 | 130 | ) |
@@ -158,29 +153,29 @@ void cfont_character_sjis::calc_texture_uv( | ||
158 | 153 | |
159 | 154 | |
160 | 155 | /*************************************************************************** |
161 | - cfont | |
156 | + CFont_Texture_Raw | |
162 | 157 | ****************************************************************************/ |
163 | 158 | |
164 | -cfont::cfont() | |
159 | +CFont_Texture_Raw::CFont_Texture_Raw() | |
165 | 160 | : |
166 | -m_p_character_ascii( CREATE_SPTR( cfont_character_ascii ) ), | |
167 | -m_p_character_sjis( CREATE_SPTR( cfont_character_sjis ) )//, | |
161 | +m_p_character_ascii( CREATE_SPTR( CFontCharacter_Ascii ) ), | |
162 | +m_p_character_sjis( CREATE_SPTR( CFontCharacter_Sjis ) )//, | |
168 | 163 | { |
169 | 164 | } |
170 | 165 | |
171 | -void cfont::Initialize( crender* in_p_render ) | |
166 | +void CFont_Texture_Raw::Initialize() | |
172 | 167 | { |
173 | - m_p_character_ascii->Initialize( in_p_render ); | |
174 | - m_p_character_sjis->Initialize( in_p_render ); | |
168 | + m_p_character_ascii->Initialize(); | |
169 | + m_p_character_sjis->Initialize(); | |
175 | 170 | } |
176 | 171 | |
177 | -void cfont::Finalize() | |
172 | +void CFont_Texture_Raw::Finalize() | |
178 | 173 | { |
179 | 174 | m_p_character_ascii->Finalize(); |
180 | 175 | m_p_character_sjis->Finalize(); |
181 | 176 | } |
182 | 177 | |
183 | -void cfont::Draw( crender* in_p_render, const char* const in_sz_msg, const font_context_t& in_context ) | |
178 | +void CFont_Texture_Raw::Draw( const char* const in_sz_msg, const FontContext_t& in_context ) | |
184 | 179 | { |
185 | 180 | m_p_character_ascii->SetContext( in_context ); |
186 | 181 | m_p_character_sjis->SetContext( in_context ); |
@@ -190,16 +185,16 @@ void cfont::Draw( crender* in_p_render, const char* const in_sz_msg, const font_ | ||
190 | 185 | while( in_sz_msg[ idx ] != '\0' ) |
191 | 186 | { |
192 | 187 | //-- |
193 | - const f32 pos_x_offset = in_context.v2_size.x * SCAST<f32>( nof_char ); | |
194 | - const f32 pos_x = in_context.v2_pos.x + pos_x_offset; | |
188 | + const f32 pos_x_offset = in_context.v2Size.x * SCAST<f32>( nof_char ); | |
189 | + const f32 pos_x = SCAST<f32>( in_context.uPosX ) + pos_x_offset; | |
195 | 190 | |
196 | - const vec2f v2_pos( pos_x, in_context.v2_pos.y ); | |
191 | + const vec2f v2_pos( pos_x, SCAST<f32>( in_context.uPosY ) ); | |
197 | 192 | //-- |
198 | 193 | |
199 | 194 | if( ( in_sz_msg[ idx ] & 0xff ) < 0x80 ) |
200 | 195 | //ascii |
201 | 196 | { |
202 | - m_p_character_ascii->Draw( in_p_render, ( in_sz_msg[ idx ] & 0xff ), v2_pos ); | |
197 | + m_p_character_ascii->Draw( ( in_sz_msg[ idx ] & 0xff ), v2_pos ); | |
203 | 198 | |
204 | 199 | idx += 1; |
205 | 200 | } |
@@ -209,7 +204,7 @@ void cfont::Draw( crender* in_p_render, const char* const in_sz_msg, const font_ | ||
209 | 204 | const u32 character = |
210 | 205 | ( ( in_sz_msg[ idx ] & 0xff ) << 8 ) + ( in_sz_msg[ idx + 1 ] & 0xff ); |
211 | 206 | |
212 | - m_p_character_sjis->Draw( in_p_render, character, v2_pos ); | |
207 | + m_p_character_sjis->Draw( character, v2_pos ); | |
213 | 208 | |
214 | 209 | idx += 2; |
215 | 210 | } |
@@ -0,0 +1,9 @@ | ||
1 | +#include "pch_core.h" | |
2 | + | |
3 | +#include "Font_Base.inl" | |
4 | + | |
5 | +#include "Font_Gdi.inl" | |
6 | +#include "Font_Gdi_Raw.inl" | |
7 | + | |
8 | +#include "Font_Texture.inl" | |
9 | +#include "Font_Texture_Raw.inl" |
@@ -1,107 +0,0 @@ | ||
1 | -/***************************************************************************/ | |
2 | -/** @file font.h | |
3 | - @brief | |
4 | - @author shom | |
5 | - @internal | |
6 | -****************************************************************************/ | |
7 | - | |
8 | -#pragma once | |
9 | - | |
10 | -class crender; | |
11 | -class cimage_board; | |
12 | - | |
13 | - | |
14 | -namespace font_def | |
15 | -{ | |
16 | - struct font_context_t | |
17 | - { | |
18 | - explicit font_context_t( | |
19 | - const vec2f& in_v2_pos = vec2f( 0.0f, 0.0f ), | |
20 | - const vec2f& in_v2_size = vec2f( 32.0f, 32.0f ), | |
21 | - u32 in_color = set_color_rgba( 0, 0, 0, 255 )//, | |
22 | - ) | |
23 | - : | |
24 | - v2_pos( in_v2_pos ), | |
25 | - v2_size( in_v2_size ), | |
26 | - color( in_color )//, | |
27 | - { | |
28 | - } | |
29 | - | |
30 | - vec2f v2_pos; | |
31 | - vec2f v2_size; | |
32 | - u32 color; | |
33 | - }; | |
34 | -} | |
35 | - | |
36 | - | |
37 | -class cfont_character_base | |
38 | -{ | |
39 | -public: | |
40 | - cfont_character_base(); | |
41 | - | |
42 | - virtual void Initialize( | |
43 | - crender* in_p_render, | |
44 | - const TCHAR* sz_path_texture | |
45 | - ); | |
46 | - virtual void Finalize(); | |
47 | - | |
48 | - virtual void SetContext( const font_def::font_context_t& in_context ); | |
49 | - | |
50 | - virtual void Draw( crender* in_p_render, u32 in_character, const vec2f& in_v2_pos ); | |
51 | - | |
52 | -protected: | |
53 | - virtual void calc_texture_uv( | |
54 | - u32 in_character, | |
55 | - vec2f& out_v2_start, vec2f& out_v2_end | |
56 | - ) = 0; | |
57 | - | |
58 | - SPTR_T( cimage_board ) m_p_iboard_font; | |
59 | -}; | |
60 | - | |
61 | -class cfont_character_ascii | |
62 | -: | |
63 | -public cfont_character_base | |
64 | -{ | |
65 | -public: | |
66 | - cfont_character_ascii(); | |
67 | - | |
68 | - virtual void Initialize( crender* in_p_render ); | |
69 | - | |
70 | -protected: | |
71 | - virtual void calc_texture_uv( | |
72 | - u32 in_character, | |
73 | - vec2f& out_v2_start, vec2f& out_v2_end | |
74 | - ); | |
75 | -}; | |
76 | - | |
77 | -class cfont_character_sjis | |
78 | -: | |
79 | -public cfont_character_base | |
80 | -{ | |
81 | -public: | |
82 | - cfont_character_sjis(); | |
83 | - | |
84 | - virtual void Initialize( crender* in_p_render ); | |
85 | - | |
86 | -protected: | |
87 | - virtual void calc_texture_uv( | |
88 | - u32 in_character, | |
89 | - vec2f& out_v2_start, vec2f& out_v2_end | |
90 | - ); | |
91 | -}; | |
92 | - | |
93 | - | |
94 | -class cfont | |
95 | -{ | |
96 | -public: | |
97 | - cfont(); | |
98 | - | |
99 | - void Initialize( crender* in_p_render ); | |
100 | - void Finalize(); | |
101 | - | |
102 | - void Draw( crender* in_p_render, const char* const in_sz_msg, const font_def::font_context_t& in_context ); | |
103 | - | |
104 | -private: | |
105 | - SPTR_T( cfont_character_ascii ) m_p_character_ascii; | |
106 | - SPTR_T( cfont_character_sjis ) m_p_character_sjis; | |
107 | -}; |