移除Config中的不合理设置
This commit is contained in:
parent
840b554190
commit
614873dfb6
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
e2d::Config::Config()
|
e2d::Config::Config()
|
||||||
: _gameName()
|
: _gameName()
|
||||||
, _defaultNodePivot()
|
|
||||||
, _soundEnabled(true)
|
, _soundEnabled(true)
|
||||||
, _frameInterval(15)
|
, _frameInterval(15)
|
||||||
, _showFps(false)
|
, _showFps(false)
|
||||||
|
|
@ -11,7 +10,6 @@ e2d::Config::Config()
|
||||||
, _outlineVisible(false)
|
, _outlineVisible(false)
|
||||||
, _collisionEnabled(false)
|
, _collisionEnabled(false)
|
||||||
, _colliderVisible(false)
|
, _colliderVisible(false)
|
||||||
, _defaultColliderShape(Collider::Shape::None)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,19 +52,6 @@ void e2d::Config::setCollisionEnabled(bool enabled)
|
||||||
_collisionEnabled = enabled;
|
_collisionEnabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::Config::setNodeDefaultPivot(Point pivot)
|
|
||||||
{
|
|
||||||
_defaultNodePivot = Point(
|
|
||||||
std::min(std::max(pivot.x, 0.f), 1.f),
|
|
||||||
std::min(std::max(pivot.y, 0.f), 1.f)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void e2d::Config::setDefaultColliderShape(Collider::Shape shape)
|
|
||||||
{
|
|
||||||
_defaultColliderShape = shape;
|
|
||||||
}
|
|
||||||
|
|
||||||
void e2d::Config::setColliderVisible(bool visible)
|
void e2d::Config::setColliderVisible(bool visible)
|
||||||
{
|
{
|
||||||
_colliderVisible = visible;
|
_colliderVisible = visible;
|
||||||
|
|
@ -107,16 +92,6 @@ bool e2d::Config::isCollisionEnabled() const
|
||||||
return _collisionEnabled;
|
return _collisionEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::Point e2d::Config::getNodeDefaultPivot() const
|
|
||||||
{
|
|
||||||
return _defaultNodePivot;
|
|
||||||
}
|
|
||||||
|
|
||||||
e2d::Collider::Shape e2d::Config::getDefaultColliderShape() const
|
|
||||||
{
|
|
||||||
return _defaultColliderShape;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool e2d::Config::isColliderVisible() const
|
bool e2d::Config::isColliderVisible() const
|
||||||
{
|
{
|
||||||
return _colliderVisible;
|
return _colliderVisible;
|
||||||
|
|
@ -12,7 +12,7 @@ e2d::Duration::Duration(int ms)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::Duration::Duration(std::chrono::milliseconds ms)
|
e2d::Duration::Duration(const std::chrono::milliseconds& ms)
|
||||||
: _ms(ms)
|
: _ms(ms)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ e2d::Time::Time()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::Time::Time(std::chrono::steady_clock::time_point time)
|
e2d::Time::Time(const std::chrono::steady_clock::time_point& time)
|
||||||
: _timePoint(time)
|
: _timePoint(time)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ void e2d::Button::setNormal(Node * normal)
|
||||||
// 添加新的
|
// 添加新的
|
||||||
if (normal)
|
if (normal)
|
||||||
{
|
{
|
||||||
|
normal->setPivot(_pivotX, _pivotY);
|
||||||
this->addChild(normal);
|
this->addChild(normal);
|
||||||
this->setSize(normal->getWidth(), normal->getHeight());
|
this->setSize(normal->getWidth(), normal->getHeight());
|
||||||
}
|
}
|
||||||
|
|
@ -116,6 +117,7 @@ void e2d::Button::setMouseOver(Node * mouseover)
|
||||||
// 添加新的
|
// 添加新的
|
||||||
if (mouseover)
|
if (mouseover)
|
||||||
{
|
{
|
||||||
|
mouseover->setPivot(_pivotX, _pivotY);
|
||||||
this->addChild(mouseover);
|
this->addChild(mouseover);
|
||||||
}
|
}
|
||||||
_mouseover = mouseover;
|
_mouseover = mouseover;
|
||||||
|
|
@ -135,6 +137,7 @@ void e2d::Button::setSelected(Node * selected)
|
||||||
// 添加新的
|
// 添加新的
|
||||||
if (selected)
|
if (selected)
|
||||||
{
|
{
|
||||||
|
selected->setPivot(_pivotX, _pivotY);
|
||||||
this->addChild(selected);
|
this->addChild(selected);
|
||||||
}
|
}
|
||||||
_selected = selected;
|
_selected = selected;
|
||||||
|
|
@ -154,6 +157,7 @@ void e2d::Button::setDisabled(Node * disabled)
|
||||||
// 添加新的
|
// 添加新的
|
||||||
if (disabled)
|
if (disabled)
|
||||||
{
|
{
|
||||||
|
disabled->setPivot(_pivotX, _pivotY);
|
||||||
this->addChild(disabled);
|
this->addChild(disabled);
|
||||||
}
|
}
|
||||||
_disabled = disabled;
|
_disabled = disabled;
|
||||||
|
|
@ -175,6 +179,15 @@ void e2d::Button::setClickFunc(const Function& func)
|
||||||
_func = func;
|
_func = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void e2d::Button::setPivot(float pivotX, float pivotY)
|
||||||
|
{
|
||||||
|
Node::setPivot(pivotX, pivotY);
|
||||||
|
SAFE_SET(_normal, setPivot, pivotX, pivotY);
|
||||||
|
SAFE_SET(_mouseover, setPivot, pivotX, pivotY);
|
||||||
|
SAFE_SET(_selected, setPivot, pivotX, pivotY);
|
||||||
|
SAFE_SET(_disabled, setPivot, pivotX, pivotY);
|
||||||
|
}
|
||||||
|
|
||||||
void e2d::Button::_update()
|
void e2d::Button::_update()
|
||||||
{
|
{
|
||||||
Node::_update();
|
Node::_update();
|
||||||
|
|
|
||||||
|
|
@ -69,10 +69,6 @@ e2d::Node::Node()
|
||||||
, _collider(this)
|
, _collider(this)
|
||||||
, _extrapolate(Property::Origin)
|
, _extrapolate(Property::Origin)
|
||||||
{
|
{
|
||||||
Point defPivot = Game::getInstance()->getConfig().getNodeDefaultPivot();
|
|
||||||
_pivotX = defPivot.x;
|
|
||||||
_pivotY = defPivot.y;
|
|
||||||
_collider.setShape(Game::getInstance()->getConfig().getDefaultColliderShape());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::Node::~Node()
|
e2d::Node::~Node()
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@
|
||||||
if (Old) this->removeChild(Old); \
|
if (Old) this->removeChild(Old); \
|
||||||
if (New) \
|
if (New) \
|
||||||
{ \
|
{ \
|
||||||
|
New->setPivot(_pivotX, _pivotY); \
|
||||||
this->addChild(New); \
|
this->addChild(New); \
|
||||||
this->setSize(New->getWidth(), New->getHeight()); \
|
|
||||||
} \
|
} \
|
||||||
Old = New; \
|
Old = New; \
|
||||||
_updateState(); \
|
_updateState(); \
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
e2d::ToggleButton::ToggleButton()
|
e2d::ToggleButton::ToggleButton()
|
||||||
: Button()
|
: Button()
|
||||||
, _toggle(true)
|
, _checked(true)
|
||||||
, _normalOn(nullptr)
|
, _normalOn(nullptr)
|
||||||
, _mouseoverOn(nullptr)
|
, _mouseoverOn(nullptr)
|
||||||
, _selectedOn(nullptr)
|
, _selectedOn(nullptr)
|
||||||
|
|
@ -33,7 +33,7 @@ e2d::ToggleButton::ToggleButton()
|
||||||
|
|
||||||
e2d::ToggleButton::ToggleButton(Node * toggleOnNormal, Node * toggleOffNormal, const Function& func)
|
e2d::ToggleButton::ToggleButton(Node * toggleOnNormal, Node * toggleOffNormal, const Function& func)
|
||||||
: Button()
|
: Button()
|
||||||
, _toggle(true)
|
, _checked(true)
|
||||||
, _normalOn(nullptr)
|
, _normalOn(nullptr)
|
||||||
, _mouseoverOn(nullptr)
|
, _mouseoverOn(nullptr)
|
||||||
, _selectedOn(nullptr)
|
, _selectedOn(nullptr)
|
||||||
|
|
@ -50,7 +50,7 @@ e2d::ToggleButton::ToggleButton(Node * toggleOnNormal, Node * toggleOffNormal, c
|
||||||
|
|
||||||
e2d::ToggleButton::ToggleButton(Node * toggleOnNormal, Node * toggleOffNormal, Node * toggleOnSelected, Node * toggleOffSelected, const Function& func)
|
e2d::ToggleButton::ToggleButton(Node * toggleOnNormal, Node * toggleOffNormal, Node * toggleOnSelected, Node * toggleOffSelected, const Function& func)
|
||||||
: Button()
|
: Button()
|
||||||
, _toggle(true)
|
, _checked(true)
|
||||||
, _normalOn(nullptr)
|
, _normalOn(nullptr)
|
||||||
, _mouseoverOn(nullptr)
|
, _mouseoverOn(nullptr)
|
||||||
, _selectedOn(nullptr)
|
, _selectedOn(nullptr)
|
||||||
|
|
@ -69,7 +69,7 @@ e2d::ToggleButton::ToggleButton(Node * toggleOnNormal, Node * toggleOffNormal, N
|
||||||
|
|
||||||
e2d::ToggleButton::ToggleButton(Node * toggleOnNormal, Node * toggleOffNormal, Node * toggleOnMouseOver, Node * toggleOffMouseOver, Node * toggleOnSelected, Node * toggleOffSelected, const Function& func)
|
e2d::ToggleButton::ToggleButton(Node * toggleOnNormal, Node * toggleOffNormal, Node * toggleOnMouseOver, Node * toggleOffMouseOver, Node * toggleOnSelected, Node * toggleOffSelected, const Function& func)
|
||||||
: Button()
|
: Button()
|
||||||
, _toggle(true)
|
, _checked(true)
|
||||||
, _normalOn(nullptr)
|
, _normalOn(nullptr)
|
||||||
, _mouseoverOn(nullptr)
|
, _mouseoverOn(nullptr)
|
||||||
, _selectedOn(nullptr)
|
, _selectedOn(nullptr)
|
||||||
|
|
@ -90,7 +90,7 @@ e2d::ToggleButton::ToggleButton(Node * toggleOnNormal, Node * toggleOffNormal, N
|
||||||
|
|
||||||
e2d::ToggleButton::ToggleButton(Node * toggleOnNormal, Node * toggleOffNormal, Node * toggleOnMouseOver, Node * toggleOffMouseOver, Node * toggleOnSelected, Node * toggleOffSelected, Node * toggleOnDisabled, Node * toggleOffDisabled, const Function& func)
|
e2d::ToggleButton::ToggleButton(Node * toggleOnNormal, Node * toggleOffNormal, Node * toggleOnMouseOver, Node * toggleOffMouseOver, Node * toggleOnSelected, Node * toggleOffSelected, Node * toggleOnDisabled, Node * toggleOffDisabled, const Function& func)
|
||||||
: Button()
|
: Button()
|
||||||
, _toggle(true)
|
, _checked(true)
|
||||||
, _normalOff(nullptr)
|
, _normalOff(nullptr)
|
||||||
, _mouseoverOff(nullptr)
|
, _mouseoverOff(nullptr)
|
||||||
, _selectedOff(nullptr)
|
, _selectedOff(nullptr)
|
||||||
|
|
@ -107,16 +107,16 @@ e2d::ToggleButton::ToggleButton(Node * toggleOnNormal, Node * toggleOffNormal, N
|
||||||
this->setClickFunc(func);
|
this->setClickFunc(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool e2d::ToggleButton::getState() const
|
bool e2d::ToggleButton::isChecked() const
|
||||||
{
|
{
|
||||||
return _toggle;
|
return _checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::ToggleButton::setState(bool bState)
|
void e2d::ToggleButton::setChecked(bool checked)
|
||||||
{
|
{
|
||||||
if (_toggle != bState)
|
if (_checked != checked)
|
||||||
{
|
{
|
||||||
_toggle = bState;
|
_checked = checked;
|
||||||
_updateState();
|
_updateState();
|
||||||
_updateVisible();
|
_updateVisible();
|
||||||
}
|
}
|
||||||
|
|
@ -125,6 +125,7 @@ void e2d::ToggleButton::setState(bool bState)
|
||||||
void e2d::ToggleButton::setNormal(Node * normal)
|
void e2d::ToggleButton::setNormal(Node * normal)
|
||||||
{
|
{
|
||||||
SET_BUTTON_NODE(_normalOn, normal);
|
SET_BUTTON_NODE(_normalOn, normal);
|
||||||
|
this->setSize(_normalOn->getWidth(), _normalOn->getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::ToggleButton::setMouseOver(Node * mouseover)
|
void e2d::ToggleButton::setMouseOver(Node * mouseover)
|
||||||
|
|
@ -162,9 +163,22 @@ void e2d::ToggleButton::setDisabledOff(Node * disabled)
|
||||||
SET_BUTTON_NODE(_disabledOff, disabled);
|
SET_BUTTON_NODE(_disabledOff, disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void e2d::ToggleButton::setPivot(float pivotX, float pivotY)
|
||||||
|
{
|
||||||
|
Node::setPivot(pivotX, pivotY);
|
||||||
|
SAFE_SET(_normalOn, setPivot, pivotX, pivotY);
|
||||||
|
SAFE_SET(_mouseoverOn, setPivot, pivotX, pivotY);
|
||||||
|
SAFE_SET(_selectedOn, setPivot, pivotX, pivotY);
|
||||||
|
SAFE_SET(_disabledOn, setPivot, pivotX, pivotY);
|
||||||
|
SAFE_SET(_normalOff, setPivot, pivotX, pivotY);
|
||||||
|
SAFE_SET(_mouseoverOff, setPivot, pivotX, pivotY);
|
||||||
|
SAFE_SET(_selectedOff, setPivot, pivotX, pivotY);
|
||||||
|
SAFE_SET(_disabledOff, setPivot, pivotX, pivotY);
|
||||||
|
}
|
||||||
|
|
||||||
void e2d::ToggleButton::_updateState()
|
void e2d::ToggleButton::_updateState()
|
||||||
{
|
{
|
||||||
if (_toggle)
|
if (_checked)
|
||||||
{
|
{
|
||||||
_normal = _normalOn;
|
_normal = _normalOn;
|
||||||
_mouseover = _mouseoverOn;
|
_mouseover = _mouseoverOn;
|
||||||
|
|
@ -192,7 +206,7 @@ void e2d::ToggleButton::_updateState()
|
||||||
|
|
||||||
void e2d::ToggleButton::_runCallback()
|
void e2d::ToggleButton::_runCallback()
|
||||||
{
|
{
|
||||||
_toggle = !_toggle;
|
_checked = !_checked;
|
||||||
_updateState();
|
_updateState();
|
||||||
|
|
||||||
if (_func)
|
if (_func)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,99 @@ namespace e2d
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// сно╥©ьжф
|
// 配置
|
||||||
|
class Config
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Config();
|
||||||
|
|
||||||
|
virtual ~Config();
|
||||||
|
|
||||||
|
// 修改游戏名称
|
||||||
|
// 默认:空
|
||||||
|
void setGameName(
|
||||||
|
const String& name
|
||||||
|
);
|
||||||
|
|
||||||
|
// 显示或隐藏 FPS
|
||||||
|
// 默认:隐藏
|
||||||
|
void showFps(
|
||||||
|
bool show
|
||||||
|
);
|
||||||
|
|
||||||
|
// 打开或关闭垂直同步
|
||||||
|
// 默认:打开
|
||||||
|
void setVSyncEnabled(
|
||||||
|
bool enabled
|
||||||
|
);
|
||||||
|
|
||||||
|
// 设置帧率刷新间隔(关闭垂直同步时生效)
|
||||||
|
// 默认:15
|
||||||
|
void setFrameInterval(
|
||||||
|
int interval
|
||||||
|
);
|
||||||
|
|
||||||
|
// 显示或隐藏节点轮廓
|
||||||
|
// 默认:隐藏
|
||||||
|
void setOutlineVisible(
|
||||||
|
bool visible
|
||||||
|
);
|
||||||
|
|
||||||
|
// 打开或关闭声音
|
||||||
|
// 默认:打开
|
||||||
|
void setSoundEnabled(
|
||||||
|
bool enabled
|
||||||
|
);
|
||||||
|
|
||||||
|
// 打开或关闭碰撞监听
|
||||||
|
// 默认:关闭
|
||||||
|
void setCollisionEnabled(
|
||||||
|
bool enabled
|
||||||
|
);
|
||||||
|
|
||||||
|
// 打开或关闭碰撞体可视化
|
||||||
|
// 默认:关闭
|
||||||
|
void setColliderVisible(
|
||||||
|
bool visible
|
||||||
|
);
|
||||||
|
|
||||||
|
// 获取游戏名称
|
||||||
|
String getGameName() const;
|
||||||
|
|
||||||
|
// 获取声音打开状态
|
||||||
|
bool isSoundEnabled() const;
|
||||||
|
|
||||||
|
// 获取垂直同步打开状态
|
||||||
|
bool isVSyncEnabled() const;
|
||||||
|
|
||||||
|
// 获取 FPS 显示状态
|
||||||
|
bool isFpsShow() const;
|
||||||
|
|
||||||
|
// 获取帧率刷新间隔
|
||||||
|
int getFrameInterval() const;
|
||||||
|
|
||||||
|
// 获取节点轮廓显示状态
|
||||||
|
bool isOutlineVisible() const;
|
||||||
|
|
||||||
|
// 获取碰撞监听状态
|
||||||
|
bool isCollisionEnabled() const;
|
||||||
|
|
||||||
|
// 获取碰撞体可视化状态
|
||||||
|
bool isColliderVisible() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool _showFps;
|
||||||
|
bool _vSyncEnabled;
|
||||||
|
bool _soundEnabled;
|
||||||
|
bool _outlineVisible;
|
||||||
|
bool _collisionEnabled;
|
||||||
|
bool _colliderVisible;
|
||||||
|
int _frameInterval;
|
||||||
|
String _gameName;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 游戏主体
|
||||||
class Game
|
class Game
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
116
core/e2dcommon.h
116
core/e2dcommon.h
|
|
@ -418,7 +418,7 @@ public:
|
||||||
);
|
);
|
||||||
|
|
||||||
explicit Duration(
|
explicit Duration(
|
||||||
std::chrono::milliseconds ms
|
const std::chrono::milliseconds& ms
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取毫秒数
|
// 获取毫秒数
|
||||||
|
|
@ -449,7 +449,7 @@ public:
|
||||||
Time();
|
Time();
|
||||||
|
|
||||||
explicit Time(
|
explicit Time(
|
||||||
std::chrono::steady_clock::time_point time
|
const std::chrono::steady_clock::time_point& time
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取时间戳
|
// 获取时间戳
|
||||||
|
|
@ -1048,118 +1048,6 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 游戏配置
|
|
||||||
class Config
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Config();
|
|
||||||
|
|
||||||
virtual ~Config();
|
|
||||||
|
|
||||||
// 修改游戏名称
|
|
||||||
// 默认:空
|
|
||||||
void setGameName(
|
|
||||||
const String& name
|
|
||||||
);
|
|
||||||
|
|
||||||
// 显示或隐藏 FPS
|
|
||||||
// 默认:隐藏
|
|
||||||
void showFps(
|
|
||||||
bool show
|
|
||||||
);
|
|
||||||
|
|
||||||
// 打开或关闭垂直同步
|
|
||||||
// 默认:打开
|
|
||||||
void setVSyncEnabled(
|
|
||||||
bool enabled
|
|
||||||
);
|
|
||||||
|
|
||||||
// 设置帧率刷新间隔(关闭垂直同步时生效)
|
|
||||||
// 默认:15
|
|
||||||
void setFrameInterval(
|
|
||||||
int interval
|
|
||||||
);
|
|
||||||
|
|
||||||
// 显示或隐藏节点轮廓
|
|
||||||
// 默认:隐藏
|
|
||||||
void setOutlineVisible(
|
|
||||||
bool visible
|
|
||||||
);
|
|
||||||
|
|
||||||
// 打开或关闭声音
|
|
||||||
// 默认:打开
|
|
||||||
void setSoundEnabled(
|
|
||||||
bool enabled
|
|
||||||
);
|
|
||||||
|
|
||||||
// 打开或关闭碰撞监听
|
|
||||||
// 默认:关闭
|
|
||||||
void setCollisionEnabled(
|
|
||||||
bool enabled
|
|
||||||
);
|
|
||||||
|
|
||||||
// 设置节点的默认中心点位置
|
|
||||||
// 默认:(0,0)
|
|
||||||
void setNodeDefaultPivot(
|
|
||||||
Point pivot
|
|
||||||
);
|
|
||||||
|
|
||||||
// 设置节点的默认碰撞体形状
|
|
||||||
// 默认:Collider::Shape::None
|
|
||||||
void setDefaultColliderShape(
|
|
||||||
Collider::Shape shape
|
|
||||||
);
|
|
||||||
|
|
||||||
// 打开或关闭碰撞体可视化
|
|
||||||
// 默认:关闭
|
|
||||||
void setColliderVisible(
|
|
||||||
bool visible
|
|
||||||
);
|
|
||||||
|
|
||||||
// 获取游戏名称
|
|
||||||
String getGameName() const;
|
|
||||||
|
|
||||||
// 获取声音打开状态
|
|
||||||
bool isSoundEnabled() const;
|
|
||||||
|
|
||||||
// 获取垂直同步打开状态
|
|
||||||
bool isVSyncEnabled() const;
|
|
||||||
|
|
||||||
// 获取 FPS 显示状态
|
|
||||||
bool isFpsShow() const;
|
|
||||||
|
|
||||||
// 获取帧率刷新间隔
|
|
||||||
int getFrameInterval() const;
|
|
||||||
|
|
||||||
// 获取节点轮廓显示状态
|
|
||||||
bool isOutlineVisible() const;
|
|
||||||
|
|
||||||
// 获取碰撞监听状态
|
|
||||||
bool isCollisionEnabled() const;
|
|
||||||
|
|
||||||
// 获取节点的默认中心点位置
|
|
||||||
Point getNodeDefaultPivot() const;
|
|
||||||
|
|
||||||
// 获取节点的默认碰撞体类型
|
|
||||||
Collider::Shape getDefaultColliderShape() const;
|
|
||||||
|
|
||||||
// 获取碰撞体可视化状态
|
|
||||||
bool isColliderVisible() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool _showFps;
|
|
||||||
bool _vSyncEnabled;
|
|
||||||
bool _soundEnabled;
|
|
||||||
bool _outlineVisible;
|
|
||||||
bool _collisionEnabled;
|
|
||||||
bool _colliderVisible;
|
|
||||||
int _frameInterval;
|
|
||||||
String _gameName;
|
|
||||||
Point _defaultNodePivot;
|
|
||||||
Collider::Shape _defaultColliderShape;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -820,6 +820,13 @@ public:
|
||||||
const Function& func
|
const Function& func
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 设置中心点位置
|
||||||
|
// 默认为 (0, 0), 范围 [0, 1]
|
||||||
|
virtual void setPivot(
|
||||||
|
float pivotX,
|
||||||
|
float pivotY
|
||||||
|
) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
E2D_DISABLE_COPY(Button);
|
E2D_DISABLE_COPY(Button);
|
||||||
|
|
||||||
|
|
@ -892,12 +899,12 @@ public:
|
||||||
const Function& func = nullptr /* 按钮点击后的执行函数 */
|
const Function& func = nullptr /* 按钮点击后的执行函数 */
|
||||||
);
|
);
|
||||||
|
|
||||||
// 获取开关状态(打开或关闭)
|
// 获取开关状态
|
||||||
bool getState() const;
|
bool isChecked() const;
|
||||||
|
|
||||||
// 设置开关按钮的状态(打开或关闭)
|
// 设置开关按钮的状态
|
||||||
void setState(
|
void setChecked(
|
||||||
bool bState
|
bool checked
|
||||||
);
|
);
|
||||||
|
|
||||||
// 设置按钮打开状态下显示的按钮
|
// 设置按钮打开状态下显示的按钮
|
||||||
|
|
@ -940,6 +947,13 @@ public:
|
||||||
Node * disabled
|
Node * disabled
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 设置中心点位置
|
||||||
|
// 默认为 (0, 0), 范围 [0, 1]
|
||||||
|
virtual void setPivot(
|
||||||
|
float pivotX,
|
||||||
|
float pivotY
|
||||||
|
) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
E2D_DISABLE_COPY(ToggleButton);
|
E2D_DISABLE_COPY(ToggleButton);
|
||||||
|
|
||||||
|
|
@ -958,7 +972,7 @@ protected:
|
||||||
Node* _mouseoverOff;
|
Node* _mouseoverOff;
|
||||||
Node* _selectedOff;
|
Node* _selectedOff;
|
||||||
Node* _disabledOff;
|
Node* _disabledOff;
|
||||||
bool _toggle;
|
bool _checked;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@
|
||||||
<ClCompile Include="..\..\core\Action\ScaleTo.cpp" />
|
<ClCompile Include="..\..\core\Action\ScaleTo.cpp" />
|
||||||
<ClCompile Include="..\..\core\Action\Sequence.cpp" />
|
<ClCompile Include="..\..\core\Action\Sequence.cpp" />
|
||||||
<ClCompile Include="..\..\core\Action\Spawn.cpp" />
|
<ClCompile Include="..\..\core\Action\Spawn.cpp" />
|
||||||
|
<ClCompile Include="..\..\core\Base\Config.cpp" />
|
||||||
<ClCompile Include="..\..\core\Base\Game.cpp" />
|
<ClCompile Include="..\..\core\Base\Game.cpp" />
|
||||||
<ClCompile Include="..\..\core\Base\GC.cpp" />
|
<ClCompile Include="..\..\core\Base\GC.cpp" />
|
||||||
<ClCompile Include="..\..\core\Base\Input.cpp" />
|
<ClCompile Include="..\..\core\Base\Input.cpp" />
|
||||||
|
|
@ -58,7 +59,6 @@
|
||||||
<ClCompile Include="..\..\core\Base\Window.cpp" />
|
<ClCompile Include="..\..\core\Base\Window.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Collider.cpp" />
|
<ClCompile Include="..\..\core\Common\Collider.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Color.cpp" />
|
<ClCompile Include="..\..\core\Common\Color.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Config.cpp" />
|
|
||||||
<ClCompile Include="..\..\core\Common\Duration.cpp" />
|
<ClCompile Include="..\..\core\Common\Duration.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Font.cpp" />
|
<ClCompile Include="..\..\core\Common\Font.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Function.cpp" />
|
<ClCompile Include="..\..\core\Common\Function.cpp" />
|
||||||
|
|
|
||||||
|
|
@ -124,9 +124,6 @@
|
||||||
<ClCompile Include="..\..\core\Common\Color.cpp">
|
<ClCompile Include="..\..\core\Common\Color.cpp">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\core\Common\Config.cpp">
|
|
||||||
<Filter>Common</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\core\Common\Font.cpp">
|
<ClCompile Include="..\..\core\Common\Font.cpp">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
@ -259,5 +256,8 @@
|
||||||
<ClCompile Include="..\..\core\Event\MouseEvent.cpp">
|
<ClCompile Include="..\..\core\Event\MouseEvent.cpp">
|
||||||
<Filter>Event</Filter>
|
<Filter>Event</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\core\Base\Config.cpp">
|
||||||
|
<Filter>Base</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -195,6 +195,7 @@
|
||||||
<ClCompile Include="..\..\core\Action\ScaleTo.cpp" />
|
<ClCompile Include="..\..\core\Action\ScaleTo.cpp" />
|
||||||
<ClCompile Include="..\..\core\Action\Sequence.cpp" />
|
<ClCompile Include="..\..\core\Action\Sequence.cpp" />
|
||||||
<ClCompile Include="..\..\core\Action\Spawn.cpp" />
|
<ClCompile Include="..\..\core\Action\Spawn.cpp" />
|
||||||
|
<ClCompile Include="..\..\core\Base\Config.cpp" />
|
||||||
<ClCompile Include="..\..\core\Base\Game.cpp" />
|
<ClCompile Include="..\..\core\Base\Game.cpp" />
|
||||||
<ClCompile Include="..\..\core\Base\GC.cpp" />
|
<ClCompile Include="..\..\core\Base\GC.cpp" />
|
||||||
<ClCompile Include="..\..\core\Base\Input.cpp" />
|
<ClCompile Include="..\..\core\Base\Input.cpp" />
|
||||||
|
|
@ -202,7 +203,6 @@
|
||||||
<ClCompile Include="..\..\core\Base\Window.cpp" />
|
<ClCompile Include="..\..\core\Base\Window.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Collider.cpp" />
|
<ClCompile Include="..\..\core\Common\Collider.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Color.cpp" />
|
<ClCompile Include="..\..\core\Common\Color.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Config.cpp" />
|
|
||||||
<ClCompile Include="..\..\core\Common\Duration.cpp" />
|
<ClCompile Include="..\..\core\Common\Duration.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Font.cpp" />
|
<ClCompile Include="..\..\core\Common\Font.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Function.cpp" />
|
<ClCompile Include="..\..\core\Common\Function.cpp" />
|
||||||
|
|
|
||||||
|
|
@ -124,9 +124,6 @@
|
||||||
<ClCompile Include="..\..\core\Common\Color.cpp">
|
<ClCompile Include="..\..\core\Common\Color.cpp">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\core\Common\Config.cpp">
|
|
||||||
<Filter>Common</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\core\Common\Font.cpp">
|
<ClCompile Include="..\..\core\Common\Font.cpp">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
@ -259,5 +256,8 @@
|
||||||
<ClCompile Include="..\..\core\Event\MouseEvent.cpp">
|
<ClCompile Include="..\..\core\Event\MouseEvent.cpp">
|
||||||
<Filter>Event</Filter>
|
<Filter>Event</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\core\Base\Config.cpp">
|
||||||
|
<Filter>Base</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -215,6 +215,7 @@
|
||||||
<ClCompile Include="..\..\core\Action\Sequence.cpp" />
|
<ClCompile Include="..\..\core\Action\Sequence.cpp" />
|
||||||
<ClCompile Include="..\..\core\Action\FiniteTimeAction.cpp" />
|
<ClCompile Include="..\..\core\Action\FiniteTimeAction.cpp" />
|
||||||
<ClCompile Include="..\..\core\Action\Spawn.cpp" />
|
<ClCompile Include="..\..\core\Action\Spawn.cpp" />
|
||||||
|
<ClCompile Include="..\..\core\Base\Config.cpp" />
|
||||||
<ClCompile Include="..\..\core\Base\Game.cpp" />
|
<ClCompile Include="..\..\core\Base\Game.cpp" />
|
||||||
<ClCompile Include="..\..\core\Base\GC.cpp" />
|
<ClCompile Include="..\..\core\Base\GC.cpp" />
|
||||||
<ClCompile Include="..\..\core\Base\Input.cpp" />
|
<ClCompile Include="..\..\core\Base\Input.cpp" />
|
||||||
|
|
@ -222,7 +223,6 @@
|
||||||
<ClCompile Include="..\..\core\Base\Window.cpp" />
|
<ClCompile Include="..\..\core\Base\Window.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Collider.cpp" />
|
<ClCompile Include="..\..\core\Common\Collider.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Color.cpp" />
|
<ClCompile Include="..\..\core\Common\Color.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Config.cpp" />
|
|
||||||
<ClCompile Include="..\..\core\Common\Duration.cpp" />
|
<ClCompile Include="..\..\core\Common\Duration.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Font.cpp" />
|
<ClCompile Include="..\..\core\Common\Font.cpp" />
|
||||||
<ClCompile Include="..\..\core\Common\Function.cpp" />
|
<ClCompile Include="..\..\core\Common\Function.cpp" />
|
||||||
|
|
|
||||||
|
|
@ -216,9 +216,6 @@
|
||||||
<ClCompile Include="..\..\core\Custom\SystemException.cpp">
|
<ClCompile Include="..\..\core\Custom\SystemException.cpp">
|
||||||
<Filter>Custom</Filter>
|
<Filter>Custom</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\core\Common\Config.cpp">
|
|
||||||
<Filter>Common</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\core\Common\Collider.cpp">
|
<ClCompile Include="..\..\core\Common\Collider.cpp">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
@ -252,6 +249,9 @@
|
||||||
<ClCompile Include="..\..\core\Common\Duration.cpp">
|
<ClCompile Include="..\..\core\Common\Duration.cpp">
|
||||||
<Filter>Common</Filter>
|
<Filter>Common</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\core\Base\Config.cpp">
|
||||||
|
<Filter>Base</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\core\easy2d.h" />
|
<ClInclude Include="..\..\core\easy2d.h" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue