All float to double
This commit is contained in:
parent
915f574b76
commit
22fba22dcc
|
|
@ -1,6 +1,6 @@
|
|||
#include "..\eactions.h"
|
||||
|
||||
e2d::ActionDelay::ActionDelay(float duration)
|
||||
e2d::ActionDelay::ActionDelay(double duration)
|
||||
{
|
||||
m_fDelayTime = max(duration, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "..\eactions.h"
|
||||
|
||||
e2d::ActionGradual::ActionGradual(float duration)
|
||||
e2d::ActionGradual::ActionGradual(double duration)
|
||||
: m_fRateOfProgress(0)
|
||||
{
|
||||
m_fDuration = max(duration, 0);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "..\eactions.h"
|
||||
|
||||
|
||||
e2d::ActionMoveBy::ActionMoveBy(float duration, Vector vector) :
|
||||
e2d::ActionMoveBy::ActionMoveBy(double duration, Vector vector) :
|
||||
ActionGradual(duration)
|
||||
{
|
||||
m_MoveVec = vector;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "..\eactions.h"
|
||||
|
||||
e2d::ActionMoveTo::ActionMoveTo(float duration, Point pos) :
|
||||
e2d::ActionMoveTo::ActionMoveTo(double duration, Point pos) :
|
||||
ActionMoveBy(duration, Vector())
|
||||
{
|
||||
m_EndPos = pos;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "..\eactions.h"
|
||||
|
||||
|
||||
e2d::ActionOpacityBy::ActionOpacityBy(float duration, float opacity) :
|
||||
e2d::ActionOpacityBy::ActionOpacityBy(double duration, double opacity) :
|
||||
ActionGradual(duration)
|
||||
{
|
||||
m_nVariation = opacity;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "..\eactions.h"
|
||||
|
||||
|
||||
e2d::ActionOpacityTo::ActionOpacityTo(float duration, float opacity) :
|
||||
e2d::ActionOpacityTo::ActionOpacityTo(double duration, double opacity) :
|
||||
ActionOpacityBy(duration, 0)
|
||||
{
|
||||
m_nEndVal = opacity;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "..\eactions.h"
|
||||
|
||||
|
||||
e2d::ActionRotateBy::ActionRotateBy(float duration, float rotation) :
|
||||
e2d::ActionRotateBy::ActionRotateBy(double duration, double rotation) :
|
||||
ActionGradual(duration)
|
||||
{
|
||||
m_nVariation = rotation;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "..\eactions.h"
|
||||
|
||||
|
||||
e2d::ActionRotateTo::ActionRotateTo(float duration, float rotation) :
|
||||
e2d::ActionRotateTo::ActionRotateTo(double duration, double rotation) :
|
||||
ActionRotateBy(duration, 0)
|
||||
{
|
||||
m_nEndVal = rotation;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
#include "..\eactions.h"
|
||||
|
||||
|
||||
e2d::ActionScaleBy::ActionScaleBy(float duration, float scale)
|
||||
e2d::ActionScaleBy::ActionScaleBy(double duration, double scale)
|
||||
: ActionGradual(duration)
|
||||
{
|
||||
m_nVariationX = scale;
|
||||
m_nVariationY = scale;
|
||||
}
|
||||
|
||||
e2d::ActionScaleBy::ActionScaleBy(float duration, float scaleX, float scaleY)
|
||||
e2d::ActionScaleBy::ActionScaleBy(double duration, double scaleX, double scaleY)
|
||||
: ActionGradual(duration)
|
||||
{
|
||||
m_nVariationX = scaleX;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#include "..\eactions.h"
|
||||
|
||||
e2d::ActionScaleTo::ActionScaleTo(float duration, float scale)
|
||||
e2d::ActionScaleTo::ActionScaleTo(double duration, double scale)
|
||||
: ActionScaleBy(duration, 0, 0)
|
||||
{
|
||||
m_nEndScaleX = scale;
|
||||
m_nEndScaleY = scale;
|
||||
}
|
||||
|
||||
e2d::ActionScaleTo::ActionScaleTo(float duration, float scaleX, float scaleY)
|
||||
e2d::ActionScaleTo::ActionScaleTo(double duration, double scaleX, double scaleY)
|
||||
: ActionScaleBy(duration, 0, 0)
|
||||
{
|
||||
m_nEndScaleX = scaleX;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ e2d::Animation::Animation()
|
|||
{
|
||||
}
|
||||
|
||||
e2d::Animation::Animation(float invertal)
|
||||
e2d::Animation::Animation(double invertal)
|
||||
: m_nFrameIndex(0)
|
||||
, m_fInterval(invertal)
|
||||
{
|
||||
|
|
@ -19,7 +19,7 @@ e2d::Animation::~Animation()
|
|||
}
|
||||
}
|
||||
|
||||
void e2d::Animation::setInterval(float interval)
|
||||
void e2d::Animation::setInterval(double interval)
|
||||
{
|
||||
m_fInterval = max(interval, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -224,32 +224,32 @@ bool Input::isMouseMButtonRelease()
|
|||
return false;
|
||||
}
|
||||
|
||||
float Input::getMouseX()
|
||||
double Input::getMouseX()
|
||||
{
|
||||
return (float)s_MousePosition.x;
|
||||
return (double)s_MousePosition.x;
|
||||
}
|
||||
|
||||
float Input::getMouseY()
|
||||
double Input::getMouseY()
|
||||
{
|
||||
return (float)s_MousePosition.y;
|
||||
return (double)s_MousePosition.y;
|
||||
}
|
||||
|
||||
Point Input::getMousePos()
|
||||
{
|
||||
return Point((float)s_MousePosition.x, (float)s_MousePosition.y);
|
||||
return Point((double)s_MousePosition.x, (double)s_MousePosition.y);
|
||||
}
|
||||
|
||||
float Input::getMouseDeltaX()
|
||||
double Input::getMouseDeltaX()
|
||||
{
|
||||
return (float)s_MouseState.lX;
|
||||
return (double)s_MouseState.lX;
|
||||
}
|
||||
|
||||
float Input::getMouseDeltaY()
|
||||
double Input::getMouseDeltaY()
|
||||
{
|
||||
return (float)s_MouseState.lY;
|
||||
return (double)s_MouseState.lY;
|
||||
}
|
||||
|
||||
float Input::getMouseDeltaZ()
|
||||
double Input::getMouseDeltaZ()
|
||||
{
|
||||
return (float)s_MouseState.lZ;
|
||||
return (double)s_MouseState.lZ;
|
||||
}
|
||||
|
|
@ -15,12 +15,12 @@ static steady_clock::time_point s_tLastUpdate;
|
|||
// 上一帧与当前帧的时间间隔
|
||||
static int s_nInterval = 0;
|
||||
// 游戏开始时长
|
||||
static float s_fTotalTime = 0;
|
||||
static double s_fTotalTime = 0;
|
||||
// 每一帧间隔
|
||||
static milliseconds s_tExceptedInvertal;
|
||||
|
||||
|
||||
float e2d::Time::getTotalTime()
|
||||
double e2d::Time::getTotalTime()
|
||||
{
|
||||
return s_fTotalTime;
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ void e2d::Time::__updateLast()
|
|||
|
||||
s_tNow = steady_clock::now();
|
||||
s_nInterval = static_cast<int>(duration_cast<milliseconds>(s_tNow - s_tLastUpdate).count());
|
||||
s_fTotalTime = static_cast<float>(duration_cast<milliseconds>(s_tNow - s_tStart).count()) / 1000.0f;
|
||||
s_fTotalTime = static_cast<double>(duration_cast<milliseconds>(s_tNow - s_tStart).count()) / 1000.0f;
|
||||
}
|
||||
|
||||
void e2d::Time::__sleep()
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ bool e2d::Window::__init(LPCTSTR sTitle, UINT32 nWidth, UINT32 nHeight, LPCTSTR
|
|||
|
||||
// 因为 CreateWindow 函数使用的是像素大小,获取系统的 DPI 以使它
|
||||
// 适应窗口缩放
|
||||
FLOAT dpiX, dpiY;
|
||||
float dpiX, dpiY;
|
||||
|
||||
// 工厂将返回当前的系统 DPI,这个值也将用来创建窗口
|
||||
Renderer::getID2D1Factory()->GetDesktopDpi(&dpiX, &dpiY);
|
||||
|
|
@ -123,12 +123,12 @@ void e2d::Window::__poll()
|
|||
}
|
||||
}
|
||||
|
||||
float e2d::Window::getWidth()
|
||||
double e2d::Window::getWidth()
|
||||
{
|
||||
return Renderer::getRenderTarget()->GetSize().width;
|
||||
}
|
||||
|
||||
float e2d::Window::getHeight()
|
||||
double e2d::Window::getHeight()
|
||||
{
|
||||
return Renderer::getRenderTarget()->GetSize().height;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ e2d::Font::Font()
|
|||
{
|
||||
}
|
||||
|
||||
e2d::Font::Font(String fontFamily, float fontSize /* = 22 */, UINT32 color /* = EColor::WHITE */, UINT32 fontWeight, bool italic /* = false */)
|
||||
e2d::Font::Font(String fontFamily, double fontSize /* = 22 */, UINT32 color /* = EColor::WHITE */, UINT32 fontWeight, bool italic /* = false */)
|
||||
: m_pTextFormat(nullptr)
|
||||
, m_Color(Color::WHITE)
|
||||
, m_fFontSize(22)
|
||||
|
|
@ -30,7 +30,7 @@ e2d::Font::~Font()
|
|||
SafeReleaseInterface(&m_pTextFormat);
|
||||
}
|
||||
|
||||
float e2d::Font::getFontSize() const
|
||||
double e2d::Font::getFontSize() const
|
||||
{
|
||||
return m_fFontSize;
|
||||
}
|
||||
|
|
@ -56,9 +56,9 @@ void e2d::Font::setFamily(const String & fontFamily)
|
|||
m_bRecreateNeeded = true;
|
||||
}
|
||||
|
||||
void e2d::Font::setSize(float fontSize)
|
||||
void e2d::Font::setSize(double fontSize)
|
||||
{
|
||||
m_fFontSize = fontSize;
|
||||
m_fFontSize = static_cast<float>(fontSize);
|
||||
m_bRecreateNeeded = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ e2d::Image::Image(LPCTSTR strFileName)
|
|||
this->loadFrom(strFileName);
|
||||
}
|
||||
|
||||
e2d::Image::Image(LPCTSTR strFileName, float nClipX, float nClipY, float nClipWidth, float nClipHeight)
|
||||
e2d::Image::Image(LPCTSTR strFileName, double nClipX, double nClipY, double nClipWidth, double nClipHeight)
|
||||
{
|
||||
this->loadFrom(strFileName);
|
||||
this->clip(nClipX, nClipY, nClipWidth, nClipHeight);
|
||||
|
|
@ -47,13 +47,13 @@ void e2d::Image::loadFrom(const String & strFilePath)
|
|||
m_fSourceClipHeight = m_pBitmap->GetSize().height;
|
||||
}
|
||||
|
||||
void e2d::Image::loadFrom(const String & strFilePath, float x, float y, float width, float height)
|
||||
void e2d::Image::loadFrom(const String & strFilePath, double x, double y, double width, double height)
|
||||
{
|
||||
loadFrom(strFilePath);
|
||||
clip(x, y, width, height);
|
||||
}
|
||||
|
||||
void e2d::Image::clip(float x, float y, float width, float height)
|
||||
void e2d::Image::clip(double x, double y, double width, double height)
|
||||
{
|
||||
if (m_pBitmap)
|
||||
{
|
||||
|
|
@ -64,12 +64,12 @@ void e2d::Image::clip(float x, float y, float width, float height)
|
|||
}
|
||||
}
|
||||
|
||||
float e2d::Image::getWidth() const
|
||||
double e2d::Image::getWidth() const
|
||||
{
|
||||
return m_fSourceClipWidth;
|
||||
}
|
||||
|
||||
float e2d::Image::getHeight() const
|
||||
double e2d::Image::getHeight() const
|
||||
{
|
||||
return m_fSourceClipHeight;
|
||||
}
|
||||
|
|
@ -79,7 +79,7 @@ e2d::Size e2d::Image::getSize() const
|
|||
return Size(m_fSourceClipWidth, m_fSourceClipHeight);
|
||||
}
|
||||
|
||||
float e2d::Image::getSourceWidth() const
|
||||
double e2d::Image::getSourceWidth() const
|
||||
{
|
||||
if (m_pBitmap)
|
||||
{
|
||||
|
|
@ -91,7 +91,7 @@ float e2d::Image::getSourceWidth() const
|
|||
}
|
||||
}
|
||||
|
||||
float e2d::Image::getSourceHeight() const
|
||||
double e2d::Image::getSourceHeight() const
|
||||
{
|
||||
if (m_pBitmap)
|
||||
{
|
||||
|
|
@ -115,12 +115,12 @@ e2d::Size e2d::Image::getSourceSize() const
|
|||
}
|
||||
}
|
||||
|
||||
float e2d::Image::getClipX() const
|
||||
double e2d::Image::getClipX() const
|
||||
{
|
||||
return m_fSourceClipX;
|
||||
}
|
||||
|
||||
float e2d::Image::getClipY() const
|
||||
double e2d::Image::getClipY() const
|
||||
{
|
||||
return m_fSourceClipY;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ static float s_fDefaultPiovtY = 0;
|
|||
|
||||
e2d::Node::Node()
|
||||
: m_nOrder(0)
|
||||
, m_fPosX(0)
|
||||
, m_fPosY(0)
|
||||
, m_fWidth(0)
|
||||
, m_fHeight(0)
|
||||
, m_fScaleX(1.0f)
|
||||
, m_fScaleY(1.0f)
|
||||
, m_fRotation(0)
|
||||
|
|
@ -203,8 +207,8 @@ void e2d::Node::_updateTransform()
|
|||
{
|
||||
// 计算中心点坐标
|
||||
D2D1_POINT_2F pivot = D2D1::Point2F(
|
||||
getRealWidth() * m_fPivotX,
|
||||
getRealHeight() * m_fPivotY
|
||||
m_fWidth * m_fPivotX,
|
||||
m_fHeight * m_fPivotY
|
||||
);
|
||||
// 变换 Initial 矩阵,子节点将根据这个矩阵进行变换
|
||||
m_MatriInitial = D2D1::Matrix3x2F::Scale(
|
||||
|
|
@ -219,8 +223,8 @@ void e2d::Node::_updateTransform()
|
|||
m_fRotation,
|
||||
pivot
|
||||
) * D2D1::Matrix3x2F::Translation(
|
||||
m_Pos.x,
|
||||
m_Pos.y
|
||||
m_fPosX,
|
||||
m_fPosY
|
||||
);
|
||||
// 根据自身中心点变换 Final 矩阵
|
||||
m_MatriFinal = m_MatriInitial * D2D1::Matrix3x2F::Translation(-pivot.x, -pivot.y);
|
||||
|
|
@ -282,52 +286,52 @@ e2d::String e2d::Node::getName() const
|
|||
return m_sName;
|
||||
}
|
||||
|
||||
float e2d::Node::getPosX() const
|
||||
double e2d::Node::getPosX() const
|
||||
{
|
||||
return m_Pos.x;
|
||||
return m_fPosX;
|
||||
}
|
||||
|
||||
float e2d::Node::getPosY() const
|
||||
double e2d::Node::getPosY() const
|
||||
{
|
||||
return m_Pos.y;
|
||||
return m_fPosY;
|
||||
}
|
||||
|
||||
e2d::Point e2d::Node::getPos() const
|
||||
{
|
||||
return m_Pos;
|
||||
return Point(m_fPosX, m_fPosY);
|
||||
}
|
||||
|
||||
float e2d::Node::getWidth() const
|
||||
double e2d::Node::getWidth() const
|
||||
{
|
||||
return m_Size.width * m_fScaleX;
|
||||
return m_fWidth * m_fScaleX;
|
||||
}
|
||||
|
||||
float e2d::Node::getHeight() const
|
||||
double e2d::Node::getHeight() const
|
||||
{
|
||||
return m_Size.height * m_fScaleY;
|
||||
return m_fHeight * m_fScaleY;
|
||||
}
|
||||
|
||||
float e2d::Node::getRealWidth() const
|
||||
double e2d::Node::getRealWidth() const
|
||||
{
|
||||
return m_Size.width;
|
||||
return m_fWidth;
|
||||
}
|
||||
|
||||
float e2d::Node::getRealHeight() const
|
||||
double e2d::Node::getRealHeight() const
|
||||
{
|
||||
return m_Size.height;
|
||||
return m_fHeight;
|
||||
}
|
||||
|
||||
e2d::Size e2d::Node::getRealSize() const
|
||||
{
|
||||
return m_Size;
|
||||
return Size(m_fWidth, m_fHeight);
|
||||
}
|
||||
|
||||
float e2d::Node::getPivotX() const
|
||||
double e2d::Node::getPivotX() const
|
||||
{
|
||||
return m_fPivotX;
|
||||
}
|
||||
|
||||
float e2d::Node::getPivotY() const
|
||||
double e2d::Node::getPivotY() const
|
||||
{
|
||||
return m_fPivotY;
|
||||
}
|
||||
|
|
@ -337,32 +341,32 @@ e2d::Size e2d::Node::getSize() const
|
|||
return Size(getWidth(), getHeight());
|
||||
}
|
||||
|
||||
float e2d::Node::getScaleX() const
|
||||
double e2d::Node::getScaleX() const
|
||||
{
|
||||
return m_fScaleX;
|
||||
}
|
||||
|
||||
float e2d::Node::getScaleY() const
|
||||
double e2d::Node::getScaleY() const
|
||||
{
|
||||
return m_fScaleY;
|
||||
}
|
||||
|
||||
float e2d::Node::getSkewX() const
|
||||
double e2d::Node::getSkewX() const
|
||||
{
|
||||
return m_fSkewAngleX;
|
||||
}
|
||||
|
||||
float e2d::Node::getSkewY() const
|
||||
double e2d::Node::getSkewY() const
|
||||
{
|
||||
return m_fSkewAngleY;
|
||||
}
|
||||
|
||||
float e2d::Node::getRotation() const
|
||||
double e2d::Node::getRotation() const
|
||||
{
|
||||
return m_fRotation;
|
||||
}
|
||||
|
||||
float e2d::Node::getOpacity() const
|
||||
double e2d::Node::getOpacity() const
|
||||
{
|
||||
return m_fRealOpacity;
|
||||
}
|
||||
|
|
@ -382,14 +386,14 @@ void e2d::Node::setOrder(int order)
|
|||
m_nOrder = order;
|
||||
}
|
||||
|
||||
void e2d::Node::setPosX(float x)
|
||||
void e2d::Node::setPosX(double x)
|
||||
{
|
||||
this->setPos(x, m_Pos.y);
|
||||
this->setPos(x, m_fPosY);
|
||||
}
|
||||
|
||||
void e2d::Node::setPosY(float y)
|
||||
void e2d::Node::setPosY(double y)
|
||||
{
|
||||
this->setPos(m_Pos.x, y);
|
||||
this->setPos(m_fPosX, y);
|
||||
}
|
||||
|
||||
void e2d::Node::setPos(const Point & p)
|
||||
|
|
@ -397,29 +401,29 @@ void e2d::Node::setPos(const Point & p)
|
|||
this->setPos(p.x, p.y);
|
||||
}
|
||||
|
||||
void e2d::Node::setPos(float x, float y)
|
||||
void e2d::Node::setPos(double x, double y)
|
||||
{
|
||||
if (m_Pos.x == x && m_Pos.y == y)
|
||||
if (m_fPosX == x && m_fPosY == y)
|
||||
return;
|
||||
|
||||
m_Pos.x = x;
|
||||
m_Pos.y = y;
|
||||
m_fPosX = static_cast<float>(x);
|
||||
m_fPosY = static_cast<float>(y);
|
||||
m_bTransformNeeded = true;
|
||||
}
|
||||
|
||||
void e2d::Node::movePosX(float x)
|
||||
void e2d::Node::movePosX(double x)
|
||||
{
|
||||
this->movePos(x, 0);
|
||||
}
|
||||
|
||||
void e2d::Node::movePosY(float y)
|
||||
void e2d::Node::movePosY(double y)
|
||||
{
|
||||
this->movePos(0, y);
|
||||
}
|
||||
|
||||
void e2d::Node::movePos(float x, float y)
|
||||
void e2d::Node::movePos(double x, double y)
|
||||
{
|
||||
this->setPos(m_Pos.x + x, m_Pos.y + y);
|
||||
this->setPos(m_fPosX + x, m_fPosY + y);
|
||||
}
|
||||
|
||||
void e2d::Node::movePos(const Vector & v)
|
||||
|
|
@ -427,97 +431,97 @@ void e2d::Node::movePos(const Vector & v)
|
|||
this->movePos(v.x, v.y);
|
||||
}
|
||||
|
||||
void e2d::Node::_setSize(float width, float height)
|
||||
void e2d::Node::_setSize(double width, double height)
|
||||
{
|
||||
if (m_Size.width == width && m_Size.height == height)
|
||||
if (m_fWidth == width && m_fHeight == height)
|
||||
return;
|
||||
|
||||
m_Size.width = width;
|
||||
m_Size.height = height;
|
||||
m_fWidth = static_cast<float>(width);
|
||||
m_fHeight = static_cast<float>(height);
|
||||
m_bTransformNeeded = true;
|
||||
}
|
||||
|
||||
void e2d::Node::setScaleX(float scaleX)
|
||||
void e2d::Node::setScaleX(double scaleX)
|
||||
{
|
||||
this->setScale(scaleX, m_fScaleY);
|
||||
}
|
||||
|
||||
void e2d::Node::setScaleY(float scaleY)
|
||||
void e2d::Node::setScaleY(double scaleY)
|
||||
{
|
||||
this->setScale(m_fScaleX, scaleY);
|
||||
}
|
||||
|
||||
void e2d::Node::setScale(float scale)
|
||||
void e2d::Node::setScale(double scale)
|
||||
{
|
||||
this->setScale(scale, scale);
|
||||
}
|
||||
|
||||
void e2d::Node::setScale(float scaleX, float scaleY)
|
||||
void e2d::Node::setScale(double scaleX, double scaleY)
|
||||
{
|
||||
if (m_fScaleX == scaleX && m_fScaleY == scaleY)
|
||||
return;
|
||||
|
||||
m_fScaleX = scaleX;
|
||||
m_fScaleY = scaleY;
|
||||
m_fScaleX = static_cast<float>(scaleX);
|
||||
m_fScaleY = static_cast<float>(scaleY);
|
||||
m_bTransformNeeded = true;
|
||||
}
|
||||
|
||||
void e2d::Node::setSkewX(float angleX)
|
||||
void e2d::Node::setSkewX(double angleX)
|
||||
{
|
||||
this->setSkew(angleX, m_fSkewAngleY);
|
||||
}
|
||||
|
||||
void e2d::Node::setSkewY(float angleY)
|
||||
void e2d::Node::setSkewY(double angleY)
|
||||
{
|
||||
this->setSkew(m_fSkewAngleX, angleY);
|
||||
}
|
||||
|
||||
void e2d::Node::setSkew(float angleX, float angleY)
|
||||
void e2d::Node::setSkew(double angleX, double angleY)
|
||||
{
|
||||
if (m_fSkewAngleX == angleX && m_fSkewAngleY == angleY)
|
||||
return;
|
||||
|
||||
m_fSkewAngleX = angleX;
|
||||
m_fSkewAngleY = angleY;
|
||||
m_fSkewAngleX = static_cast<float>(angleX);
|
||||
m_fSkewAngleY = static_cast<float>(angleY);
|
||||
m_bTransformNeeded = true;
|
||||
}
|
||||
|
||||
void e2d::Node::setRotation(float angle)
|
||||
void e2d::Node::setRotation(double angle)
|
||||
{
|
||||
if (m_fRotation == angle)
|
||||
return;
|
||||
|
||||
m_fRotation = angle;
|
||||
m_fRotation = static_cast<float>(angle);
|
||||
m_bTransformNeeded = true;
|
||||
}
|
||||
|
||||
void e2d::Node::setOpacity(float opacity)
|
||||
void e2d::Node::setOpacity(double opacity)
|
||||
{
|
||||
if (m_fRealOpacity == opacity)
|
||||
return;
|
||||
|
||||
m_fDisplayOpacity = m_fRealOpacity = min(max(opacity, 0), 1);
|
||||
m_fDisplayOpacity = m_fRealOpacity = min(max(static_cast<float>(opacity), 0), 1);
|
||||
// 更新节点透明度
|
||||
_updateOpacity(this);
|
||||
}
|
||||
|
||||
void e2d::Node::setPivotX(float pivotX)
|
||||
void e2d::Node::setPivotX(double pivotX)
|
||||
{
|
||||
this->setPivot(pivotX, m_fPivotY);
|
||||
}
|
||||
|
||||
void e2d::Node::setPivotY(float pivotY)
|
||||
void e2d::Node::setPivotY(double pivotY)
|
||||
{
|
||||
this->setPivot(m_fPivotX, pivotY);
|
||||
}
|
||||
|
||||
void e2d::Node::setPivot(float pivotX, float pivotY)
|
||||
void e2d::Node::setPivot(double pivotX, double pivotY)
|
||||
{
|
||||
if (m_fPivotX == pivotX && m_fPivotY == pivotY)
|
||||
return;
|
||||
|
||||
m_fPivotX = min(max(pivotX, 0), 1);
|
||||
m_fPivotY = min(max(pivotY, 0), 1);
|
||||
m_fPivotX = min(max(static_cast<float>(pivotX), 0), 1);
|
||||
m_fPivotY = min(max(static_cast<float>(pivotY), 0), 1);
|
||||
m_bTransformNeeded = true;
|
||||
}
|
||||
|
||||
|
|
@ -768,13 +772,15 @@ bool e2d::Node::isPointIn(Point point)
|
|||
// 为节点创建一个形状
|
||||
ID2D1RectangleGeometry * rect;
|
||||
Renderer::getID2D1Factory()->CreateRectangleGeometry(
|
||||
D2D1::RectF(0, 0, getWidth(), getHeight()),
|
||||
D2D1::RectF(0, 0, m_fWidth * m_fScaleX, m_fHeight * m_fScaleY),
|
||||
&rect
|
||||
);
|
||||
// 判断点是否在形状内
|
||||
BOOL ret;
|
||||
rect->FillContainsPoint(
|
||||
D2D1::Point2F(point.x, point.y),
|
||||
D2D1::Point2F(
|
||||
static_cast<float>(point.x),
|
||||
static_cast<float>(point.y)),
|
||||
&m_MatriFinal,
|
||||
&ret
|
||||
);
|
||||
|
|
@ -796,10 +802,10 @@ void e2d::Node::setAutoUpdate(bool bAutoUpdate)
|
|||
m_bAutoUpdate = bAutoUpdate;
|
||||
}
|
||||
|
||||
void e2d::Node::setDefaultPiovt(float defaultPiovtX, float defaultPiovtY)
|
||||
void e2d::Node::setDefaultPiovt(double defaultPiovtX, double defaultPiovtY)
|
||||
{
|
||||
s_fDefaultPiovtX = min(max(defaultPiovtX, 0), 1);
|
||||
s_fDefaultPiovtY = min(max(defaultPiovtY, 0), 1);
|
||||
s_fDefaultPiovtX = min(max(static_cast<float>(defaultPiovtX), 0), 1);
|
||||
s_fDefaultPiovtY = min(max(static_cast<float>(defaultPiovtY), 0), 1);
|
||||
}
|
||||
|
||||
void e2d::Node::stopAction(Action * action)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ e2d::Sprite::Sprite(LPCTSTR imageFileName)
|
|||
loadFrom(imageFileName);
|
||||
}
|
||||
|
||||
e2d::Sprite::Sprite(LPCTSTR imageFileName, float x, float y, float width, float height)
|
||||
e2d::Sprite::Sprite(LPCTSTR imageFileName, double x, double y, double width, double height)
|
||||
: m_pImage(nullptr)
|
||||
{
|
||||
loadFrom(imageFileName);
|
||||
|
|
@ -47,7 +47,7 @@ void e2d::Sprite::loadFrom(LPCTSTR imageFileName)
|
|||
loadFrom(new Image(imageFileName));
|
||||
}
|
||||
|
||||
void e2d::Sprite::clip(float x, float y, float width, float height)
|
||||
void e2d::Sprite::clip(double x, double y, double width, double height)
|
||||
{
|
||||
m_pImage->clip(x, y, width, height);
|
||||
Node::_setSize(
|
||||
|
|
@ -65,17 +65,19 @@ void e2d::Sprite::onRender()
|
|||
{
|
||||
if (m_pImage && m_pImage->getBitmap())
|
||||
{
|
||||
float fClipX = static_cast<float>(m_pImage->getClipX());
|
||||
float fClipY = static_cast<float>(m_pImage->getClipY());
|
||||
// äÖȾͼƬ
|
||||
Renderer::getRenderTarget()->DrawBitmap(
|
||||
m_pImage->getBitmap(),
|
||||
D2D1::RectF(0, 0, getRealWidth(), getRealHeight()),
|
||||
D2D1::RectF(0, 0, m_fWidth, m_fHeight),
|
||||
m_fDisplayOpacity,
|
||||
D2D1_BITMAP_INTERPOLATION_MODE_LINEAR,
|
||||
D2D1::RectF(
|
||||
m_pImage->getClipX(),
|
||||
m_pImage->getClipY(),
|
||||
m_pImage->getClipX() + getRealWidth(),
|
||||
m_pImage->getClipY() + getRealHeight()
|
||||
fClipX,
|
||||
fClipY,
|
||||
fClipX + m_fWidth,
|
||||
fClipY + m_fHeight
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ e2d::Text::Text(const String & text, Font * font)
|
|||
this->setFont(font);
|
||||
}
|
||||
|
||||
e2d::Text::Text(const String & text, String fontFamily, float fontSize, UINT32 color, UINT32 fontWeight, bool italic)
|
||||
e2d::Text::Text(const String & text, String fontFamily, double fontSize, UINT32 color, UINT32 fontWeight, bool italic)
|
||||
: m_bWordWrapping(false)
|
||||
, m_pFont(nullptr)
|
||||
, m_fWordWrappingWidth(0)
|
||||
|
|
@ -53,12 +53,12 @@ e2d::String e2d::Text::getText() const
|
|||
return m_sText;
|
||||
}
|
||||
|
||||
float e2d::Text::getWidth() const
|
||||
double e2d::Text::getWidth() const
|
||||
{
|
||||
return m_fWordWrappingWidth * m_fScaleX;
|
||||
}
|
||||
|
||||
float e2d::Text::getRealWidth() const
|
||||
double e2d::Text::getRealWidth() const
|
||||
{
|
||||
return m_fWordWrappingWidth;
|
||||
}
|
||||
|
|
@ -92,9 +92,9 @@ void e2d::Text::setWordWrappingEnable(bool value)
|
|||
_initTextLayout();
|
||||
}
|
||||
|
||||
void e2d::Text::setWordWrappingWidth(float wordWrapWidth)
|
||||
void e2d::Text::setWordWrappingWidth(double wordWrapWidth)
|
||||
{
|
||||
m_fWordWrappingWidth = max(wordWrapWidth, 0);
|
||||
m_fWordWrappingWidth = max(static_cast<float>(wordWrapWidth), 0);
|
||||
_initTextLayout();
|
||||
}
|
||||
|
||||
|
|
@ -108,8 +108,8 @@ void e2d::Text::onRender()
|
|||
D2D1::RectF(
|
||||
0,
|
||||
0,
|
||||
m_bWordWrapping ? m_fWordWrappingWidth : m_Size.width,
|
||||
getRealHeight()
|
||||
m_bWordWrapping ? m_fWordWrappingWidth : m_fWidth,
|
||||
m_fHeight
|
||||
),
|
||||
Renderer::getSolidColorBrush()
|
||||
);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ e2d::Circle::Circle()
|
|||
{
|
||||
}
|
||||
|
||||
e2d::Circle::Circle(Point center, float radius)
|
||||
e2d::Circle::Circle(Point center, double radius)
|
||||
: m_pD2dCircle(nullptr)
|
||||
{
|
||||
this->_setCircle(center, radius);
|
||||
|
|
@ -15,7 +15,7 @@ e2d::Circle::Circle(Point center, float radius)
|
|||
e2d::Circle::Circle(Node * node)
|
||||
: m_pD2dCircle(nullptr)
|
||||
{
|
||||
float minSide = min(node->getRealWidth(), node->getRealHeight());
|
||||
double minSide = min(node->getRealWidth(), node->getRealHeight());
|
||||
this->_setCircle(
|
||||
Point(
|
||||
node->getRealWidth() / 2,
|
||||
|
|
@ -30,17 +30,17 @@ e2d::Circle::~Circle()
|
|||
SafeReleaseInterface(&m_pD2dCircle);
|
||||
}
|
||||
|
||||
void e2d::Circle::_setCircle(Point center, float radius)
|
||||
void e2d::Circle::_setCircle(Point center, double radius)
|
||||
{
|
||||
SafeReleaseInterface(&m_pD2dCircle);
|
||||
|
||||
Renderer::getID2D1Factory()->CreateEllipseGeometry(
|
||||
D2D1::Ellipse(
|
||||
D2D1::Point2F(
|
||||
center.x,
|
||||
center.y),
|
||||
radius,
|
||||
radius),
|
||||
static_cast<float>(center.x),
|
||||
static_cast<float>(center.y)),
|
||||
static_cast<float>(radius),
|
||||
static_cast<float>(radius)),
|
||||
&m_pD2dCircle
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ e2d::Ellipse::Ellipse()
|
|||
{
|
||||
}
|
||||
|
||||
e2d::Ellipse::Ellipse(Point center, float radiusX, float radiusY)
|
||||
e2d::Ellipse::Ellipse(Point center, double radiusX, double radiusY)
|
||||
: m_pD2dEllipse(nullptr)
|
||||
{
|
||||
this->_setEllipse(center, radiusX, radiusY);
|
||||
|
|
@ -30,17 +30,17 @@ e2d::Ellipse::~Ellipse()
|
|||
SafeReleaseInterface(&m_pD2dEllipse);
|
||||
}
|
||||
|
||||
void e2d::Ellipse::_setEllipse(Point center, float radiusX, float radiusY)
|
||||
void e2d::Ellipse::_setEllipse(Point center, double radiusX, double radiusY)
|
||||
{
|
||||
SafeReleaseInterface(&m_pD2dEllipse);
|
||||
|
||||
Renderer::getID2D1Factory()->CreateEllipseGeometry(
|
||||
D2D1::Ellipse(
|
||||
D2D1::Point2F(
|
||||
center.x,
|
||||
center.y),
|
||||
radiusX,
|
||||
radiusY),
|
||||
static_cast<float>(center.x),
|
||||
static_cast<float>(center.y)),
|
||||
static_cast<float>(radiusX),
|
||||
static_cast<float>(radiusY)),
|
||||
&m_pD2dEllipse
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ e2d::Rect::Rect()
|
|||
{
|
||||
}
|
||||
|
||||
e2d::Rect::Rect(float x, float y, float width, float height)
|
||||
e2d::Rect::Rect(double x, double y, double width, double height)
|
||||
: m_pD2dRectangle(nullptr)
|
||||
{
|
||||
this->_setRect(x, y, x + width, y + height);
|
||||
|
|
@ -28,12 +28,16 @@ e2d::Rect::~Rect()
|
|||
SafeReleaseInterface(&m_pD2dRectangle);
|
||||
}
|
||||
|
||||
void e2d::Rect::_setRect(float left, float top, float right, float bottom)
|
||||
void e2d::Rect::_setRect(double left, double top, double right, double bottom)
|
||||
{
|
||||
SafeReleaseInterface(&m_pD2dRectangle);
|
||||
|
||||
Renderer::getID2D1Factory()->CreateRectangleGeometry(
|
||||
D2D1::RectF(left, top, right, bottom),
|
||||
D2D1::RectF(
|
||||
static_cast<float>(left),
|
||||
static_cast<float>(top),
|
||||
static_cast<float>(right),
|
||||
static_cast<float>(bottom)),
|
||||
&m_pD2dRectangle
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,9 +59,9 @@ void e2d::Shape::setColor(UINT32 color)
|
|||
m_nColor = color;
|
||||
}
|
||||
|
||||
void e2d::Shape::setOpacity(float opacity)
|
||||
void e2d::Shape::setOpacity(double opacity)
|
||||
{
|
||||
m_fOpacity = min(max(opacity, 0), 1);
|
||||
m_fOpacity = min(max(static_cast<float>(opacity), 0), 1);
|
||||
}
|
||||
|
||||
void e2d::Shape::_render()
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ void e2d::Data::saveInt(const String & key, int value)
|
|||
::WritePrivateProfileString(L"Default", key, String::toString(value), File::getDefaultSavePath());
|
||||
}
|
||||
|
||||
void e2d::Data::saveFloat(const String & key, float value)
|
||||
void e2d::Data::saveDouble(const String & key, double value)
|
||||
{
|
||||
::WritePrivateProfileString(L"Default", key, String::toString(value), File::getDefaultSavePath());
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ int e2d::Data::getInt(const String & key, int default)
|
|||
return ::GetPrivateProfileInt(L"Default", key, default, File::getDefaultSavePath());
|
||||
}
|
||||
|
||||
float e2d::Data::getFloat(const String & key, float default)
|
||||
double e2d::Data::getDouble(const String & key, double default)
|
||||
{
|
||||
wchar_t temp[32] = { 0 };
|
||||
::GetPrivateProfileString(L"Default", key, String::toString(default), temp, 31, File::getDefaultSavePath());
|
||||
|
|
|
|||
|
|
@ -208,41 +208,41 @@ bool Music::isPlaying()
|
|||
}
|
||||
}
|
||||
|
||||
float Music::getVolume() const
|
||||
double Music::getVolume() const
|
||||
{
|
||||
float fVolume = 0.0f;
|
||||
if (m_pSourceVoice)
|
||||
{
|
||||
m_pSourceVoice->GetVolume(&fVolume);
|
||||
}
|
||||
return fVolume;
|
||||
return static_cast<double>(fVolume);
|
||||
}
|
||||
|
||||
bool Music::setVolume(float fVolume)
|
||||
bool Music::setVolume(double fVolume)
|
||||
{
|
||||
if (m_pSourceVoice)
|
||||
{
|
||||
return SUCCEEDED(m_pSourceVoice->SetVolume(min(max(fVolume, -224), 224)));
|
||||
return SUCCEEDED(m_pSourceVoice->SetVolume(min(max(static_cast<float>(fVolume), -224), 224)));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
float Music::getFrequencyRatio() const
|
||||
double Music::getFrequencyRatio() const
|
||||
{
|
||||
float fFrequencyRatio = 0.0f;
|
||||
if (m_pSourceVoice)
|
||||
{
|
||||
m_pSourceVoice->GetFrequencyRatio(&fFrequencyRatio);
|
||||
}
|
||||
return fFrequencyRatio;
|
||||
return static_cast<double>(fFrequencyRatio);
|
||||
}
|
||||
|
||||
bool Music::setFrequencyRatio(float fFrequencyRatio)
|
||||
bool Music::setFrequencyRatio(double fFrequencyRatio)
|
||||
{
|
||||
if (m_pSourceVoice)
|
||||
{
|
||||
fFrequencyRatio = min(max(fFrequencyRatio, XAUDIO2_MIN_FREQ_RATIO), XAUDIO2_MAX_FREQ_RATIO);
|
||||
return SUCCEEDED(m_pSourceVoice->SetFrequencyRatio(fFrequencyRatio));
|
||||
return SUCCEEDED(m_pSourceVoice->SetFrequencyRatio(static_cast<float>(fFrequencyRatio)));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ e2d::Timer::Timer()
|
|||
{
|
||||
}
|
||||
|
||||
e2d::Timer::Timer(const TimerCallback & callback, float interval /* = 0 */, int repeatTimes /* = -1 */, bool atOnce /* = false */)
|
||||
e2d::Timer::Timer(const TimerCallback & callback, double interval /* = 0 */, int repeatTimes /* = -1 */, bool atOnce /* = false */)
|
||||
: m_bRunning(false)
|
||||
, m_nRunTimes(0)
|
||||
, m_pParentNode(nullptr)
|
||||
|
|
@ -30,7 +30,7 @@ e2d::Timer::Timer(const TimerCallback & callback, float interval /* = 0 */, int
|
|||
m_bAtOnce = atOnce;
|
||||
}
|
||||
|
||||
e2d::Timer::Timer(const String & name, const TimerCallback & callback, float interval /* = 0 */, int repeatTimes /* = -1 */, bool atOnce /* = false */)
|
||||
e2d::Timer::Timer(const String & name, const TimerCallback & callback, double interval /* = 0 */, int repeatTimes /* = -1 */, bool atOnce /* = false */)
|
||||
: m_bRunning(false)
|
||||
, m_nRunTimes(0)
|
||||
, m_pParentNode(nullptr)
|
||||
|
|
@ -78,7 +78,7 @@ void e2d::Timer::setName(const String & name)
|
|||
m_sName = name;
|
||||
}
|
||||
|
||||
void e2d::Timer::setInterval(float interval)
|
||||
void e2d::Timer::setInterval(double interval)
|
||||
{
|
||||
m_fInterval = max(interval, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "..\ebase.h"
|
||||
#include "..\etransitions.h"
|
||||
|
||||
e2d::Transition::Transition(float duration)
|
||||
e2d::Transition::Transition(double duration)
|
||||
: m_bEnd(false)
|
||||
, m_fLast(0)
|
||||
, m_fRateOfProgress(0)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "..\etransitions.h"
|
||||
#include "..\enodes.h"
|
||||
|
||||
e2d::TransitionEmerge::TransitionEmerge(float duration)
|
||||
e2d::TransitionEmerge::TransitionEmerge(double duration)
|
||||
: Transition(duration)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "..\etransitions.h"
|
||||
#include "..\enodes.h"
|
||||
|
||||
e2d::TransitionFade::TransitionFade(float fadeOutDuration, float fadeInDuration)
|
||||
e2d::TransitionFade::TransitionFade(double fadeOutDuration, double fadeInDuration)
|
||||
: Transition(0)
|
||||
, m_fFadeOutDuration(fadeOutDuration)
|
||||
, m_fFadeInDuration(fadeInDuration)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "..\etransitions.h"
|
||||
#include "..\enodes.h"
|
||||
|
||||
e2d::TransitionMove::TransitionMove(float duration, MOVE_DIRECT direct)
|
||||
e2d::TransitionMove::TransitionMove(double duration, MOVE_DIRECT direct)
|
||||
: Transition(duration)
|
||||
, m_Direct(direct)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ protected:
|
|||
bool m_bInit;
|
||||
Node * m_pTarget;
|
||||
Scene *m_pParentScene;
|
||||
float m_fLast;
|
||||
double m_fLast;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ class ActionGradual :
|
|||
public:
|
||||
// 创建时长动画
|
||||
ActionGradual(
|
||||
float duration
|
||||
double duration
|
||||
);
|
||||
|
||||
protected:
|
||||
|
|
@ -95,8 +95,8 @@ protected:
|
|||
virtual void _update() override;
|
||||
|
||||
protected:
|
||||
float m_fDuration;
|
||||
float m_fRateOfProgress;
|
||||
double m_fDuration;
|
||||
double m_fRateOfProgress;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ class ActionMoveBy :
|
|||
public:
|
||||
// 创建相对位移动画
|
||||
ActionMoveBy(
|
||||
float duration, /* 动画持续时长 */
|
||||
double duration, /* 动画持续时长 */
|
||||
Vector vector /* 位移向量 */
|
||||
);
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ class ActionMoveTo :
|
|||
public:
|
||||
// 创建位移动画
|
||||
ActionMoveTo(
|
||||
float duration, /* 动画持续时长 */
|
||||
double duration, /* 动画持续时长 */
|
||||
Point pos /* 位移至目标点的坐标 */
|
||||
);
|
||||
|
||||
|
|
@ -157,15 +157,15 @@ class ActionScaleBy :
|
|||
public:
|
||||
// 创建相对缩放动画
|
||||
ActionScaleBy(
|
||||
float duration, /* 动画持续时长 */
|
||||
float scale /* 缩放比例变化 */
|
||||
double duration, /* 动画持续时长 */
|
||||
double scale /* 缩放比例变化 */
|
||||
);
|
||||
|
||||
// 创建相对缩放动画
|
||||
ActionScaleBy(
|
||||
float duration, /* 动画持续时长 */
|
||||
float scaleX, /* 横向缩放比例变化 */
|
||||
float scaleY /* 纵向缩放比例变化 */
|
||||
double duration, /* 动画持续时长 */
|
||||
double scaleX, /* 横向缩放比例变化 */
|
||||
double scaleY /* 纵向缩放比例变化 */
|
||||
);
|
||||
|
||||
// 获取该动画的拷贝对象
|
||||
|
|
@ -182,10 +182,10 @@ protected:
|
|||
virtual void _update() override;
|
||||
|
||||
protected:
|
||||
float m_nBeginScaleX;
|
||||
float m_nBeginScaleY;
|
||||
float m_nVariationX;
|
||||
float m_nVariationY;
|
||||
double m_nBeginScaleX;
|
||||
double m_nBeginScaleY;
|
||||
double m_nVariationX;
|
||||
double m_nVariationY;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -195,15 +195,15 @@ class ActionScaleTo :
|
|||
public:
|
||||
// 创建缩放动画
|
||||
ActionScaleTo(
|
||||
float duration, /* 动画持续时长 */
|
||||
float scale /* 缩放至目标比例 */
|
||||
double duration, /* 动画持续时长 */
|
||||
double scale /* 缩放至目标比例 */
|
||||
);
|
||||
|
||||
// 创建缩放动画
|
||||
ActionScaleTo(
|
||||
float duration, /* 动画持续时长 */
|
||||
float scaleX, /* 横向缩放至目标比例 */
|
||||
float scaleY /* 纵向缩放至目标比例 */
|
||||
double duration, /* 动画持续时长 */
|
||||
double scaleX, /* 横向缩放至目标比例 */
|
||||
double scaleY /* 纵向缩放至目标比例 */
|
||||
);
|
||||
|
||||
// 获取该动画的拷贝对象
|
||||
|
|
@ -214,8 +214,8 @@ protected:
|
|||
virtual void _init() override;
|
||||
|
||||
protected:
|
||||
float m_nEndScaleX;
|
||||
float m_nEndScaleY;
|
||||
double m_nEndScaleX;
|
||||
double m_nEndScaleY;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -225,8 +225,8 @@ class ActionOpacityBy :
|
|||
public:
|
||||
// 创建透明度相对渐变动画
|
||||
ActionOpacityBy(
|
||||
float duration, /* 动画持续时长 */
|
||||
float opacity /* 透明度相对变化值 */
|
||||
double duration, /* 动画持续时长 */
|
||||
double opacity /* 透明度相对变化值 */
|
||||
);
|
||||
|
||||
// 获取该动画的拷贝对象
|
||||
|
|
@ -243,8 +243,8 @@ protected:
|
|||
virtual void _update() override;
|
||||
|
||||
protected:
|
||||
float m_nBeginVal;
|
||||
float m_nVariation;
|
||||
double m_nBeginVal;
|
||||
double m_nVariation;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -254,8 +254,8 @@ class ActionOpacityTo :
|
|||
public:
|
||||
// 创建透明度渐变动画
|
||||
ActionOpacityTo(
|
||||
float duration, /* 动画持续时长 */
|
||||
float opacity /* 透明度渐变至目标值 */
|
||||
double duration, /* 动画持续时长 */
|
||||
double opacity /* 透明度渐变至目标值 */
|
||||
);
|
||||
|
||||
// 获取该动画的拷贝对象
|
||||
|
|
@ -266,7 +266,7 @@ protected:
|
|||
virtual void _init() override;
|
||||
|
||||
protected:
|
||||
float m_nEndVal;
|
||||
double m_nEndVal;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -276,7 +276,7 @@ class ActionFadeIn :
|
|||
public:
|
||||
// 创建淡入动画
|
||||
ActionFadeIn(
|
||||
float duration /* 动画持续时长 */
|
||||
double duration /* 动画持续时长 */
|
||||
) : ActionOpacityTo(duration, 1) {}
|
||||
};
|
||||
|
||||
|
|
@ -287,7 +287,7 @@ class ActionFadeOut :
|
|||
public:
|
||||
// 创建淡出动画
|
||||
ActionFadeOut(
|
||||
float duration /* 动画持续时长 */
|
||||
double duration /* 动画持续时长 */
|
||||
) : ActionOpacityTo(duration, 0) {}
|
||||
};
|
||||
|
||||
|
|
@ -298,8 +298,8 @@ class ActionRotateBy :
|
|||
public:
|
||||
// 创建相对旋转动画
|
||||
ActionRotateBy(
|
||||
float duration, /* 动画持续时长 */
|
||||
float rotation /* 旋转角度变化值 */
|
||||
double duration, /* 动画持续时长 */
|
||||
double rotation /* 旋转角度变化值 */
|
||||
);
|
||||
|
||||
// 获取该动画的拷贝对象
|
||||
|
|
@ -316,8 +316,8 @@ protected:
|
|||
virtual void _update() override;
|
||||
|
||||
protected:
|
||||
float m_nBeginVal;
|
||||
float m_nVariation;
|
||||
double m_nBeginVal;
|
||||
double m_nVariation;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -327,8 +327,8 @@ class ActionRotateTo :
|
|||
public:
|
||||
// 创建旋转动画
|
||||
ActionRotateTo(
|
||||
float duration, /* 动画持续时长 */
|
||||
float rotation /* 旋转角度至目标值 */
|
||||
double duration, /* 动画持续时长 */
|
||||
double rotation /* 旋转角度至目标值 */
|
||||
);
|
||||
|
||||
// 获取该动画的拷贝对象
|
||||
|
|
@ -339,7 +339,7 @@ protected:
|
|||
virtual void _init() override;
|
||||
|
||||
protected:
|
||||
float m_nEndVal;
|
||||
double m_nEndVal;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -438,7 +438,7 @@ class ActionDelay :
|
|||
public:
|
||||
// 创建延时动作
|
||||
ActionDelay(
|
||||
float duration /* 延迟时长(秒) */
|
||||
double duration /* 延迟时长(秒) */
|
||||
);
|
||||
|
||||
// 获取该动作的拷贝对象
|
||||
|
|
@ -452,7 +452,7 @@ protected:
|
|||
virtual void _update() override;
|
||||
|
||||
protected:
|
||||
float m_fDelayTime;
|
||||
double m_fDelayTime;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -500,7 +500,7 @@ public:
|
|||
|
||||
// 创建特定帧间隔的帧动画
|
||||
Animation(
|
||||
float interval /* 帧间隔(秒) */
|
||||
double interval /* 帧间隔(秒) */
|
||||
);
|
||||
|
||||
virtual ~Animation();
|
||||
|
|
@ -512,7 +512,7 @@ public:
|
|||
|
||||
// 设置每一帧的时间间隔
|
||||
void setInterval(
|
||||
float interval /* 帧间隔(秒) */
|
||||
double interval /* 帧间隔(秒) */
|
||||
);
|
||||
|
||||
// 获取该动画的拷贝对象
|
||||
|
|
@ -532,7 +532,7 @@ protected:
|
|||
virtual void _update() override;
|
||||
|
||||
protected:
|
||||
float m_fInterval;
|
||||
double m_fInterval;
|
||||
UINT m_nFrameIndex;
|
||||
std::vector<Image*> m_vFrames;
|
||||
};
|
||||
|
|
|
|||
16
core/ebase.h
16
core/ebase.h
|
|
@ -54,10 +54,10 @@ public:
|
|||
static String getTitle();
|
||||
|
||||
// 資函完笥錐業
|
||||
static float getWidth();
|
||||
static double getWidth();
|
||||
|
||||
// 資函完笥互業
|
||||
static float getHeight();
|
||||
static double getHeight();
|
||||
|
||||
// 資函完笥寄弌
|
||||
static Size getSize();
|
||||
|
|
@ -116,7 +116,7 @@ public:
|
|||
static int getDeltaTime();
|
||||
|
||||
// 資函嗄老蝕兵扮海<E689AE>昼<EFBFBD>
|
||||
static float getTotalTime();
|
||||
static double getTotalTime();
|
||||
|
||||
private:
|
||||
// 兜兵晒柴扮荷恬
|
||||
|
|
@ -188,22 +188,22 @@ public:
|
|||
static bool isMouseMButtonRelease();
|
||||
|
||||
// 資誼報炎X已恫炎峙
|
||||
static float getMouseX();
|
||||
static double getMouseX();
|
||||
|
||||
// 資誼報炎Y已恫炎峙
|
||||
static float getMouseY();
|
||||
static double getMouseY();
|
||||
|
||||
// 資誼報炎恫炎峙
|
||||
static Point getMousePos();
|
||||
|
||||
// 資誼報炎X已恫炎奐楚
|
||||
static float getMouseDeltaX();
|
||||
static double getMouseDeltaX();
|
||||
|
||||
// 資誼報炎Y已恫炎奐楚
|
||||
static float getMouseDeltaY();
|
||||
static double getMouseDeltaY();
|
||||
|
||||
// 資誼報炎Z已<5A>報炎獄態<E78D84>恫炎奐楚
|
||||
static float getMouseDeltaZ();
|
||||
static double getMouseDeltaZ();
|
||||
|
||||
private:
|
||||
// 兜兵晒 DirectInput 參式囚徒報炎譜姥
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ namespace e2d
|
|||
// 表示坐标的结构体
|
||||
struct Point
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
double x;
|
||||
double y;
|
||||
|
||||
Point()
|
||||
{
|
||||
|
|
@ -20,7 +20,7 @@ struct Point
|
|||
y = 0;
|
||||
}
|
||||
|
||||
Point(float x, float y)
|
||||
Point(double x, double y)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
|
|
@ -36,12 +36,12 @@ struct Point
|
|||
return Point(x - p.x, y - p.y);
|
||||
}
|
||||
|
||||
Point operator * (float const & value)
|
||||
Point operator * (double const & value)
|
||||
{
|
||||
return Point(x * value, y * value);
|
||||
}
|
||||
|
||||
Point operator / (float const & value)
|
||||
Point operator / (double const & value)
|
||||
{
|
||||
return Point(x / value, y / value);
|
||||
}
|
||||
|
|
@ -50,8 +50,8 @@ struct Point
|
|||
// 表示大小的结构体
|
||||
struct Size
|
||||
{
|
||||
float width;
|
||||
float height;
|
||||
double width;
|
||||
double height;
|
||||
|
||||
Size()
|
||||
{
|
||||
|
|
@ -59,7 +59,7 @@ struct Size
|
|||
height = 0;
|
||||
}
|
||||
|
||||
Size(float width, float height)
|
||||
Size(double width, double height)
|
||||
{
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
|
|
@ -75,12 +75,12 @@ struct Size
|
|||
return Size(width - size.width, height - size.height);
|
||||
}
|
||||
|
||||
Size operator * (float const & value)
|
||||
Size operator * (double const & value)
|
||||
{
|
||||
return Size(width * value, height * value);
|
||||
}
|
||||
|
||||
Size operator / (float const & value)
|
||||
Size operator / (double const & value)
|
||||
{
|
||||
return Size(width / value, height / value);
|
||||
}
|
||||
|
|
@ -428,7 +428,7 @@ public:
|
|||
|
||||
Font(
|
||||
String fontFamily,
|
||||
float fontSize = 22,
|
||||
double fontSize = 22,
|
||||
UINT32 color = Color::WHITE,
|
||||
UINT32 fontWeight = FontWeight::REGULAR,
|
||||
bool italic = false
|
||||
|
|
@ -437,7 +437,7 @@ public:
|
|||
virtual ~Font();
|
||||
|
||||
// 获取当前字号
|
||||
float getFontSize() const;
|
||||
double getFontSize() const;
|
||||
|
||||
// 获取当前字体粗细值
|
||||
UINT32 getFontWeight() const;
|
||||
|
|
@ -455,7 +455,7 @@ public:
|
|||
|
||||
// 设置字号
|
||||
void setSize(
|
||||
float fontSize
|
||||
double fontSize
|
||||
);
|
||||
|
||||
// 设置字体粗细值
|
||||
|
|
@ -507,20 +507,20 @@ public:
|
|||
// 从本地文件中读取资源
|
||||
Image(
|
||||
LPCTSTR strFilePath,/* 图片文件路径 */
|
||||
float nClipX, /* 裁剪位置 X 坐标 */
|
||||
float nClipY, /* 裁剪位置 Y 坐标 */
|
||||
float nClipWidth, /* 裁剪宽度 */
|
||||
float nClipHeight /* 裁剪高度 */
|
||||
double nClipX, /* 裁剪位置 X 坐标 */
|
||||
double nClipY, /* 裁剪位置 Y 坐标 */
|
||||
double nClipWidth, /* 裁剪宽度 */
|
||||
double nClipHeight /* 裁剪高度 */
|
||||
);
|
||||
|
||||
virtual ~Image();
|
||||
|
||||
// 裁剪图片
|
||||
void clip(
|
||||
float nClipX, /* 裁剪位置 X 坐标 */
|
||||
float nClipY, /* 裁剪位置 Y 坐标 */
|
||||
float nClipWidth, /* 裁剪宽度 */
|
||||
float nClipHeight /* 裁剪高度 */
|
||||
double nClipX, /* 裁剪位置 X 坐标 */
|
||||
double nClipY, /* 裁剪位置 Y 坐标 */
|
||||
double nClipWidth, /* 裁剪宽度 */
|
||||
double nClipHeight /* 裁剪高度 */
|
||||
);
|
||||
|
||||
// 从本地文件中读取图片
|
||||
|
|
@ -531,35 +531,35 @@ public:
|
|||
// 从本地文件中读取图片并裁剪
|
||||
void loadFrom(
|
||||
const String & strFilePath,/* 图片文件路径 */
|
||||
float nClipX, /* 裁剪位置 X 坐标 */
|
||||
float nClipY, /* 裁剪位置 Y 坐标 */
|
||||
float nClipWidth, /* 裁剪宽度 */
|
||||
float nClipHeight /* 裁剪高度 */
|
||||
double nClipX, /* 裁剪位置 X 坐标 */
|
||||
double nClipY, /* 裁剪位置 Y 坐标 */
|
||||
double nClipWidth, /* 裁剪宽度 */
|
||||
double nClipHeight /* 裁剪高度 */
|
||||
);
|
||||
|
||||
// 获取宽度
|
||||
virtual float getWidth() const;
|
||||
virtual double getWidth() const;
|
||||
|
||||
// 获取高度
|
||||
virtual float getHeight() const;
|
||||
virtual double getHeight() const;
|
||||
|
||||
// 获取大小
|
||||
virtual Size getSize() const;
|
||||
|
||||
// 获取源图片宽度
|
||||
virtual float getSourceWidth() const;
|
||||
virtual double getSourceWidth() const;
|
||||
|
||||
// 获取源图片高度
|
||||
virtual float getSourceHeight() const;
|
||||
virtual double getSourceHeight() const;
|
||||
|
||||
// 获取源图片大小
|
||||
virtual Size getSourceSize() const;
|
||||
|
||||
// 获取裁剪位置 X 坐标
|
||||
virtual float getClipX() const;
|
||||
virtual double getClipX() const;
|
||||
|
||||
// 获取裁剪位置 Y 坐标
|
||||
virtual float getClipY() const;
|
||||
virtual double getClipY() const;
|
||||
|
||||
// 获取裁剪位置
|
||||
virtual Point getClipPos() const;
|
||||
|
|
@ -576,10 +576,10 @@ public:
|
|||
static void clearCache();
|
||||
|
||||
protected:
|
||||
float m_fSourceClipX;
|
||||
float m_fSourceClipY;
|
||||
float m_fSourceClipWidth;
|
||||
float m_fSourceClipHeight;
|
||||
double m_fSourceClipX;
|
||||
double m_fSourceClipY;
|
||||
double m_fSourceClipWidth;
|
||||
double m_fSourceClipHeight;
|
||||
ID2D1Bitmap * m_pBitmap;
|
||||
};
|
||||
|
||||
|
|
|
|||
114
core/enodes.h
114
core/enodes.h
|
|
@ -60,55 +60,55 @@ public:
|
|||
virtual int getOrder() const;
|
||||
|
||||
// 获取节点横坐标
|
||||
virtual float getPosX() const;
|
||||
virtual double getPosX() const;
|
||||
|
||||
// 获取节点纵坐标
|
||||
virtual float getPosY() const;
|
||||
virtual double getPosY() const;
|
||||
|
||||
// 获取节点坐标
|
||||
virtual Point getPos() const;
|
||||
|
||||
// 获取节点宽度
|
||||
virtual float getWidth() const;
|
||||
virtual double getWidth() const;
|
||||
|
||||
// 获取节点高度
|
||||
virtual float getHeight() const;
|
||||
virtual double getHeight() const;
|
||||
|
||||
// 获取节点宽度(不考虑缩放)
|
||||
virtual float getRealWidth() const;
|
||||
virtual double getRealWidth() const;
|
||||
|
||||
// 获取节点高度(不考虑缩放)
|
||||
virtual float getRealHeight() const;
|
||||
virtual double getRealHeight() const;
|
||||
|
||||
// 获取节点大小(不考虑缩放)
|
||||
virtual Size getRealSize() const;
|
||||
|
||||
// 获取节点的中心点
|
||||
virtual float getPivotX() const;
|
||||
virtual double getPivotX() const;
|
||||
|
||||
// 获取节点的中心点
|
||||
virtual float getPivotY() const;
|
||||
virtual double getPivotY() const;
|
||||
|
||||
// 获取节点大小
|
||||
virtual Size getSize() const;
|
||||
|
||||
// 获取节点横向缩放比例
|
||||
virtual float getScaleX() const;
|
||||
virtual double getScaleX() const;
|
||||
|
||||
// 获取节点纵向缩放比例
|
||||
virtual float getScaleY() const;
|
||||
virtual double getScaleY() const;
|
||||
|
||||
// 获取节点横向倾斜角度
|
||||
virtual float getSkewX() const;
|
||||
virtual double getSkewX() const;
|
||||
|
||||
// 获取节点纵向倾斜角度
|
||||
virtual float getSkewY() const;
|
||||
virtual double getSkewY() const;
|
||||
|
||||
// 获取节点旋转角度
|
||||
virtual float getRotation() const;
|
||||
virtual double getRotation() const;
|
||||
|
||||
// 获取节点透明度
|
||||
virtual float getOpacity() const;
|
||||
virtual double getOpacity() const;
|
||||
|
||||
// 获取节点形状
|
||||
virtual Shape * getShape() const;
|
||||
|
|
@ -168,12 +168,12 @@ public:
|
|||
|
||||
// 设置节点横坐标
|
||||
virtual void setPosX(
|
||||
float x
|
||||
double x
|
||||
);
|
||||
|
||||
// 设置节点纵坐标
|
||||
virtual void setPosY(
|
||||
float y
|
||||
double y
|
||||
);
|
||||
|
||||
// 设置节点坐标
|
||||
|
|
@ -183,24 +183,24 @@ public:
|
|||
|
||||
// 设置节点坐标
|
||||
virtual void setPos(
|
||||
float x,
|
||||
float y
|
||||
double x,
|
||||
double y
|
||||
);
|
||||
|
||||
// 移动节点
|
||||
virtual void movePosX(
|
||||
float x
|
||||
double x
|
||||
);
|
||||
|
||||
// 移动节点
|
||||
virtual void movePosY(
|
||||
float y
|
||||
double y
|
||||
);
|
||||
|
||||
// 移动节点
|
||||
virtual void movePos(
|
||||
float x,
|
||||
float y
|
||||
double x,
|
||||
double y
|
||||
);
|
||||
|
||||
// 移动节点
|
||||
|
|
@ -217,76 +217,76 @@ public:
|
|||
// 设置横向缩放比例
|
||||
// 默认为 1.0f
|
||||
virtual void setScaleX(
|
||||
float scaleX
|
||||
double scaleX
|
||||
);
|
||||
|
||||
// 设置纵向缩放比例
|
||||
// 默认为 1.0f
|
||||
virtual void setScaleY(
|
||||
float scaleY
|
||||
double scaleY
|
||||
);
|
||||
|
||||
// 设置缩放比例
|
||||
// 默认为 (1.0f, 1.0f)
|
||||
virtual void setScale(
|
||||
float scaleX,
|
||||
float scaleY
|
||||
double scaleX,
|
||||
double scaleY
|
||||
);
|
||||
|
||||
// 设置缩放比例
|
||||
// 默认为 1.0f
|
||||
virtual void setScale(
|
||||
float scale
|
||||
double scale
|
||||
);
|
||||
|
||||
// 设置横向倾斜角度
|
||||
// 默认为 0
|
||||
virtual void setSkewX(
|
||||
float angleX
|
||||
double angleX
|
||||
);
|
||||
|
||||
// 设置纵向倾斜角度
|
||||
// 默认为 0
|
||||
virtual void setSkewY(
|
||||
float angleY
|
||||
double angleY
|
||||
);
|
||||
|
||||
// 设置倾斜角度
|
||||
// 默认为 (0, 0)
|
||||
virtual void setSkew(
|
||||
float angleX,
|
||||
float angleY
|
||||
double angleX,
|
||||
double angleY
|
||||
);
|
||||
|
||||
// 设置旋转角度
|
||||
// 默认为 0
|
||||
virtual void setRotation(
|
||||
float rotation
|
||||
double rotation
|
||||
);
|
||||
|
||||
// 设置透明度
|
||||
// 默认为 1.0f, 范围 [0, 1]
|
||||
virtual void setOpacity(
|
||||
float opacity
|
||||
double opacity
|
||||
);
|
||||
|
||||
// 设置中心点的横向位置
|
||||
// 默认为 0, 范围 [0, 1]
|
||||
virtual void setPivotX(
|
||||
float pivotX
|
||||
double pivotX
|
||||
);
|
||||
|
||||
// 设置中心点的纵向位置
|
||||
// 默认为 0, 范围 [0, 1]
|
||||
virtual void setPivotY(
|
||||
float pivotY
|
||||
double pivotY
|
||||
);
|
||||
|
||||
// 设置中心点位置
|
||||
// 默认为 (0, 0), 范围 [0, 1]
|
||||
virtual void setPivot(
|
||||
float pivotX,
|
||||
float pivotY
|
||||
double pivotX,
|
||||
double pivotY
|
||||
);
|
||||
|
||||
// 设置节点形状
|
||||
|
|
@ -331,8 +331,8 @@ public:
|
|||
|
||||
// 修改节点的默认中心点位置
|
||||
static void setDefaultPiovt(
|
||||
float defaultPiovtX,
|
||||
float defaultPiovtY
|
||||
double defaultPiovtX,
|
||||
double defaultPiovtY
|
||||
);
|
||||
|
||||
protected:
|
||||
|
|
@ -367,8 +367,8 @@ protected:
|
|||
|
||||
// 修改节点大小
|
||||
void _setSize(
|
||||
float width,
|
||||
float height
|
||||
double width,
|
||||
double height
|
||||
);
|
||||
|
||||
// 更新节点二维矩阵
|
||||
|
|
@ -379,9 +379,11 @@ protected:
|
|||
|
||||
protected:
|
||||
String m_sName;
|
||||
size_t m_nHashName;
|
||||
Point m_Pos;
|
||||
Size m_Size;
|
||||
unsigned m_nHashName;
|
||||
float m_fPosX;
|
||||
float m_fPosY;
|
||||
float m_fWidth;
|
||||
float m_fHeight;
|
||||
float m_fScaleX;
|
||||
float m_fScaleY;
|
||||
float m_fRotation;
|
||||
|
|
@ -426,10 +428,10 @@ public:
|
|||
// 从文件图片创建精灵并裁剪
|
||||
Sprite(
|
||||
LPCTSTR imageFileName,
|
||||
float x,
|
||||
float y,
|
||||
float width,
|
||||
float height
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height
|
||||
);
|
||||
|
||||
virtual ~Sprite();
|
||||
|
|
@ -446,10 +448,10 @@ public:
|
|||
|
||||
// 裁剪图片
|
||||
virtual void clip(
|
||||
float x,
|
||||
float y,
|
||||
float width,
|
||||
float height
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height
|
||||
);
|
||||
|
||||
// 获取 EImage 对象
|
||||
|
|
@ -485,7 +487,7 @@ public:
|
|||
Text(
|
||||
const String & text,
|
||||
String fontFamily,
|
||||
float fontSize = 22,
|
||||
double fontSize = 22,
|
||||
UINT32 color = Color::WHITE,
|
||||
UINT32 fontWeight = FontWeight::REGULAR,
|
||||
bool italic = false
|
||||
|
|
@ -497,10 +499,10 @@ public:
|
|||
String getText() const;
|
||||
|
||||
// 获取文本宽度
|
||||
virtual float getWidth() const override;
|
||||
virtual double getWidth() const override;
|
||||
|
||||
// 获取文本宽度(不考虑缩放)
|
||||
virtual float getRealWidth() const override;
|
||||
virtual double getRealWidth() const override;
|
||||
|
||||
// 获取字体
|
||||
Font * getFont() const;
|
||||
|
|
@ -522,7 +524,7 @@ public:
|
|||
|
||||
// 设置文字换行宽度(WordWrapping 打开时生效)
|
||||
void setWordWrappingWidth(
|
||||
float fWordWrapWidth
|
||||
double fWordWrapWidth
|
||||
);
|
||||
|
||||
// 渲染文字
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public:
|
|||
|
||||
// 设置绘制透明度
|
||||
void setOpacity(
|
||||
float opacity
|
||||
double opacity
|
||||
);
|
||||
|
||||
protected:
|
||||
|
|
@ -95,10 +95,10 @@ public:
|
|||
|
||||
// 根据左上角坐标和宽高创建矩形
|
||||
Rect(
|
||||
float x,
|
||||
float y,
|
||||
float width,
|
||||
float height
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height
|
||||
);
|
||||
|
||||
// 创建一个和节点位置大小相同的矩形
|
||||
|
|
@ -110,10 +110,10 @@ public:
|
|||
|
||||
protected:
|
||||
void _setRect(
|
||||
float left,
|
||||
float top,
|
||||
float right,
|
||||
float bottom
|
||||
double left,
|
||||
double top,
|
||||
double right,
|
||||
double bottom
|
||||
);
|
||||
|
||||
virtual ID2D1RectangleGeometry * _getD2dGeometry() const override;
|
||||
|
|
@ -133,7 +133,7 @@ public:
|
|||
// 根据圆心和半径创建圆形
|
||||
Circle(
|
||||
Point center,
|
||||
float radius
|
||||
double radius
|
||||
);
|
||||
|
||||
// 创建一个和节点位置大小相同的圆形
|
||||
|
|
@ -146,7 +146,7 @@ public:
|
|||
protected:
|
||||
void _setCircle(
|
||||
Point center,
|
||||
float radius
|
||||
double radius
|
||||
);
|
||||
|
||||
virtual ID2D1EllipseGeometry * _getD2dGeometry() const override;
|
||||
|
|
@ -166,8 +166,8 @@ public:
|
|||
// 根据圆心和半径创建椭圆
|
||||
Ellipse(
|
||||
Point center,
|
||||
float radiusX,
|
||||
float radiusY
|
||||
double radiusX,
|
||||
double radiusY
|
||||
);
|
||||
|
||||
// 创建一个和节点位置大小相同的椭圆
|
||||
|
|
@ -180,8 +180,8 @@ public:
|
|||
protected:
|
||||
void _setEllipse(
|
||||
Point center,
|
||||
float radiusX,
|
||||
float radiusY
|
||||
double radiusX,
|
||||
double radiusY
|
||||
);
|
||||
|
||||
virtual ID2D1EllipseGeometry * _getD2dGeometry() const override;
|
||||
|
|
|
|||
|
|
@ -16,20 +16,12 @@ public:
|
|||
template<typename T>
|
||||
static inline T range(T min, T max) { return e2d::Random::randomInt(min, max); }
|
||||
|
||||
// 取得浮点数范围内的一个随机数
|
||||
static inline float range(float min, float max) { return e2d::Random::randomReal(min, max); }
|
||||
|
||||
// 取得浮点数范围内的一个随机数
|
||||
static inline double range(double min, double max) { return e2d::Random::randomReal(min, max); }
|
||||
|
||||
// 取得浮点数范围内的一个随机数
|
||||
static inline long double range(long double min, long double max) { return e2d::Random::randomReal(min, max); }
|
||||
|
||||
// 取得整型范围内的一个随机数
|
||||
template<typename T>
|
||||
static T randomInt(
|
||||
T min,
|
||||
T max)
|
||||
static T randomInt(T min, T max)
|
||||
{
|
||||
std::uniform_int_distribution<T> dist(min, max);
|
||||
return dist(getEngine());
|
||||
|
|
@ -37,9 +29,7 @@ public:
|
|||
|
||||
// 取得浮点数类型范围内的一个随机数
|
||||
template<typename T>
|
||||
static T randomReal(
|
||||
T min,
|
||||
T max)
|
||||
static T randomReal(T min, T max)
|
||||
{
|
||||
std::uniform_real_distribution<T> dist(min, max);
|
||||
return dist(getEngine());
|
||||
|
|
@ -61,7 +51,7 @@ public:
|
|||
|
||||
Timer(
|
||||
const TimerCallback &callback, /* 定时器回调函数 */
|
||||
float interval = 0, /* 时间间隔(秒) */
|
||||
double interval = 0, /* 时间间隔(秒) */
|
||||
int repeatTimes = -1, /* 定时器执行次数 */
|
||||
bool atOnce = false /* 是否立即执行 */
|
||||
);
|
||||
|
|
@ -69,7 +59,7 @@ public:
|
|||
Timer(
|
||||
const String &name, /* 定时器名称 */
|
||||
const TimerCallback &callback, /* 定时器回调函数 */
|
||||
float interval = 0, /* 时间间隔(秒) */
|
||||
double interval = 0, /* 时间间隔(秒) */
|
||||
int repeatTimes = -1, /* 定时器执行次数 */
|
||||
bool atOnce = false /* 是否立即执行 */
|
||||
);
|
||||
|
|
@ -96,7 +86,7 @@ public:
|
|||
|
||||
// 设置定时器执行间隔(秒)
|
||||
void setInterval(
|
||||
float interval
|
||||
double interval
|
||||
);
|
||||
|
||||
// 设置定时器回调函数
|
||||
|
|
@ -127,8 +117,8 @@ protected:
|
|||
bool m_bAtOnce;
|
||||
int m_nRunTimes;
|
||||
int m_nRepeatTimes;
|
||||
float m_fInterval;
|
||||
float m_fLast;
|
||||
double m_fInterval;
|
||||
double m_fLast;
|
||||
Node * m_pParentNode;
|
||||
TimerCallback m_Callback;
|
||||
};
|
||||
|
|
@ -144,10 +134,10 @@ public:
|
|||
int value
|
||||
);
|
||||
|
||||
// 保存 float 类型的值
|
||||
static void saveFloat(
|
||||
// 保存 double 类型的值
|
||||
static void saveDouble(
|
||||
const String & key,
|
||||
float value
|
||||
double value
|
||||
);
|
||||
|
||||
// 保存 字符串 类型的值
|
||||
|
|
@ -163,11 +153,11 @@ public:
|
|||
int defaultValue
|
||||
);
|
||||
|
||||
// 获取 float 类型的值
|
||||
// 获取 double 类型的值
|
||||
// (若不存在则返回 defaultValue 参数的值)
|
||||
static float getFloat(
|
||||
static double getDouble(
|
||||
const String & key,
|
||||
float defaultValue
|
||||
double defaultValue
|
||||
);
|
||||
|
||||
// 获取 字符串 类型的值
|
||||
|
|
@ -229,19 +219,19 @@ public:
|
|||
bool isPlaying();
|
||||
|
||||
// 获取音量
|
||||
float getVolume() const;
|
||||
double getVolume() const;
|
||||
|
||||
// 设置音量
|
||||
bool setVolume(
|
||||
float fVolume /* 音量范围为 -224 ~ 224,其中 0 是静音,1 是正常音量 */
|
||||
double fVolume /* 音量范围为 -224 ~ 224,其中 0 是静音,1 是正常音量 */
|
||||
);
|
||||
|
||||
// 获取频率比
|
||||
float getFrequencyRatio() const;
|
||||
double getFrequencyRatio() const;
|
||||
|
||||
// 设置频率比
|
||||
bool setFrequencyRatio(
|
||||
float fFrequencyRatio /* 频率比范围为 1/1024.0f ~ 1024.0f,其中 1.0 为正常声调 */
|
||||
double fFrequencyRatio /* 频率比范围为 1/1024.0f ~ 1024.0f,其中 1.0 为正常声调 */
|
||||
);
|
||||
|
||||
// 获取 IXAudio2SourceVoice 对象
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class Transition :
|
|||
friend SceneManager;
|
||||
|
||||
public:
|
||||
Transition(float duration);
|
||||
Transition(double duration);
|
||||
|
||||
// 场景切换动画是否结束
|
||||
bool isEnding();
|
||||
|
|
@ -42,9 +42,9 @@ protected:
|
|||
|
||||
protected:
|
||||
bool m_bEnd;
|
||||
float m_fLast;
|
||||
float m_fDuration;
|
||||
float m_fRateOfProgress;
|
||||
double m_fLast;
|
||||
double m_fDuration;
|
||||
double m_fRateOfProgress;
|
||||
Scene * m_pPrevScene;
|
||||
Scene * m_pNextScene;
|
||||
};
|
||||
|
|
@ -56,8 +56,8 @@ class TransitionFade :
|
|||
public:
|
||||
// 创建淡入淡出式的场景切换动画
|
||||
TransitionFade(
|
||||
float fadeOutDuration, /* 前一场景淡出动画持续时长 */
|
||||
float fadeInDuration /* 后一场景淡入动画持续时长 */
|
||||
double fadeOutDuration, /* 前一场景淡出动画持续时长 */
|
||||
double fadeInDuration /* 后一场景淡入动画持续时长 */
|
||||
);
|
||||
|
||||
protected:
|
||||
|
|
@ -69,8 +69,8 @@ protected:
|
|||
virtual void _reset() override;
|
||||
|
||||
protected:
|
||||
float m_fFadeOutDuration;
|
||||
float m_fFadeInDuration;
|
||||
double m_fFadeOutDuration;
|
||||
double m_fFadeInDuration;
|
||||
bool m_bFadeOutTransioning;
|
||||
};
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ class TransitionEmerge :
|
|||
public:
|
||||
// 创建浮现式的场景切换动画
|
||||
TransitionEmerge(
|
||||
float duration /* 浮现动画持续时长 */
|
||||
double duration /* 浮现动画持续时长 */
|
||||
);
|
||||
|
||||
protected:
|
||||
|
|
@ -108,7 +108,7 @@ public:
|
|||
|
||||
// 创建移动式的场景切换动画
|
||||
TransitionMove(
|
||||
float moveDuration, /* 场景移动动画持续时长 */
|
||||
double moveDuration, /* 场景移动动画持续时长 */
|
||||
MOVE_DIRECT direct = LEFT /* 场景移动方向 */
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue