fixed bugs

This commit is contained in:
Nomango 2017-12-16 15:49:48 +08:00
parent 26ba7e0fd4
commit b71119548a
21 changed files with 41 additions and 20 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@ Release/
ipch/
*.opensdf
*.sdf
*.suo
*.user
*.lnk

View File

@ -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();
}

View File

@ -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--;

View File

@ -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();
}

View File

@ -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();
}

View File

@ -392,8 +392,6 @@ void e2d::EApp::_render()
}
// ÖÕÖ¹»æÍ¼
hr = GetRenderTarget()->EndDraw();
// 刷新界面
UpdateWindow(GetHWnd());
if (hr == D2DERR_RECREATE_TARGET)
{

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -20,7 +20,7 @@ void e2d::EMsgManager::MouseProc(UINT message, WPARAM wParam, LPARAM lParam)
if (s_vMouseListeners.empty()) return;
// 执行鼠标消息监听函数
std::vector<EListenerMouse*>::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<EListenerMouse*>::size_type i = s_vKeyboardListeners.size();
size_t i = s_vKeyboardListeners.size();
do
{

View File

@ -49,7 +49,7 @@ void e2d::EPhysicsManager::PhysicsGeometryProc(EGeometry * pActiveGeometry)
void e2d::EPhysicsManager::PhysicsListenerProc()
{
// 执行鼠标消息监听函数
std::vector<EListenerPhysics*>::size_type i = s_vListeners.size();
size_t i = s_vListeners.size();
do
{

View File

@ -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)

View File

@ -56,7 +56,7 @@ e2d::ENode::ENode(const EString & name)
, m_bSortChildrenNeeded(false)
, m_bTransformNeeded(false)
{
setName(name);
this->setName(name);
}
e2d::ENode::~ENode()

View File

@ -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);

View File

@ -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));

View File

@ -9,6 +9,7 @@ e2d::ETransition::ETransition(float duration)
, m_pPrevScene(nullptr)
, m_pNextScene(nullptr)
{
SetInterval(m_nAnimationInterval, 15LL);
}
bool e2d::ETransition::isEnding()

View File

@ -13,7 +13,7 @@
#endif
#if _MSC_VER < 1600
#error Do Visual Studio 2015/2017 specific stuff
#error MSVC version is too low
#endif

View File

@ -671,6 +671,9 @@ public:
protected:
enum STATUS { NORMAL, MOUSEOVER, SELECTED };
// ³õʼ»¯°´Å¥
virtual void _init();
// ÉèÖð´Å¥×´Ì¬
virtual void _setStatus(STATUS status);

Binary file not shown.

BIN
prebuilt/vs2010/Easy2Dw.lib Normal file

Binary file not shown.

Binary file not shown.

BIN
prebuilt/vs2017/Easy2Dw.lib Normal file

Binary file not shown.