enum命名改为大驼峰式

This commit is contained in:
Nomango 2018-05-24 20:37:34 +08:00
parent 1eca4fbdf5
commit 2058dfaa7d
15 changed files with 166 additions and 173 deletions

View File

@ -194,23 +194,23 @@ void e2d::Window::setCursor(Cursor cursor)
LPCWSTR pCursorName = nullptr;
switch (cursor)
{
case Cursor::NORMAL:
case Cursor::Normal:
pCursorName = IDC_ARROW;
break;
case Cursor::HAND:
case Cursor::Hand:
pCursorName = IDC_HAND;
break;
case Cursor::NO:
case Cursor::No:
pCursorName = IDC_NO;
break;
case Cursor::WAIT:
case Cursor::Wait:
pCursorName = IDC_WAIT;
break;
case Cursor::ARROW_WAIT:
case Cursor::ArrowWait:
pCursorName = IDC_APPSTARTING;
break;

View File

@ -4,7 +4,7 @@
e2d::Collider::Collider()
: _visiable(true)
, _color(Color::RED, 0.7f)
, _color(Color::Red, 0.7)
, _parentNode(nullptr)
, _transformed(nullptr)
, _enable(true)
@ -77,7 +77,7 @@ e2d::Collider::Relation e2d::Collider::getRelationWith(Collider * pCollider) con
return Relation(relation);
}
}
return Relation::UNKNOWN;
return Relation::Unknown;
}
void e2d::Collider::_transform()

View File

@ -3,7 +3,7 @@
e2d::Font::Font()
: family("")
, size(22)
, weight(Font::Weight::NORMAL)
, weight(Font::Weight::Normal)
, italic(false)
{
}

View File

