fix: minor fixes
This commit is contained in:
parent
b42c977aab
commit
05849422a4
|
|
@ -99,7 +99,7 @@ namespace easy2d
|
||||||
float pivot_y
|
float pivot_y
|
||||||
) override;
|
) override;
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
E2D_DISABLE_COPY(Button);
|
E2D_DISABLE_COPY(Button);
|
||||||
|
|
||||||
// 按钮状态枚举
|
// 按钮状态枚举
|
||||||
|
|
@ -122,7 +122,7 @@ namespace easy2d
|
||||||
// 遍历节点
|
// 遍历节点
|
||||||
virtual void Visit() override;
|
virtual void Visit() override;
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
Node * normal_;
|
Node * normal_;
|
||||||
Node * mouseover_;
|
Node * mouseover_;
|
||||||
Node * selected_;
|
Node * selected_;
|
||||||
|
|
@ -169,10 +169,10 @@ namespace easy2d
|
||||||
// 获取所有按钮
|
// 获取所有按钮
|
||||||
const std::vector<Button*>& GetAllButtons() const;
|
const std::vector<Button*>& GetAllButtons() const;
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
E2D_DISABLE_COPY(Menu);
|
E2D_DISABLE_COPY(Menu);
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
bool enabled_;
|
bool enabled_;
|
||||||
std::vector<Button*> buttons_;
|
std::vector<Button*> buttons_;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -786,32 +786,32 @@ namespace easy2d
|
||||||
class Style
|
class Style
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Color color; // 颜色
|
Color color; // 颜色
|
||||||
Align alignment; // 对齐方式
|
Align alignment; // 对齐方式
|
||||||
bool wrap; // 打开自动换行
|
bool wrap; // 打开自动换行
|
||||||
float wrap_width; // 自动换行宽度
|
float wrap_width; // 自动换行宽度
|
||||||
float line_spacing; // 行间距
|
float line_spacing; // 行间距
|
||||||
bool underline; // 下划线
|
bool underline; // 下划线
|
||||||
bool strikethrough; // 删除线
|
bool strikethrough; // 删除线
|
||||||
bool outline; // 显示描边
|
bool outline; // 显示描边
|
||||||
Color outline_color; // 描边颜色
|
Color outline_color; // 描边颜色
|
||||||
float outline_width; // 描边线宽
|
float outline_width; // 描边线宽
|
||||||
Stroke outline_stroke; // 描边线相交样式
|
Stroke outline_stroke; // 描边线相交样式
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Style();
|
Style();
|
||||||
|
|
||||||
Style(
|
Style(
|
||||||
Color color,
|
Color color,
|
||||||
Align alignment = Align::Left,
|
Align alignment = Align::Left,
|
||||||
bool wrap = false,
|
bool wrap = false,
|
||||||
float wrap_width = 0.f,
|
float wrap_width = 0.f,
|
||||||
float line_spacing = 0.f,
|
float line_spacing = 0.f,
|
||||||
bool underline = false,
|
bool underline = false,
|
||||||
bool strikethrough = false,
|
bool strikethrough = false,
|
||||||
bool outline = true,
|
bool outline = true,
|
||||||
Color outline_color = Color(Color::Black, 0.5),
|
Color outline_color = Color(Color::Black, 0.5),
|
||||||
float outline_width = 1.f,
|
float outline_width = 1.f,
|
||||||
Stroke outline_stroke = Stroke::Round
|
Stroke outline_stroke = Stroke::Round
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
@ -821,8 +821,8 @@ namespace easy2d
|
||||||
|
|
||||||
explicit Text(
|
explicit Text(
|
||||||
const String& text, /* 文字内容 */
|
const String& text, /* 文字内容 */
|
||||||
const Font& font = Font(), /* 字体 */
|
const Font& font = Font(), /* 字体 */
|
||||||
const Style& style = Style() /* 文本样式 */
|
const Style& style = Style() /* 文本样式 */
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual ~Text();
|
virtual ~Text();
|
||||||
|
|
|
||||||
248
core/e2dutil.h
248
core/e2dutil.h
|
|
@ -27,25 +27,6 @@
|
||||||
namespace easy2d
|
namespace easy2d
|
||||||
{
|
{
|
||||||
|
|
||||||
// 方向
|
|
||||||
enum class Direction : int
|
|
||||||
{
|
|
||||||
Up, /* 上 */
|
|
||||||
Down, /* 下 */
|
|
||||||
Left, /* 左 */
|
|
||||||
Right /* 右 */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// 线条相交样式
|
|
||||||
enum class Stroke : int
|
|
||||||
{
|
|
||||||
Miter = 0, /* 斜切 */
|
|
||||||
Bevel = 1, /* 斜角 */
|
|
||||||
Round = 2 /* 圆角 */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class Size;
|
class Size;
|
||||||
|
|
||||||
// 坐标
|
// 坐标
|
||||||
|
|
@ -357,45 +338,45 @@ namespace easy2d
|
||||||
public:
|
public:
|
||||||
enum Value : UINT
|
enum Value : UINT
|
||||||
{
|
{
|
||||||
Black = 0x000000,
|
Black = 0x000000,
|
||||||
Blue = 0x0000FF,
|
Blue = 0x0000FF,
|
||||||
BlueViolet = 0x8A2BE2,
|
BlueViolet = 0x8A2BE2,
|
||||||
Brown = 0xA52A2A,
|
Brown = 0xA52A2A,
|
||||||
Chocolate = 0xD2691E,
|
Chocolate = 0xD2691E,
|
||||||
DarkBlue = 0x00008B,
|
DarkBlue = 0x00008B,
|
||||||
DarkGray = 0xA9A9A9,
|
DarkGray = 0xA9A9A9,
|
||||||
DarkGreen = 0x006400,
|
DarkGreen = 0x006400,
|
||||||
DarkOrange = 0xFF8C00,
|
DarkOrange = 0xFF8C00,
|
||||||
DarkRed = 0x8B0000,
|
DarkRed = 0x8B0000,
|
||||||
DarkViolet = 0x9400D3,
|
DarkViolet = 0x9400D3,
|
||||||
ForestGreen = 0x228B22,
|
ForestGreen = 0x228B22,
|
||||||
Gold = 0xFFD700,
|
Gold = 0xFFD700,
|
||||||
Gray = 0x808080,
|
Gray = 0x808080,
|
||||||
Green = 0x008000,
|
Green = 0x008000,
|
||||||
GreenYellow = 0xADFF2F,
|
GreenYellow = 0xADFF2F,
|
||||||
LightBlue = 0xADD8E6,
|
LightBlue = 0xADD8E6,
|
||||||
LightCyan = 0xE0FFFF,
|
LightCyan = 0xE0FFFF,
|
||||||
LightGreen = 0x90EE90,
|
LightGreen = 0x90EE90,
|
||||||
LightGray = 0xD3D3D3,
|
LightGray = 0xD3D3D3,
|
||||||
LightPink = 0xFFB6C1,
|
LightPink = 0xFFB6C1,
|
||||||
LightSeaGreen = 0x20B2AA,
|
LightSeaGreen = 0x20B2AA,
|
||||||
LightSkyBlue = 0x87CEFA,
|
LightSkyBlue = 0x87CEFA,
|
||||||
LightYellow = 0xFFFFE0,
|
LightYellow = 0xFFFFE0,
|
||||||
Orange = 0xFFA500,
|
Orange = 0xFFA500,
|
||||||
OrangeRed = 0xFF4500,
|
OrangeRed = 0xFF4500,
|
||||||
Pink = 0xFFC0CB,
|
Pink = 0xFFC0CB,
|
||||||
Purple = 0x800080,
|
Purple = 0x800080,
|
||||||
Red = 0xFF0000,
|
Red = 0xFF0000,
|
||||||
Silver = 0xC0C0C0,
|
Silver = 0xC0C0C0,
|
||||||
SkyBlue = 0x87CEEB,
|
SkyBlue = 0x87CEEB,
|
||||||
Snow = 0xFFFAFA,
|
Snow = 0xFFFAFA,
|
||||||
Violet = 0xEE82EE,
|
Violet = 0xEE82EE,
|
||||||
Wheat = 0xF5DEB3,
|
Wheat = 0xF5DEB3,
|
||||||
White = 0xFFFFFF,
|
White = 0xFFFFFF,
|
||||||
WhiteSmoke = 0xF5F5F5,
|
WhiteSmoke = 0xF5F5F5,
|
||||||
Wood = 0xDEB887,
|
Wood = 0xDEB887,
|
||||||
Yellow = 0xFFFF00,
|
Yellow = 0xFFFF00,
|
||||||
Yellow_Green = 0x9ACD32
|
YellowGreen = 0x9ACD32
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -406,63 +387,82 @@ namespace easy2d
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 方向
|
||||||
|
enum class Direction : int
|
||||||
|
{
|
||||||
|
Up, /* 上 */
|
||||||
|
Down, /* 下 */
|
||||||
|
Left, /* 左 */
|
||||||
|
Right /* 右 */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 线条相交样式
|
||||||
|
enum class Stroke : int
|
||||||
|
{
|
||||||
|
Miter = 0, /* 斜切 */
|
||||||
|
Bevel = 1, /* 斜角 */
|
||||||
|
Round = 2 /* 圆角 */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// 键盘键值
|
// 键盘键值
|
||||||
enum class KeyCode : int
|
enum class KeyCode : int
|
||||||
{
|
{
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
Up = 0xC8,
|
Up = 0xC8,
|
||||||
Left = 0xCB,
|
Left = 0xCB,
|
||||||
Right = 0xCD,
|
Right = 0xCD,
|
||||||
Down = 0xD0,
|
Down = 0xD0,
|
||||||
Enter = 0x1C,
|
Enter = 0x1C,
|
||||||
Space = 0x39,
|
Space = 0x39,
|
||||||
Esc = 0x01,
|
Esc = 0x01,
|
||||||
Q = 0x10,
|
Q = 0x10,
|
||||||
W = 0x11,
|
W = 0x11,
|
||||||
E = 0x12,
|
E = 0x12,
|
||||||
R = 0x13,
|
R = 0x13,
|
||||||
T = 0x14,
|
T = 0x14,
|
||||||
Y = 0x15,
|
Y = 0x15,
|
||||||
U = 0x16,
|
U = 0x16,
|
||||||
I = 0x17,
|
I = 0x17,
|
||||||
O = 0x18,
|
O = 0x18,
|
||||||
P = 0x19,
|
P = 0x19,
|
||||||
A = 0x1E,
|
A = 0x1E,
|
||||||
S = 0x1F,
|
S = 0x1F,
|
||||||
D = 0x20,
|
D = 0x20,
|
||||||
F = 0x21,
|
F = 0x21,
|
||||||
G = 0x22,
|
G = 0x22,
|
||||||
H = 0x23,
|
H = 0x23,
|
||||||
J = 0x24,
|
J = 0x24,
|
||||||
K = 0x25,
|
K = 0x25,
|
||||||
L = 0x26,
|
L = 0x26,
|
||||||
Z = 0x2C,
|
Z = 0x2C,
|
||||||
X = 0x2D,
|
X = 0x2D,
|
||||||
C = 0x2E,
|
C = 0x2E,
|
||||||
V = 0x2F,
|
V = 0x2F,
|
||||||
B = 0x30,
|
B = 0x30,
|
||||||
N = 0x31,
|
N = 0x31,
|
||||||
M = 0x32,
|
M = 0x32,
|
||||||
Num1 = 0x02,
|
Num1 = 0x02,
|
||||||
Num2 = 0x03,
|
Num2 = 0x03,
|
||||||
Num3 = 0x04,
|
Num3 = 0x04,
|
||||||
Num4 = 0x05,
|
Num4 = 0x05,
|
||||||
Num5 = 0x06,
|
Num5 = 0x06,
|
||||||
Num6 = 0x07,
|
Num6 = 0x07,
|
||||||
Num7 = 0x08,
|
Num7 = 0x08,
|
||||||
Num8 = 0x09,
|
Num8 = 0x09,
|
||||||
Num9 = 0x0A,
|
Num9 = 0x0A,
|
||||||
Num0 = 0x0B,
|
Num0 = 0x0B,
|
||||||
Numpad7 = 0x47,
|
Numpad7 = 0x47,
|
||||||
Numpad8 = 0x48,
|
Numpad8 = 0x48,
|
||||||
Numpad9 = 0x49,
|
Numpad9 = 0x49,
|
||||||
Numpad4 = 0x4B,
|
Numpad4 = 0x4B,
|
||||||
Numpad5 = 0x4C,
|
Numpad5 = 0x4C,
|
||||||
Numpad6 = 0x4D,
|
Numpad6 = 0x4D,
|
||||||
Numpad1 = 0x4F,
|
Numpad1 = 0x4F,
|
||||||
Numpad2 = 0x50,
|
Numpad2 = 0x50,
|
||||||
Numpad3 = 0x51,
|
Numpad3 = 0x51,
|
||||||
Numpad0 = 0x52,
|
Numpad0 = 0x52,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -585,15 +585,15 @@ namespace easy2d
|
||||||
// 字体粗细值
|
// 字体粗细值
|
||||||
enum Weight : UINT
|
enum Weight : UINT
|
||||||
{
|
{
|
||||||
Thin = 100,
|
Thin = 100,
|
||||||
ExtraLight = 200,
|
ExtraLight = 200,
|
||||||
Light = 300,
|
Light = 300,
|
||||||
Normal = 400,
|
Normal = 400,
|
||||||
Medium = 500,
|
Medium = 500,
|
||||||
Bold = 700,
|
Bold = 700,
|
||||||
ExtraBold = 800,
|
ExtraBold = 800,
|
||||||
Black = 900,
|
Black = 900,
|
||||||
ExtraBlack = 950
|
ExtraBlack = 950
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -601,9 +601,9 @@ namespace easy2d
|
||||||
|
|
||||||
explicit Font(
|
explicit Font(
|
||||||
const String& family,
|
const String& family,
|
||||||
float size = 22,
|
float size = 22,
|
||||||
UINT weight = Font::Weight::Normal,
|
UINT weight = Font::Weight::Normal,
|
||||||
bool italic = false
|
bool italic = false
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,9 @@
|
||||||
# error 仅能在 C++ 环境下使用 Easy2D
|
# error 仅能在 C++ 环境下使用 Easy2D
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _MSC_VER < 1700
|
#ifndef _MSC_VER
|
||||||
|
# error 仅支持在 MSVC 环境下编译
|
||||||
|
#elif _MSC_VER < 1700
|
||||||
# error Easy2D 不支持 Visual Studio 2012 以下版本
|
# error Easy2D 不支持 Visual Studio 2012 以下版本
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue