Font类移动到Common组

This commit is contained in:
Nomango 2018-05-22 22:00:47 +08:00
parent a942eeea16
commit 095446b063
6 changed files with 60 additions and 60 deletions

17
core/Common/Font.cpp Normal file
View File

@ -0,0 +1,17 @@
#include "..\e2dcommon.h"
e2d::Font::Font()
: family("")
, size(22)
, weight(Font::Weight::NORMAL)
, italic(false)
{
}
e2d::Font::Font(const String & family, double size, UINT weight, bool italic)
: family(family)
, size(size)
, weight(weight)
, italic(italic)
{
}

View File

@ -1,27 +1,5 @@
#include "..\e2dnode.h"
//-------------------------------------------------------
// Font
//-------------------------------------------------------
e2d::Text::Font::Font()
: family("")
, size(22)
, weight(Font::Weight::NORMAL)
, italic(false)
{
}
e2d::Text::Font::Font(const String & family, double size, UINT weight, bool italic)
: family(family)
, size(size)
, weight(weight)
, italic(italic)
{
}
//-------------------------------------------------------
// Style
//-------------------------------------------------------
@ -101,7 +79,7 @@ e2d::String e2d::Text::getText() const
return _text;
}
e2d::Text::Font e2d::Text::getFont() const
e2d::Font e2d::Text::getFont() const
{
return _font;
}

View File

@ -347,6 +347,44 @@ protected:
};
// ×ÖÌå
class Font
{
public:
String family; // ×ÖÌå×å
double size; // ×ÖºÅ
UINT weight; // ´Öϸֵ
bool italic; // бÌå
public:
// ×ÖÌå´Öϸֵ
enum Weight : UINT
{
THIN = 100,
EXTRA_LIGHT = 200,
LIGHT = 300,
SEMI_LIGHT = 350,
NORMAL = 400,
MEDIUM = 500,
DEMI_BOLD = 600,
BOLD = 700,
EXTRA_BOLD = 800,
BLACK = 900,
EXTRA_BLACK = 950
};
public:
Font();
Font(
const String& family,
double size = 22,
UINT weight = Font::Weight::NORMAL,
bool italic = false
);
};
// 基础对象
class Object
{

View File

@ -543,43 +543,6 @@ class Text :
public Node
{
public:
// ×ÖÌå
class Font
{
public:
String family; // ×ÖÌå×å
double size; // ×ÖºÅ
UINT weight; // ´Öϸֵ
bool italic; // бÌå
public:
// ×ÖÌå´Öϸֵ
enum Weight : UINT
{
THIN = 100,
EXTRA_LIGHT = 200,
LIGHT = 300,
SEMI_LIGHT = 350,
NORMAL = 400,
MEDIUM = 500,
DEMI_BOLD = 600,
BOLD = 700,
EXTRA_BOLD = 800,
BLACK = 900,
EXTRA_BLACK = 950
};
public:
Font();
Font(
const String& family,
double size = 22,
UINT weight = Font::Weight::NORMAL,
bool italic = false
);
};
// 文本对齐方式
enum class Align : int
{

View File

@ -227,6 +227,7 @@
<ClCompile Include="..\..\core\Collider\ColliderRect.cpp" />
<ClCompile Include="..\..\core\Collider\Collision.cpp" />
<ClCompile Include="..\..\core\Common\Color.cpp" />
<ClCompile Include="..\..\core\Common\Font.cpp" />
<ClCompile Include="..\..\core\Common\Function.cpp" />
<ClCompile Include="..\..\core\Common\Object.cpp" />
<ClCompile Include="..\..\core\Common\Point.cpp" />

View File

@ -231,6 +231,9 @@
<ClCompile Include="..\..\core\Tool\Listener.cpp">
<Filter>Tool</Filter>
</ClCompile>
<ClCompile Include="..\..\core\Common\Font.cpp">
<Filter>Common</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\core\easy2d.h" />