移除onFixedUpdate函数

This commit is contained in:
Nomango 2018-05-19 00:00:12 +08:00
parent aa053ad269
commit 551cbaa2b2
3 changed files with 17 additions and 19 deletions

View File

@ -202,7 +202,7 @@ void e2d::Button::setClickFunc(const Function& func)
_func = func;
}
void e2d::Button::onFixedUpdate()
void e2d::Button::_fixedUpdate()
{
if (SceneManager::isTransitioning())
return;

View File

@ -92,14 +92,11 @@ void e2d::Node::_update()
}
}
if (_autoUpdate)
if (_autoUpdate && !Game::isPaused())
{
if (!Game::isPaused())
{
this->onUpdate();
}
this->onFixedUpdate();
this->onUpdate();
}
this->_fixedUpdate();
// 访问剩余节点
for (; i < size; ++i)
@ -107,14 +104,11 @@ void e2d::Node::_update()
}
else
{
if (_autoUpdate)
if (_autoUpdate && !Game::isPaused())
{
if (!Game::isPaused())
{
this->onUpdate();
}
this->onFixedUpdate();
this->onUpdate();
}
this->_fixedUpdate();
}
}
@ -236,6 +230,10 @@ void e2d::Node::_updateOpacity()
}
}
void e2d::Node::_fixedUpdate()
{
}
bool e2d::Node::isVisiable() const
{
return _visiable;

View File

@ -48,9 +48,6 @@ public:
// 更新节点
virtual void onUpdate() {}
// 固定地更新(游戏暂停时仍然运行)
virtual void onFixedUpdate() {}
// 渲染节点
virtual void onRender() {}
@ -459,6 +456,9 @@ protected:
// 更新节点透明度
void _updateOpacity();
// 固定更新
virtual void _fixedUpdate();
protected:
String _name;
unsigned _hashName;
@ -963,9 +963,6 @@ public:
const Function& func
);
// 更新按钮状态
virtual void onFixedUpdate() override;
protected:
// 按钮状态枚举
enum class ButtonState { NORMAL, MOUSEOVER, SELECTED };
@ -979,6 +976,9 @@ protected:
// 执行按钮函数对象
virtual void _runCallback();
// 更新按钮状态
virtual void _fixedUpdate() override;
protected:
Node * _normal;
Node * _mouseover;