@ -39,7 +39,7 @@ void e2d::ColliderManager::__updateCollider(e2d::Collider * pActiveCollider)
// 判断两碰撞体交集情况
Collider::Relation relation = pActiveCollider->getRelationWith(pPassiveCollider);
// 忽略 UNKNOWN 和 DISJOIN 情况
if (relation != Collider::Relation::UNKNOWN && relation != Collider::Relation::DISJOIN)
if (relation != Collider::Relation::Unknown && relation != Collider::Relation::Disjoin)
{
// 更新碰撞监听器
Collision::__update(pActiveNode, pPassiveNode);

View File

@ -6,7 +6,7 @@
e2d::Button::Button()
: _func(nullptr)
, _state(ButtonState::NORMAL)
, _state(ButtonState::Normal)
, _enable(true)
, _isSelected(false)
, _normal(nullptr)
@ -18,7 +18,7 @@ e2d::Button::Button()
e2d::Button::Button(Node * normal, const Function& func)
: _func(nullptr)
, _state(ButtonState::NORMAL)
, _state(ButtonState::Normal)
, _enable(true)
, _isSelected(false)
, _normal(nullptr)
@ -32,7 +32,7 @@ e2d::Button::Button(Node * normal, const Function& func)
e2d::Button::Button(Node * normal, Node * selected, const Function& func)
: _func(nullptr)
, _state(ButtonState::NORMAL)
, _state(ButtonState::Normal)
, _enable(true)
, _isSelected(false)
, _normal(nullptr)
@ -47,7 +47,7 @@ e2d::Button::Button(Node * normal, Node * selected, const Function& func)
e2d::Button::Button(Node * normal, Node * mouseover, Node * selected, const Function& func)
: _func(nullptr)
, _state(ButtonState::NORMAL)
, _state(ButtonState::Normal)
, _enable(true)
, _isSelected(false)
, _normal(nullptr)
@ -63,7 +63,7 @@ e2d::Button::Button(Node * normal, Node * mouseover, Node * selected, const Func
e2d::Button::Button(Node * normal, Node * mouseover, Node * selected, Node * disabled, const Function& func)
: _func(nullptr)
, _state(ButtonState::NORMAL)
, _state(ButtonState::Normal)
, _enable(true)
, _isSelected(false)
, _normal(nullptr)
@ -184,7 +184,7 @@ void e2d::Button::_fixedUpdate()
if (_enable && _visiable && _normal)
{
if (Input::isRelease(Input::Mouse::LEFT))
if (Input::isRelease(Input::Mouse::Left))
{
// 鼠标左键抬起时,判断鼠标坐标是否在按钮内部
if (_isSelected &&
@ -196,7 +196,7 @@ void e2d::Button::_fixedUpdate()
_isSelected = false;
}
if (Input::isPress(Input::Mouse::LEFT))
if (Input::isPress(Input::Mouse::Left))
{
if (_normal->containsPoint(Input::getMousePos()))
{
@ -206,28 +206,28 @@ void e2d::Button::_fixedUpdate()
}
}
if (_isSelected && Input::isDown(Input::Mouse::LEFT))
if (_isSelected && Input::isDown(Input::Mouse::Left))
{
if (_normal->containsPoint(Input::getMousePos()))
{
_setState(ButtonState::SELECTED);
Window::setCursor(Window::Cursor::HAND);
_setState(ButtonState::Selected);
Window::setCursor(Window::Cursor::Hand);
return;
}
}
else if (_normal->containsPoint(Input::getMousePos()))
{
_setState(ButtonState::MOUSEOVER);
Window::setCursor(Window::Cursor::HAND);
_setState(ButtonState::Mouseover);
Window::setCursor(Window::Cursor::Hand);
return;
}
_setState(ButtonState::NORMAL);
_setState(ButtonState::Normal);
}
if (_visiable && !_enable && _normal && _normal->containsPoint(Input::getMousePos()))
{
Window::setCursor(Window::Cursor::NO);
Window::setCursor(Window::Cursor::No);
}
}
@ -249,11 +249,11 @@ void e2d::Button::_updateVisiable()
if (_enable)
{
if (_state == ButtonState::SELECTED && _selected)
if (_state == ButtonState::Selected && _selected)
{
_selected->setVisiable(true);
}
else if (_state == ButtonState::MOUSEOVER && _mouseover)
else if (_state == ButtonState::Mouseover && _mouseover)
{
_mouseover->setVisiable(true);
}

View File

@ -6,7 +6,7 @@
// ĬÈÏÖÐÐĵãλÖÃ
static float s_fDefaultPiovtX = 0;
static float s_fDefaultPiovtY = 0;
static e2d::Collider::Type s_fDefaultColliderType = e2d::Collider::Type::NONE;
static e2d::Collider::Type s_fDefaultColliderType = e2d::Collider::Type::None;
e2d::Node::Node()
: _nOrder(0)
@ -35,7 +35,7 @@ e2d::Node::Node()
, _autoUpdate(true)
, _positionFixed(false)
{
if (s_fDefaultColliderType != Collider::Type::NONE)
if (s_fDefaultColliderType != Collider::Type::None)
{
this->setCollider(s_fDefaultColliderType);
}
@ -542,25 +542,25 @@ void e2d::Node::setCollider(Collider::Type type)
{
switch (type)
{
case Collider::Type::RECT:
case Collider::Type::Rect:
{
this->setCollider(GC::create<RectCollider>(this));
break;
}
case Collider::Type::CIRCLE:
case Collider::Type::Circle:
{
this->setCollider(GC::create<CircleCollider>(this));
break;
}
case Collider::Type::ELLIPSE:
case Collider::Type::Ellipse:
{
this->setCollider(GC::create<EllipseCollider>(this));
break;
}
case Collider::Type::NONE:
case Collider::Type::None:
{
this->setCollider(nullptr);
break;
@ -869,8 +869,8 @@ bool e2d::Node::intersects(Node * node) const
if (this->_collider && node->_collider)
{
Collider::Relation relation = this->_collider->getRelationWith(node->_collider);
if ((relation != Collider::Relation::UNKNOWN) &&
(relation != Collider::Relation::DISJOIN))
if ((relation != Collider::Relation::Unknown) &&
(relation != Collider::Relation::Disjoin))
{
return true;
}

View File

@ -1,7 +1,7 @@
#include "..\..\e2dshape.h"
e2d::Shape::Shape()
: _style(Style::SOLID)
: _style(Style::Solid)
, _fillColor(0x6090A0U)
, _lineColor(0x78B7D0U)
, _strokeWidth(2)
@ -20,7 +20,7 @@ void e2d::Shape::onRender()
switch (_style)
{
case Style::FILL:
case Style::Fill:
{
pBrush->SetColor(_fillColor.toD2DColorF());
this->_renderFill();
@ -30,14 +30,14 @@ void e2d::Shape::onRender()
break;
}
case Style::ROUND:
case Style::Round:
{
pBrush->SetColor(_lineColor.toD2DColorF());
this->_renderLine();
break;
}
case Style::SOLID:
case Style::Solid:
{
pBrush->SetColor(_fillColor.toD2DColorF());
this->_renderFill();
@ -93,13 +93,13 @@ void e2d::Shape::setLineJoin(LineJoin lineJoin)
{
switch (lineJoin)
{
case LineJoin::MITER:
case LineJoin::Miter:
_strokeStyle = Renderer::getMiterID2D1StrokeStyle();
break;
case LineJoin::BEVEL:
case LineJoin::Bevel:
_strokeStyle = Renderer::getBevelID2D1StrokeStyle();
break;
case LineJoin::ROUND:
case LineJoin::Round:
_strokeStyle = Renderer::getRoundID2D1StrokeStyle();
break;
default:

View File

@ -5,17 +5,17 @@
//-------------------------------------------------------
e2d::Text::Style::Style()
: color(Color::WHITE)
, alignment(Align::LEFT)
: color(Color::White)
, alignment(Align::Left)
, wrapping(false)
, wrappingWidth(0.0)
, lineSpacing(0.0)
, hasUnderline(false)
, hasStrikethrough(false)
, hasOutline(true)
, outlineColor(Color(Color::BLACK, 0.5))
, outlineColor(Color(Color::Black, 0.5))
, outlineWidth(1.0)
, outlineJoin(LineJoin::ROUND)
, outlineJoin(LineJoin::Round)
{}
e2d::Text::Style::Style(

View File

@ -13,22 +13,22 @@ void e2d::MoveTransition::_init(Scene * prev, Scene * next)
double width = _windowSize.width;
double height = _windowSize.height;
if (_direction == Direction::UP)
if (_direction == Direction::Up)
{
_posDelta = Vector(0, -height);
_startPos = Point(0, height);
}
else if (_direction == Direction::DOWN)
else if (_direction == Direction::Down)
{
_posDelta = Vector(0, height);
_startPos = Point(0, -height);
}
else if (_direction == Direction::LEFT)
else if (_direction == Direction::Left)
{
_posDelta = Vector(-width, 0);
_startPos = Point(width, 0);
}
else if (_direction == Direction::RIGHT)
else if (_direction == Direction::Right)
{
_posDelta = Vector(width, 0);
_startPos = Point(-width, 0);

View File

@ -57,11 +57,11 @@ public:
// 鼠标指针样式
enum class Cursor : int
{
NORMAL, /* 默认指针样式 */
HAND, /* 手状指针 */
NO, /* 禁止指针 */
WAIT, /* 沙漏指针 */
ARROW_WAIT /* 默认指针和小沙漏 */
Normal, /* 默认指针样式 */
Hand, /* 手状指针 */
No, /* 禁止指针 */
Wait, /* 沙漏指针 */
ArrowWait /* 默认指针和小沙漏 */
};
public:
@ -103,7 +103,7 @@ public:
// 打开/隐藏控制台
static void showConsole(
bool show
bool show = true
);
// 是否允许响应输入法
@ -194,25 +194,22 @@ public:
// 鼠标键值
enum class Mouse : int
{
LEFT, /* 鼠标左键 */
RIGHT, /* 鼠标右键 */
MIDDLE /* 鼠标中键 */
Left, /* 鼠标左键 */
Right, /* 鼠标右键 */
Middle /* 鼠标中键 */
};
// 键盘键值
enum class Key : int
{
UP = 0xC8,
LEFT = 0xCB,
RIGHT = 0xCD,
DOWN = 0xD0,
ENTER = 0x1C,
SPACE = 0x39,
ESC = 0x01,
BACK = 0x0E,
TAB = 0x0F,
PAUSE = 0xC5,
Up = 0xC8,
Left = 0xCB,
Right = 0xCD,
Down = 0xD0,
Enter = 0x1C,
Space = 0x39,
Esc = 0x01,
Q = 0x10,
W = 0x11,
E = 0x12,
@ -239,26 +236,26 @@ public:
B = 0x30,
N = 0x31,
M = 0x32,
NUM1 = 0x02,
NUM2 = 0x03,
NUM3 = 0x04,
NUM4 = 0x05,
NUM5 = 0x06,
NUM6 = 0x07,
NUM7 = 0x08,
NUM8 = 0x09,
NUM9 = 0x0A,
NUM0 = 0x0B,
NUMPAD7 = 0x47,
NUMPAD8 = 0x48,
NUMPAD9 = 0x49,
NUMPAD4 = 0x4B,
NUMPAD5 = 0x4C,
NUMPAD6 = 0x4D,
NUMPAD1 = 0x4F,
NUMPAD2 = 0x50,
NUMPAD3 = 0x51,
NUMPAD0 = 0x52
Num1 = 0x02,
Num2 = 0x03,
Num3 = 0x04,
Num4 = 0x05,
Num5 = 0x06,
Num6 = 0x07,
Num7 = 0x08,
Num8 = 0x09,
Num9 = 0x0A,
Num0 = 0x0B,
Numpad7 = 0x47,
Numpad8 = 0x48,
Numpad9 = 0x49,
Numpad4 = 0x4B,
Numpad5 = 0x4C,
Numpad6 = 0x4D,
Numpad1 = 0x4F,
Numpad2 = 0x50,
Numpad3 = 0x51,
Numpad0 = 0x52
};
public:

View File

@ -130,20 +130,20 @@ public:
// 碰撞体类别
enum class Type
{
NONE, /* 无 */
RECT, /* 矩形 */
CIRCLE, /* 圆形 */
ELLIPSE /* 椭圆形 */
None, /* 无 */
Rect, /* 矩形 */
Circle, /* 圆形 */
Ellipse /* 椭圆形 */
};
// 碰撞体交集关系
enum class Relation : int
{
UNKNOWN = 0, /* 关系不确定 */
DISJOIN = 1, /* 没有交集 */
IS_CONTAINED = 2, /* 完全被包含 */
CONTAINS = 3, /* 完全包含 */
OVERLAP = 4 /* 部分重叠 */
Unknown = 0, /* 关系不确定 */
Disjoin = 1, /* 没有交集 */
IsContained = 2, /* 完全被包含 */
Contains = 3, /* 完全包含 */
Overlap = 4 /* 部分重叠 */
};
public:

View File

@ -8,19 +8,19 @@ namespace e2d
// 方向
enum class Direction : int
{
UP, /* ÉÏ */
DOWN, /* ÏÂ */
LEFT, /* ×ó */
RIGHT /* ÓÒ */
Up, /* ÉÏ */
Down, /* ÏÂ */
Left, /* ×ó */
Right /* ÓÒ */
};
// 线条相交样式
enum class LineJoin : int
{
MITER = 0, /* бÇÐ */
BEVEL = 1, /* б½Ç */
ROUND = 2 /* Ô²½Ç */
Miter = 0, /* бÇÐ */
Bevel = 1, /* б½Ç */
Round = 2 /* Ô²½Ç */
};
@ -307,58 +307,56 @@ public:
D2D1_COLOR_F toD2DColorF() const;
public:
enum RGB_VALUE : UINT
enum Value : UINT
{
BLACK = 0x000000,
BLUE = 0x0000FF,
BLUE_VIOLET = 0x8A2BE2,
BROWN = 0xA52A2A,
CHOCOLATE = 0xD2691E,
DARK_BLUE = 0x00008B,
DARK_GRAY = 0xA9A9A9,
DARK_GREEN = 0x006400,
DARK_ORANGE = 0xFF8C00,
DARK_RED = 0x8B0000,
DARK_VIOLET = 0x9400D3,
FOREST_GREEN = 0x228B22,
GOLD = 0xFFD700,
GRAY = 0x808080,
GREEN = 0x008000,
GREEN_YELLOW = 0xADFF2F,
LIGHT_BLUE = 0xADD8E6,
LIGHT_CYAN = 0xE0FFFF,
LIGHT_GOLDENROD_YELLOW = 0xFAFAD2,
LIGHT_GREEN = 0x90EE90,
LIGHT_GRAY = 0xD3D3D3,
LIGHT_PINK = 0xFFB6C1,
LIGHT_SEA_GREEN = 0x20B2AA,
LIGHT_SKY_BLUE = 0x87CEFA,
LIGHT_SLATE_GRAY = 0x778899,
LIGHT_YELLOW = 0xFFFFE0,
ORANGE = 0xFFA500,
ORANGE_RED = 0xFF4500,
PINK = 0xFFC0CB,
PURPLE = 0x800080,
RED = 0xFF0000,
SILVER = 0xC0C0C0,
SKY_BLUE = 0x87CEEB,
SNOW = 0xFFFAFA,
VIOLET = 0xEE82EE,
WHEAT = 0xF5DEB3,
WHITE = 0xFFFFFF,
WHITE_SMOKE = 0xF5F5F5,
WOOD = 0xDEB887,
YELLOW = 0xFFFF00,
YELLOW_GREEN = 0x9ACD32
Black = 0x000000,
Blue = 0x0000FF,
BlueViolet = 0x8A2BE2,
Brown = 0xA52A2A,
Chocolate = 0xD2691E,
DarkBlue = 0x00008B,
DarkGray = 0xA9A9A9,
DarkGreen = 0x006400,
DarkOrange = 0xFF8C00,
DarkRed = 0x8B0000,
DarkViolet = 0x9400D3,
ForestGreen = 0x228B22,
Gold = 0xFFD700,
Gray = 0x808080,
Green = 0x008000,
GreenYellow = 0xADFF2F,
LightBlue = 0xADD8E6,
LightCyan = 0xE0FFFF,
LightGreen = 0x90EE90,
LightGray = 0xD3D3D3,
LightPink = 0xFFB6C1,
LightSeaGreen = 0x20B2AA,
LightSkyBlue = 0x87CEFA,
LightYellow = 0xFFFFE0,
Orange = 0xFFA500,
OrangeRed = 0xFF4500,
Pink = 0xFFC0CB,
Purple = 0x800080,
Red = 0xFF0000,
Silver = 0xC0C0C0,
SkyBlue = 0x87CEEB,
Snow = 0xFFFAFA,
Violet = 0xEE82EE,
Wheat = 0xF5DEB3,
White = 0xFFFFFF,
WhiteSmoke = 0xF5F5F5,
Wood = 0xDEB887,
Yellow = 0xFFFF00,
Yellow_Green = 0x9ACD32
};
protected:
private:
void _init(
UINT rgb,
double alpha
);
public:
private:
float r;
float g;
float b;
@ -414,17 +412,15 @@ 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
Thin = 100,
ExtraLight = 200,
Light = 300,
Normal = 400,
Medium = 500,
Bold = 700,
ExtraBold = 800,
Black = 900,
ExtraBlack = 950
};
public:
@ -433,7 +429,7 @@ public:
explicit Font(
const String& family,
double size = 22,
UINT weight = Font::Weight::NORMAL,
UINT weight = Font::Weight::Normal,
bool italic = false
);
};

View File

@ -535,11 +535,11 @@ class Text :
{
public:
// 文本对齐方式
enum class Align : int
enum class Align
{
LEFT, /* 左对齐 */
RIGHT, /* 右对齐 */
CENTER /* 居中对齐 */
Left, /* 左对齐 */
Right, /* 右对齐 */
Center /* 居中对齐 */
};
// 文本样式
@ -563,16 +563,16 @@ public:
Style(
Color color,
Align alignment = Align::LEFT,
Align alignment = Align::Left,
bool wrapping = false,
double wrappingWidth = 0.0,
double lineSpacing = 0.0,
bool hasUnderline = false,
bool hasStrikethrough = false,
bool hasOutline = true,
Color outlineColor = Color(Color::BLACK, 0.5),
Color outlineColor = Color(Color::Black, 0.5),
double outlineWidth = 1.0,
LineJoin outlineJoin = LineJoin::ROUND
LineJoin outlineJoin = LineJoin::Round
);
};
@ -657,7 +657,7 @@ public:
double size
);
// 设置字体粗细值(默认值为 Text::Font::Weight::NORMAL
// 设置字体粗细值(默认值为 Text::Font::Weight::Normal
void setFontWeight(
UINT weight
);
@ -687,7 +687,7 @@ public:
double lineSpacing
);
// 设置对齐方式(默认为 Align::LEFT
// 设置对齐方式(默认为 Align::Left
void setAlignment(
Align align
);
@ -811,7 +811,7 @@ public:
protected:
// 按钮状态枚举
enum class ButtonState { NORMAL, MOUSEOVER, SELECTED };
enum class ButtonState { Normal, Mouseover, Selected };
// 设置按钮状态
virtual void _setState(ButtonState state);

View File

@ -13,9 +13,9 @@ public:
// ÐÎ×´Ñùʽ
enum class Style
{
SOLID, /* Ìî³ä */
ROUND, /* ÂÖÀª */
FILL, /* ÂÖÀª + Ìî³ä */
Solid, /* Ìî³ä */
Round, /* ÂÖÀª */
Fill, /* ÂÖÀª + Ìî³ä */
};
public:

View File

@ -135,7 +135,7 @@ class MoveTransition :
public:
explicit MoveTransition(
double moveDuration, /* 场景移动动画持续时长 */
Direction direction = Direction::LEFT /* 场景移动方向 */
Direction direction = Direction::Left /* 场景移动方向 */
);
protected: