diff --git a/.gitignore b/.gitignore index e3c6c268..517bdfb1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ Release/ ipch/ *.opensdf *.sdf +*.suo *.user *.lnk diff --git a/core/Action/EActionLoop.cpp b/core/Action/EActionLoop.cpp index 63f0a3e2..c25ea8cd 100644 --- a/core/Action/EActionLoop.cpp +++ b/core/Action/EActionLoop.cpp @@ -5,6 +5,7 @@ e2d::EActionLoop::EActionLoop(EAction * action, int times /* = -1 */) , m_nTimes(0) , m_nTotalTimes(times) { + ASSERT(m_pAction != nullptr, "EActionLoop NULL pointer exception!"); m_pAction->retain(); } diff --git a/core/Action/EActionSequence.cpp b/core/Action/EActionSequence.cpp index e2771639..7f18f148 100644 --- a/core/Action/EActionSequence.cpp +++ b/core/Action/EActionSequence.cpp @@ -13,6 +13,7 @@ e2d::EActionSequence::EActionSequence(int number, EAction * action1, ...) : while (number > 0) { + ASSERT((*ppAction) != nullptr, "EActionSequence NULL pointer exception!"); this->addAction(*ppAction); ppAction++; number--; diff --git a/core/Action/EActionTwo.cpp b/core/Action/EActionTwo.cpp index 72b5c4a6..e3a33082 100644 --- a/core/Action/EActionTwo.cpp +++ b/core/Action/EActionTwo.cpp @@ -4,6 +4,7 @@ e2d::EActionTwo::EActionTwo(EAction * actionFirst, EAction * actionSecond) : m_pFirstAction(actionFirst), m_pSecondAction(actionSecond) { + ASSERT(m_pFirstAction && m_pSecondAction, "EActionTwo NULL pointer exception!"); m_pFirstAction->retain(); m_pSecondAction->retain(); } diff --git a/core/Action/EActionTwoAtSameTime.cpp b/core/Action/EActionTwoAtSameTime.cpp index 0b8d3642..e52c47d7 100644 --- a/core/Action/EActionTwoAtSameTime.cpp +++ b/core/Action/EActionTwoAtSameTime.cpp @@ -4,6 +4,7 @@ e2d::EActionTwoAtSameTime::EActionTwoAtSameTime(EAction * actionFirst, EAction * m_pFirstAction(actionFirst), m_pSecondAction(actionSecond) { + ASSERT(m_pFirstAction && m_pSecondAction, "EActionTwoAtSameTime NULL pointer exception!"); m_pFirstAction->retain(); m_pSecondAction->retain(); } diff --git a/core/Base/EApp.cpp b/core/Base/EApp.cpp index 1026359d..d7984dd0 100644 --- a/core/Base/EApp.cpp +++ b/core/Base/EApp.cpp @@ -392,8 +392,6 @@ void e2d::EApp::_render() } // 终止绘图 hr = GetRenderTarget()->EndDraw(); - // 刷新界面 - UpdateWindow(GetHWnd()); if (hr == D2DERR_RECREATE_TARGET) { diff --git a/core/Base/EScene.cpp b/core/Base/EScene.cpp index c32c5dca..39ce17ef 100644 --- a/core/Base/EScene.cpp +++ b/core/Base/EScene.cpp @@ -52,12 +52,11 @@ void e2d::EScene::_render() // 访问根节点 m_pRoot->_update(); - // 恢复矩阵转换 - GetRenderTarget()->SetTransform(D2D1::Matrix3x2F::Identity()); - - // 绘制所有几何图形 if (m_bGeometryVisiable) { + // 恢复矩阵转换 + GetRenderTarget()->SetTransform(D2D1::Matrix3x2F::Identity()); + // 绘制所有几何图形 m_pRoot->_drawGeometry(); } } diff --git a/core/Common/EString.cpp b/core/Common/EString.cpp index c02b12aa..55dff9c7 100644 --- a/core/Common/EString.cpp +++ b/core/Common/EString.cpp @@ -28,8 +28,7 @@ EString::EString(const wchar_t *str) } else { - _string = nullptr; - _size = 0; + this->EString::EString(); } } @@ -50,8 +49,7 @@ EString::EString(const EString &str) } else { - _string = nullptr; - _size = 0; + this->EString::EString(); } } @@ -65,8 +63,7 @@ e2d::EString::EString(const std::wstring &str) } else { - _string = nullptr; - _size = 0; + this->EString::EString(); } } diff --git a/core/Manager/EMsgManager.cpp b/core/Manager/EMsgManager.cpp index 21b2cd99..a64e8265 100644 --- a/core/Manager/EMsgManager.cpp +++ b/core/Manager/EMsgManager.cpp @@ -20,7 +20,7 @@ void e2d::EMsgManager::MouseProc(UINT message, WPARAM wParam, LPARAM lParam) if (s_vMouseListeners.empty()) return; // 执行鼠标消息监听函数 - std::vector::size_type i = s_vMouseListeners.size(); + size_t i = s_vMouseListeners.size(); do { @@ -45,7 +45,7 @@ void e2d::EMsgManager::KeyboardProc(UINT message, WPARAM wParam, LPARAM lParam) if (s_vKeyboardListeners.empty()) return; // 执行按键消息监听函数 - std::vector::size_type i = s_vKeyboardListeners.size(); + size_t i = s_vKeyboardListeners.size(); do { diff --git a/core/Manager/EPhysicsManager.cpp b/core/Manager/EPhysicsManager.cpp index 8094d274..044c6c38 100644 --- a/core/Manager/EPhysicsManager.cpp +++ b/core/Manager/EPhysicsManager.cpp @@ -49,7 +49,7 @@ void e2d::EPhysicsManager::PhysicsGeometryProc(EGeometry * pActiveGeometry) void e2d::EPhysicsManager::PhysicsListenerProc() { // 执行鼠标消息监听函数 - std::vector::size_type i = s_vListeners.size(); + size_t i = s_vListeners.size(); do { diff --git a/core/Node/EButton.cpp b/core/Node/EButton.cpp index 4dd4bc8f..5d71292a 100644 --- a/core/Node/EButton.cpp +++ b/core/Node/EButton.cpp @@ -14,9 +14,7 @@ e2d::EButton::EButton() , m_pDisabled(nullptr) , m_pListener(nullptr) { - m_pListener = new EListenerMouse(std::bind(&EButton::_updateStatus, this)); - m_pListener->setAlwaysWorking(true); - EMsgManager::bindListener(m_pListener, this); + this->_init(); } e2d::EButton::EButton(ENode * normal, const BUTTON_CLICK_CALLBACK & callback) @@ -30,6 +28,7 @@ e2d::EButton::EButton(ENode * normal, const BUTTON_CLICK_CALLBACK & callback) , m_pDisabled(nullptr) , m_pListener(nullptr) { + this->_init(); this->setNormal(normal); this->setCallback(callback); } @@ -45,6 +44,7 @@ e2d::EButton::EButton(ENode * normal, ENode * selected, const BUTTON_CLICK_CALLB , m_pDisabled(nullptr) , m_pListener(nullptr) { + this->_init(); this->setNormal(normal); this->setSelected(selected); this->setCallback(callback); @@ -61,6 +61,7 @@ e2d::EButton::EButton(ENode * normal, ENode * mouseover, ENode * selected, const , m_pDisabled(nullptr) , m_pListener(nullptr) { + this->_init(); this->setNormal(normal); this->setMouseOver(mouseover); this->setSelected(selected); @@ -78,6 +79,7 @@ e2d::EButton::EButton(ENode * normal, ENode * mouseover, ENode * selected, ENode , m_pDisabled(nullptr) , m_pListener(nullptr) { + this->_init(); this->setNormal(normal); this->setMouseOver(mouseover); this->setSelected(selected); @@ -215,6 +217,13 @@ void e2d::EButton::setPivot(float pivotX, float pivotY) if (m_pDisabled) m_pDisabled->setPivot(pivotX, pivotY); } +void e2d::EButton::_init() +{ + m_pListener = new EListenerMouse(std::bind(&EButton::_updateStatus, this)); + m_pListener->setAlwaysWorking(true); + EMsgManager::bindListener(m_pListener, this); +} + void e2d::EButton::_setStatus(STATUS status) { if (m_eStatus != status) diff --git a/core/Node/ENode.cpp b/core/Node/ENode.cpp index 01890067..4ccf8e15 100644 --- a/core/Node/ENode.cpp +++ b/core/Node/ENode.cpp @@ -56,7 +56,7 @@ e2d::ENode::ENode(const EString & name) , m_bSortChildrenNeeded(false) , m_bTransformNeeded(false) { - setName(name); + this->setName(name); } e2d::ENode::~ENode() diff --git a/core/Node/ESprite.cpp b/core/Node/ESprite.cpp index 5c9b836b..d2205ed3 100644 --- a/core/Node/ESprite.cpp +++ b/core/Node/ESprite.cpp @@ -34,6 +34,9 @@ e2d::ESprite::ESprite(const EString & imageFileName) } e2d::ESprite::ESprite(const EString & imageFileName, float x, float y, float width, float height) + : m_fSourceClipX(0) + , m_fSourceClipY(0) + , m_pTexture(nullptr) { loadFrom(imageFileName); clip(x, y, width, height); @@ -48,6 +51,9 @@ e2d::ESprite::ESprite(LPCTSTR resourceName, LPCTSTR resourceType) } e2d::ESprite::ESprite(LPCTSTR resourceName, LPCTSTR resourceType, float x, float y, float width, float height) + : m_fSourceClipX(0) + , m_fSourceClipY(0) + , m_pTexture(nullptr) { loadFrom(resourceName, resourceType); clip(x, y, width, height); diff --git a/core/Node/EText.cpp b/core/Node/EText.cpp index e67d7fb9..20aee8b5 100644 --- a/core/Node/EText.cpp +++ b/core/Node/EText.cpp @@ -36,6 +36,9 @@ e2d::EText::EText(const EString & text, EFont * font) } e2d::EText::EText(const EString & text, EString fontFamily, float fontSize, UINT32 color, UINT32 fontWeight, bool italic) + : m_bWordWrapping(false) + , m_pFont(nullptr) + , m_fWordWrappingWidth(0) { this->setText(text); this->setFont(new EFont(fontFamily, fontSize, color, fontWeight, italic)); diff --git a/core/Transition/ETransition.cpp b/core/Transition/ETransition.cpp index 73c06de8..d57bddaa 100644 --- a/core/Transition/ETransition.cpp +++ b/core/Transition/ETransition.cpp @@ -9,6 +9,7 @@ e2d::ETransition::ETransition(float duration) , m_pPrevScene(nullptr) , m_pNextScene(nullptr) { + SetInterval(m_nAnimationInterval, 15LL); } bool e2d::ETransition::isEnding() diff --git a/core/easy2d.h b/core/easy2d.h index 8ca0a152..4efe644d 100644 --- a/core/easy2d.h +++ b/core/easy2d.h @@ -13,7 +13,7 @@ #endif #if _MSC_VER < 1600 - #error Do Visual Studio 2015/2017 specific stuff + #error MSVC version is too low #endif diff --git a/core/enodes.h b/core/enodes.h index c1493952..b4a73d99 100644 --- a/core/enodes.h +++ b/core/enodes.h @@ -671,6 +671,9 @@ public: protected: enum STATUS { NORMAL, MOUSEOVER, SELECTED }; + // 初始化按钮 + virtual void _init(); + // 设置按钮状态 virtual void _setStatus(STATUS status); diff --git a/prebuilt/vs2010/Easy2Ddw.lib b/prebuilt/vs2010/Easy2Ddw.lib new file mode 100644 index 00000000..8062f66c Binary files /dev/null and b/prebuilt/vs2010/Easy2Ddw.lib differ diff --git a/prebuilt/vs2010/Easy2Dw.lib b/prebuilt/vs2010/Easy2Dw.lib new file mode 100644 index 00000000..87431162 Binary files /dev/null and b/prebuilt/vs2010/Easy2Dw.lib differ diff --git a/prebuilt/vs2017/Easy2Ddw.lib b/prebuilt/vs2017/Easy2Ddw.lib new file mode 100644 index 00000000..1813bcb7 Binary files /dev/null and b/prebuilt/vs2017/Easy2Ddw.lib differ diff --git a/prebuilt/vs2017/Easy2Dw.lib b/prebuilt/vs2017/Easy2Dw.lib new file mode 100644 index 00000000..cb04b508 Binary files /dev/null and b/prebuilt/vs2017/Easy2Dw.lib differ