• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoawindowspythonrubyphpgameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdombtronvb.netdirectxarduinopreviewerゲームエンジン

Commit MetaInfo

Révision88a6358a93f8d3f5cb544ff1f4a66943093743e7 (tree)
l'heure2012-11-18 23:56:50
Auteurshom5xg <shom@.(no...>
Commitershom5xg

Message de Log

Arrange the font classes

Change Summary

Modification

--- a/core/project/core_dx/core_dx.vcxproj
+++ b/core/project/core_dx/core_dx.vcxproj
@@ -15,8 +15,12 @@
1515 <ClInclude Include="..\..\src\core\debug\debug_dip\debug_dip.h" />
1616 <ClInclude Include="..\..\src\core\debug\debug_dip\debug_dip_def.h" />
1717 <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" />
2024 <ClInclude Include="..\..\src\core\graphic\2d\board.h" />
2125 <ClInclude Include="..\..\src\core\graphic\2d\board_def.h" />
2226 <ClInclude Include="..\..\src\core\graphic\2d\image_board.h" />
@@ -43,8 +47,7 @@
4347 <ClCompile Include="..\..\src\core\app_dx.cpp" />
4448 <ClCompile Include="..\..\src\core\debug\debug_dip\debug_dip.cpp" />
4549 <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" />
4851 <ClCompile Include="..\..\src\core\graphic\2d\board.cpp" />
4952 <ClCompile Include="..\..\src\core\graphic\2d\image_board.cpp" />
5053 <ClCompile Include="..\..\src\core\graphic\render_dx.cpp" />
@@ -64,6 +67,13 @@
6467 <ClCompile Include="..\..\src\core\sound\WaveFile.cpp" />
6568 <ClCompile Include="..\..\src\core\window.cpp" />
6669 </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>
6777 <PropertyGroup Label="Globals">
6878 <ProjectGuid>{F9BA43E0-B71E-429A-B986-16B49D5FC334}</ProjectGuid>
6979 <Keyword>Win32Proj</Keyword>
@@ -94,7 +104,7 @@
94104 <PropertyGroup Label="UserMacros" />
95105 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
96106 <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>
98108 <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>
99109 <OutDir>$(ProjectDir)$(Configuration)_Output\</OutDir>
100110 <TargetName>core_dx_$(Configuration)</TargetName>
@@ -102,7 +112,7 @@
102112 </PropertyGroup>
103113 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
104114 <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>
106116 <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>
107117 <OutDir>$(ProjectDir)$(Configuration)_Output\</OutDir>
108118 <TargetName>core_dx</TargetName>
@@ -116,7 +126,7 @@
116126 <PreprocessorDefinitions>WIN32;DX;_DEBUG;_WINDOWS;_USRDLL;MM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
117127 <TreatWarningAsError>true</TreatWarningAsError>
118128 <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>
120130 <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
121131 </ClCompile>
122132 <Link>
@@ -132,6 +142,10 @@
132142 <PostBuildEvent>
133143 <Command>copy $(OutDir)core_dx_Debug.lib $(ProjectDir)..\..\..\_release\core_dx_Debug.lib</Command>
134144 </PostBuildEvent>
145+ <Lib>
146+ <AdditionalDependencies>sqlite3.lib</AdditionalDependencies>
147+ <AdditionalLibraryDirectories>$(ProjectDir)..\..\lib\sqlite</AdditionalLibraryDirectories>
148+ </Lib>
135149 </ItemDefinitionGroup>
136150 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
137151 <ClCompile>
@@ -142,7 +156,7 @@
142156 <IntrinsicFunctions>true</IntrinsicFunctions>
143157 <PreprocessorDefinitions>WIN32;DX;NDEBUG;_WINDOWS;_USRDLL;MM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
144158 <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>
146160 <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
147161 <TreatWarningAsError>true</TreatWarningAsError>
148162 </ClCompile>
@@ -159,6 +173,10 @@
159173 <PostBuildEvent>
160174 <Command>copy $(OutDir)core_dx.lib $(ProjectDir)..\..\..\_release\core_dx.lib</Command>
161175 </PostBuildEvent>
176+ <Lib>
177+ <AdditionalDependencies>sqlite3.lib</AdditionalDependencies>
178+ <AdditionalLibraryDirectories>$(ProjectDir)..\..\lib\sqlite</AdditionalLibraryDirectories>
179+ </Lib>
162180 </ItemDefinitionGroup>
163181 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
164182 <ImportGroup Label="ExtensionTargets">
--- a/core/project/core_dx/core_dx.vcxproj.filters
+++ b/core/project/core_dx/core_dx.vcxproj.filters
@@ -13,9 +13,6 @@
1313 <Filter Include="src\core\debug">
1414 <UniqueIdentifier>{8cbe1cd9-071b-4e8f-8a66-76d057613a05}</UniqueIdentifier>
1515 </Filter>
16- <Filter Include="src\core\font">
17- <UniqueIdentifier>{3761d01a-03af-47c7-bdf3-4aa0403dfc4a}</UniqueIdentifier>
18- </Filter>
1916 <Filter Include="src\core\graphic">
2017 <UniqueIdentifier>{89657cac-6792-44f8-8c89-92843c80bcf0}</UniqueIdentifier>
2118 </Filter>
@@ -40,6 +37,9 @@
4037 <Filter Include="src\core\debug\prompt">
4138 <UniqueIdentifier>{f5b17539-2def-4f09-9fd5-de3e81c77a44}</UniqueIdentifier>
4239 </Filter>
40+ <Filter Include="src\core\font">
41+ <UniqueIdentifier>{c477a949-4195-4195-ac72-1affe7c8fecf}</UniqueIdentifier>
42+ </Filter>
4343 </ItemGroup>
4444 <ItemGroup>
4545 <ClInclude Include="..\..\src\core\graphic\2d\board.h">
@@ -48,12 +48,6 @@
4848 <ClInclude Include="..\..\src\core\graphic\2d\board_def.h">
4949 <Filter>src\core\graphic\2d</Filter>
5050 </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>
5751 <ClInclude Include="..\..\src\core\graphic\2d\image_board.h">
5852 <Filter>src\core\graphic\2d</Filter>
5953 </ClInclude>
@@ -123,14 +117,26 @@
123117 <ClInclude Include="..\..\src\core\debug\debug_dip\debug_dip_def.h">
124118 <Filter>src\core\debug\debug_dip</Filter>
125119 </ClInclude>
126- </ItemGroup>
127- <ItemGroup>
128- <ClCompile Include="..\..\src\core\font\font.cpp">
120+ <ClInclude Include="..\..\src\core\font\Font_Gdi_Raw.h">
129121 <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">
132124 <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>
134140 <ClCompile Include="..\..\src\core\graphic\2d\image_board.cpp">
135141 <Filter>src\core\graphic\2d</Filter>
136142 </ClCompile>
@@ -185,5 +191,25 @@
185191 <ClCompile Include="..\..\src\core\debug\debug_dip\debug_dip.cpp">
186192 <Filter>src\core\debug\debug_dip</Filter>
187193 </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>
188214 </ItemGroup>
189215 </Project>
\ No newline at end of file
--- /dev/null
+++ b/core/src/core/font/Font_Base.h
@@ -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+};
--- /dev/null
+++ b/core/src/core/font/Font_Base.inl
@@ -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+
--- /dev/null
+++ b/core/src/core/font/Font_Def.h
@@ -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+
--- /dev/null
+++ b/core/src/core/font/Font_Gdi.inl
@@ -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
--- /dev/null
+++ b/core/src/core/font/Font_Gdi_Raw.h
@@ -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+};
--- a/core/src/core/font/font_gdi.cpp
+++ b/core/src/core/font/Font_Gdi_Raw.inl
@@ -1,30 +1,32 @@
11 /***************************************************************************/
2-/** @file font_gdi.cpp
2+/** @file Font_Gdi_Raw.inl
33 @brief font rendering by gdi
44 @author shom
55 @internal
66 ****************************************************************************/
77
8-#include "pch_core.h"
9-
108 #include "font_gdi.h"
119
1210 #include "core/graphic/render_dx.h"
1311
1412
1513 /***************************************************************************
16- Font
14+ CFont_Gdi_Raw
1715 ****************************************************************************/
1816
19-cfont_gdi::cfont_gdi()
17+CFont_Gdi_Raw::CFont_Gdi_Raw()
2018 :
19+m_uPosX( 0 ),
20+m_uPosY( 0 ),
2121 m_font_desc()//,
2222 {
2323 SetDefault();
2424 }
2525
26-void cfont_gdi::SetDefault()
26+void CFont_Gdi_Raw::SetDefault()
2727 {
28+ m_uPosX = 0;
29+ m_uPosY = 0;
2830 m_font_desc.Height = 24;
2931 m_font_desc.Width = 0;
3032 m_font_desc.Italic = false;
@@ -38,41 +40,36 @@ void cfont_gdi::SetDefault()
3840 #endif
3941 }
4042
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 )
4250 {
4351 m_font_desc.Height = height;
4452 m_font_desc.Width = width;
4553 }
4654
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 )
5356 {
5457 m_font_desc.Italic = b_italic;
5558 m_font_desc.Weight = ( b_weight ) ? 1000 : 500;
5659 m_font_desc.CharSet = ( b_use_anci ) ? ANSI_CHARSET : SHIFTJIS_CHARSET;
57- //b_shadow;
5860 }
5961
60-void cfont_gdi::Create( LPD3DXFONT* pp_out, crender* in_p_render )
62+void CFont_Gdi_Raw::Create( LPD3DXFONT* out_ppD3dxFont )
6163 {
6264 ///論理フォントの作成
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 );
6967 DBREAK_IF_FAILED( hr );
7068 }
7169
72-void cfont_gdi::Draw(
70+void CFont_Gdi_Raw::Draw(
7371 const LPD3DXFONT p_d3dx_font,
7472 const LPCWSTR sz_msg,
75- RECT rect,
7673 u32 color,
7774 b32 b_shadow,
7875 const LPD3DXSPRITE p_sprite
@@ -83,6 +80,10 @@ void cfont_gdi::Draw(
8380 p_sprite->Begin( D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE );
8481 }
8582
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+
8687 if( b_shadow )
8788 {
8889 RECT rect_shadow = {0};
--- /dev/null
+++ b/core/src/core/font/Font_Texture.h
@@ -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+};
--- /dev/null
+++ b/core/src/core/font/Font_Texture.inl
@@ -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+
--- /dev/null
+++ b/core/src/core/font/Font_Texture_Raw.h
@@ -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+};
--- a/core/src/core/font/font.cpp
+++ b/core/src/core/font/Font_Texture_Raw.inl
@@ -1,13 +1,11 @@
11 /***************************************************************************/
2-/** @file font.cpp
2+/** @file Font_Texture_Raw.inl
33 @brief
44 @author shom
55 @internal
66 ****************************************************************************/
77
8-#include "pch_core.h"
9-
10-#include "font.h"
8+#include "Font_Texture_Raw.h"
119
1210 #include "core/graphic/2d/image_board.h"
1311
@@ -16,35 +14,32 @@ using namespace font_def;
1614
1715
1816 /***************************************************************************
19- cfont_character_base
17+ CFontCharacter_Base
2018 ****************************************************************************/
2119
22-cfont_character_base::cfont_character_base()
20+CFontCharacter_Base::CFontCharacter_Base()
2321 :
2422 m_p_iboard_font( CREATE_SPTR( cimage_board ) )//,
2523 {
2624 }
2725
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 )
3227 {
33- m_p_iboard_font->Initialize( in_p_render, sz_path_texture );
28+ m_p_iboard_font->Initialize( sz_path_texture );
3429 }
3530
36-void cfont_character_base::Finalize()
31+void CFontCharacter_Base::Finalize()
3732 {
3833 m_p_iboard_font->Finalize();
3934 }
4035
41-void cfont_character_base::SetContext( const font_context_t& in_context )
36+void CFontCharacter_Base::SetContext( const FontContext_t& in_context )
4237 {
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 );
4540 }
4641
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 )
4843 {
4944 ///--
5045 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
5752 ///--
5853
5954 ///--
60- m_p_iboard_font->Draw( in_p_render );
55+ m_p_iboard_font->Draw();
6156 ///--
6257 }
6358
6459
6560 /***************************************************************************
66- cfont_character_ascii
61+ CFontCharacter_Ascii
6762 ****************************************************************************/
6863
69-cfont_character_ascii::cfont_character_ascii()
64+CFontCharacter_Ascii::CFontCharacter_Ascii()
7065 {
7166 }
7267
73-void cfont_character_ascii::Initialize( crender* in_p_render )
68+void CFontCharacter_Ascii::Initialize()
7469 {
75- cfont_character_base::Initialize( in_p_render, _T( "texture/font/font_ascii.png" ) );
70+ CFontCharacter_Base::Initialize( _T( "texture/font/font_ascii.png" ) );
7671 }
7772
7873 /*------------------------------------------------------------------------*/
@@ -82,7 +77,7 @@ namespace
8277 const u32 sc_nof_chara_on_row_in_texture_ascii = 16;
8378 }
8479 /*------------------------------------------------------------------------*/
85-void cfont_character_ascii::calc_texture_uv(
80+void CFontCharacter_Ascii::calc_texture_uv(
8681 u32 in_character,
8782 vec2f& out_v2_start, vec2f& out_v2_end
8883 )
@@ -103,16 +98,16 @@ void cfont_character_ascii::calc_texture_uv(
10398
10499
105100 /***************************************************************************
106- cfont_character_sjis
101+ CFontCharacter_Sjis
107102 ****************************************************************************/
108103
109-cfont_character_sjis::cfont_character_sjis()
104+CFontCharacter_Sjis::CFontCharacter_Sjis()
110105 {
111106 }
112107
113-void cfont_character_sjis::Initialize( crender* in_p_render )
108+void CFontCharacter_Sjis::Initialize()
114109 {
115- cfont_character_base::Initialize( in_p_render, _T( "texture/font/hiragana_katakana.png" ) );
110+ CFontCharacter_Base::Initialize( _T( "texture/font/hiragana_katakana.png" ) );
116111 }
117112
118113 /*------------------------------------------------------------------------*/
@@ -129,7 +124,7 @@ namespace
129124 sc_nof_chara_on_column_in_texture_sjis * sc_nof_chara_on_row_in_texture_sjis - 1;
130125 }
131126 /*------------------------------------------------------------------------*/
132-void cfont_character_sjis::calc_texture_uv(
127+void CFontCharacter_Sjis::calc_texture_uv(
133128 u32 in_character,
134129 vec2f& out_v2_start, vec2f& out_v2_end
135130 )
@@ -158,29 +153,29 @@ void cfont_character_sjis::calc_texture_uv(
158153
159154
160155 /***************************************************************************
161- cfont
156+ CFont_Texture_Raw
162157 ****************************************************************************/
163158
164-cfont::cfont()
159+CFont_Texture_Raw::CFont_Texture_Raw()
165160 :
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 ) )//,
168163 {
169164 }
170165
171-void cfont::Initialize( crender* in_p_render )
166+void CFont_Texture_Raw::Initialize()
172167 {
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();
175170 }
176171
177-void cfont::Finalize()
172+void CFont_Texture_Raw::Finalize()
178173 {
179174 m_p_character_ascii->Finalize();
180175 m_p_character_sjis->Finalize();
181176 }
182177
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 )
184179 {
185180 m_p_character_ascii->SetContext( in_context );
186181 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_
190185 while( in_sz_msg[ idx ] != '\0' )
191186 {
192187 //--
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;
195190
196- const vec2f v2_pos( pos_x, in_context.v2_pos.y );
191+ const vec2f v2_pos( pos_x, SCAST<f32>( in_context.uPosY ) );
197192 //--
198193
199194 if( ( in_sz_msg[ idx ] & 0xff ) < 0x80 )
200195 //ascii
201196 {
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 );
203198
204199 idx += 1;
205200 }
@@ -209,7 +204,7 @@ void cfont::Draw( crender* in_p_render, const char* const in_sz_msg, const font_
209204 const u32 character =
210205 ( ( in_sz_msg[ idx ] & 0xff ) << 8 ) + ( in_sz_msg[ idx + 1 ] & 0xff );
211206
212- m_p_character_sjis->Draw( in_p_render, character, v2_pos );
207+ m_p_character_sjis->Draw( character, v2_pos );
213208
214209 idx += 2;
215210 }
--- /dev/null
+++ b/core/src/core/font/Font_inls.cpp
@@ -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"
--- a/core/src/core/font/font.h
+++ /dev/null
@@ -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-};