移除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; _func = func;
} }
void e2d::Button::onFixedUpdate() void e2d::Button::_fixedUpdate()
{ {
if (SceneManager::isTransitioning()) if (SceneManager::isTransitioning())
return; return;

View File

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

View File

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