更新了监听器的命名

This commit is contained in:
Nomango 2017-11-03 12:51:01 +08:00
parent 56464a36e2
commit 1d5f3c7e55
49 changed files with 468 additions and 399 deletions

View File

@ -96,6 +96,9 @@
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<Manifest>
<AdditionalManifestFiles>DeclareDPIAware.manifest</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
@ -128,6 +131,9 @@
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
<Manifest>
<AdditionalManifestFiles>DeclareDPIAware.manifest</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>

View File

@ -0,0 +1,7 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>

BIN
ConsoleDemo/elyse.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View File

@ -4,43 +4,33 @@ int main()
{ {
EApp app; EApp app;
if (app.init(L"Easy2D Demo", 640, 480, true)) if (app.init(L"Easy2D Demo", 320, 320))
{ {
auto scene = new EScene(); auto scene = new EScene();
auto node = new ENode(); auto sprite = new ESprite(L"elyse.png");
node->setPos(50, 80); sprite->setScale(0.3f);
node->_setSize(30, 180); // 获取窗口宽度
scene->add(node); float width = EApp::getWidth();
// 获取窗口高度
float height = EApp::getHeight();
// 移动精灵的位置
sprite->setPos(width / 2, height / 2);
//sprite->setAnchor(0, 0);
scene->add(sprite);
auto text = new EText(L"balabalabalabalabala", L"宋体", 80, EColor::BLUE);
//text->setWordWrapping(true);
//text->setWordWrappingWidth(50);
text->setAnchor(0, 0);
/*auto listener = new EMouseListener([=] { auto listener = new EListenerMouseClick([=](EPoint) {
if (!EMouseMsg::isLButtonDown()) EPoint p = EMouseMsg::getPos();
{ sprite->setPos(p);
if (EMouseMsg::getMsg() == EMouseMsg::MOVE)
{
node->setPos(EMouseMsg::getPos());
}
}
});*/
auto listener = new EKeyboardPressListener([=] {
if (EKeyboardMsg::isCapitalLockOn())
{
if (EKeyboardMsg::getVal() == EKeyboardMsg::KEY::LEFT)
{
node->move(-3, 0);
}
if (EKeyboardMsg::getVal() == EKeyboardMsg::KEY::RIGHT)
{
node->move(3, 0);
}
}
}); });
listener->bindWith(scene);
listener->bindWith(node); EMsgManager::stopAllMouseListeners();
EMsgManager::stopAllKeyboardListeners();
EMsgManager::bindListener(listener, scene); scene->add(text, -1);
app.enterScene(scene); app.enterScene(scene);
app.run(); app.run();

BIN
ConsoleDemo/test.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -16,18 +16,16 @@ int WINAPI WinMain(
float h = EApp::getHeight(); float h = EApp::getHeight();
auto scene = new EScene(); auto scene = new EScene();
auto text = new EText(L"中文测试中文测试中文测试中文测试中文测试中文测试中文测试", EColor::WHITE, L"楷体"); auto text = new EText(L"中文测试中文测试中文测试中文测试中文测试中文测试中文测试", L"楷体");
text->setPos(EApp::getWidth() / 2, EApp::getHeight() / 2); text->setPos(EApp::getWidth() / 2, EApp::getHeight() / 2);
//text->setWordWrapping(true); //text->setWordWrapping(true);
//text->setWordWrappingWidth(130); //text->setWordWrappingWidth(130);
text->setRotation(40); text->setRotation(40);
text->getFont()->setItalic(true);
text->setAnchor(0.5f, 0.5f); text->setAnchor(0.5f, 0.5f);
text->setColor(EColor::WHITE);
//text->runAction(new EActionLoop(new EActionTwo(new EActionFadeOut(1), new EActionFadeIn(1)))); //text->runAction(new EActionLoop(new EActionTwo(new EActionFadeOut(1), new EActionFadeIn(1))));
scene->add(text); scene->add(text);
auto listener = new EKeyboardPressListener([=]() { auto listener = new EListenerKeyboardPress([=]() {
if (EKeyboardMsg::getVal() == EKeyboardMsg::KEY::SPACE) if (EKeyboardMsg::getVal() == EKeyboardMsg::KEY::SPACE)
{ {
EApp::backScene(new ETransitionFade(0.5f, 0.5f)); EApp::backScene(new ETransitionFade(0.5f, 0.5f));

View File

@ -55,6 +55,12 @@ void e2d::EAction::setInterval(LONGLONG milliSeconds)
void e2d::EAction::setTarget(ENode * node) void e2d::EAction::setTarget(ENode * node)
{ {
if (m_pTarget)
{
// 动作只能有一个目标
return;
}
if (node) if (node)
{ {
m_pTarget = node; m_pTarget = node;
@ -79,6 +85,14 @@ void e2d::EAction::_init()
m_tLast = GetNow(); m_tLast = GetNow();
} }
void e2d::EAction::_callOn()
{
if (!m_bInit)
{
_init();
}
}
void e2d::EAction::_reset() void e2d::EAction::_reset()
{ {
m_bInit = false; m_bInit = false;

View File

@ -12,7 +12,7 @@ e2d::EActionCallback * e2d::EActionCallback::clone() const
void e2d::EActionCallback::_init() void e2d::EActionCallback::_init()
{ {
EAction::_init(); // 执行回调函数的动作不需要初始化
} }
void e2d::EActionCallback::_callOn() void e2d::EActionCallback::_callOn()

View File

@ -18,6 +18,7 @@ void e2d::EActionDelay::_init()
void e2d::EActionDelay::_callOn() void e2d::EActionDelay::_callOn()
{ {
EAction::_callOn();
// 判断时间间隔是否足够 // 判断时间间隔是否足够
if (GetInterval(m_tLast) > m_nAnimationInterval) if (GetInterval(m_tLast) > m_nAnimationInterval)
{ {

View File

@ -21,6 +21,12 @@ void e2d::EActionGradual::_init()
bool e2d::EActionGradual::_isDelayEnough() bool e2d::EActionGradual::_isDelayEnough()
{ {
// 判断时间间隔是否足够 // 判断时间间隔是否足够
if (m_fTotalDuration == 0)
{
m_fRateOfProgress = 1;
return true;
}
if (GetInterval(m_tLast) > m_nAnimationInterval) if (GetInterval(m_tLast) > m_nAnimationInterval)
{ {
// 重新记录时间 // 重新记录时间

View File

@ -1,42 +1,55 @@
#include "..\eactions.h" #include "..\eactions.h"
e2d::EActionLoop::EActionLoop(EAction * action) : e2d::EActionLoop::EActionLoop(EAction * action, int times /* = -1 */)
m_Action(action) : m_pAction(action)
, m_nTimes(0)
, m_nTotalTimes(times)
{ {
m_Action->retain(); m_pAction->retain();
} }
e2d::EActionLoop::~EActionLoop() e2d::EActionLoop::~EActionLoop()
{ {
SafeRelease(&m_Action); SafeRelease(&m_pAction);
} }
e2d::EActionLoop * e2d::EActionLoop::clone() const e2d::EActionLoop * e2d::EActionLoop::clone() const
{ {
return new EActionLoop(m_Action->clone()); return new EActionLoop(m_pAction->clone());
} }
void e2d::EActionLoop::_init() void e2d::EActionLoop::_init()
{ {
EAction::_init(); EAction::_init();
if (!m_Action->getTarget() && m_pTarget) m_pAction->setTarget(m_pTarget);
{ m_pAction->_init();
m_Action->setTarget(m_pTarget);
}
m_Action->_init();
} }
void e2d::EActionLoop::_callOn() void e2d::EActionLoop::_callOn()
{ {
m_Action->_callOn(); EAction::_callOn();
if (m_Action->_isEnding()) if (m_nTimes == m_nTotalTimes)
{ {
m_Action->_reset(); this->stop();
return;
}
m_pAction->_callOn();
if (m_pAction->_isEnding())
{
m_nTimes++;
EAction::_reset();
m_pAction->_reset();
} }
} }
void e2d::EActionLoop::_reset() void e2d::EActionLoop::_reset()
{ {
EAction::_reset(); EAction::_reset();
m_pAction->_reset();
m_nTimes = 0;
} }

View File

@ -18,11 +18,14 @@ void e2d::EActionMoveBy::_init()
void e2d::EActionMoveBy::_callOn() void e2d::EActionMoveBy::_callOn()
{ {
EAction::_callOn();
if (m_pTarget == nullptr) if (m_pTarget == nullptr)
{ {
this->stop(); this->stop();
return; return;
} }
while (EActionGradual::_isDelayEnough()) while (EActionGradual::_isDelayEnough())
{ {
// 移动节点 // 移动节点

View File

@ -18,11 +18,14 @@ void e2d::EActionOpacityBy::_init()
void e2d::EActionOpacityBy::_callOn() void e2d::EActionOpacityBy::_callOn()
{ {
EAction::_callOn();
if (m_pTarget == nullptr) if (m_pTarget == nullptr)
{ {
this->stop(); this->stop();
return; return;
} }
while (EActionGradual::_isDelayEnough()) while (EActionGradual::_isDelayEnough())
{ {
// 设置节点透明度 // 设置节点透明度

View File

@ -12,17 +12,20 @@ void e2d::EActionRotateBy::_init()
EActionGradual::_init(); EActionGradual::_init();
if (m_pTarget) if (m_pTarget)
{ {
m_nBeginVal = m_pTarget->getOpacity(); m_nBeginVal = m_pTarget->getRotation();
} }
} }
void e2d::EActionRotateBy::_callOn() void e2d::EActionRotateBy::_callOn()
{ {
EAction::_callOn();
if (m_pTarget == nullptr) if (m_pTarget == nullptr)
{ {
this->stop(); this->stop();
return; return;
} }
while (EActionGradual::_isDelayEnough()) while (EActionGradual::_isDelayEnough())
{ {
// 旋转节点 // 旋转节点

View File

@ -27,11 +27,14 @@ void e2d::EActionScaleBy::_init()
void e2d::EActionScaleBy::_callOn() void e2d::EActionScaleBy::_callOn()
{ {
EAction::_callOn();
if (m_pTarget == nullptr) if (m_pTarget == nullptr)
{ {
this->stop(); this->stop();
return; return;
} }
while (EActionGradual::_isDelayEnough()) while (EActionGradual::_isDelayEnough())
{ {
// 缩放节点 // 缩放节点

View File

@ -36,19 +36,18 @@ void e2d::EActionSequence::_init()
if (m_pTarget) if (m_pTarget)
{ {
for (auto action : m_vActions) for (auto action : m_vActions)
{
if (!action->getTarget())
{ {
action->setTarget(m_pTarget); action->setTarget(m_pTarget);
} }
} }
}
// 初始化第一个动作 // 初始化第一个动作
m_vActions[0]->_init(); m_vActions[0]->_init();
} }
void e2d::EActionSequence::_callOn() void e2d::EActionSequence::_callOn()
{ {
EAction::_callOn();
auto &action = m_vActions[m_nActionIndex]; auto &action = m_vActions[m_nActionIndex];
action->_callOn(); action->_callOn();

View File

@ -34,20 +34,16 @@ e2d::EActionTwo * e2d::EActionTwo::reverse(bool actionReverse) const
void e2d::EActionTwo::_init() void e2d::EActionTwo::_init()
{ {
EAction::_init(); EAction::_init();
if (!m_pFirstAction->getTarget() && m_pTarget)
{
m_pFirstAction->setTarget(m_pTarget); m_pFirstAction->setTarget(m_pTarget);
}
if (!m_pSecondAction->getTarget() && m_pTarget)
{
m_pSecondAction->setTarget(m_pTarget); m_pSecondAction->setTarget(m_pTarget);
}
m_pFirstAction->_init(); m_pFirstAction->_init();
} }
void e2d::EActionTwo::_callOn() void e2d::EActionTwo::_callOn()
{ {
EAction::_callOn();
if (!m_pFirstAction->_isEnding()) if (!m_pFirstAction->_isEnding())
{ {
m_pFirstAction->_callOn(); m_pFirstAction->_callOn();

View File

@ -34,14 +34,8 @@ e2d::EActionTwoAtSameTime * e2d::EActionTwoAtSameTime::reverse(bool actionRevers
void e2d::EActionTwoAtSameTime::_init() void e2d::EActionTwoAtSameTime::_init()
{ {
EAction::_init(); EAction::_init();
if (!m_pFirstAction->getTarget() && m_pTarget)
{
m_pFirstAction->setTarget(m_pTarget); m_pFirstAction->setTarget(m_pTarget);
}
if (!m_pSecondAction->getTarget() && m_pTarget)
{
m_pSecondAction->setTarget(m_pTarget); m_pSecondAction->setTarget(m_pTarget);
}
m_pFirstAction->_init(); m_pFirstAction->_init();
m_pSecondAction->_init(); m_pSecondAction->_init();
@ -49,6 +43,8 @@ void e2d::EActionTwoAtSameTime::_init()
void e2d::EActionTwoAtSameTime::_callOn() void e2d::EActionTwoAtSameTime::_callOn()
{ {
EAction::_callOn();
if (!m_pFirstAction->_isEnding()) if (!m_pFirstAction->_isEnding())
{ {
m_pFirstAction->_callOn(); m_pFirstAction->_callOn();

View File

@ -30,11 +30,14 @@ void e2d::EAnimation::_init()
void e2d::EAnimation::_callOn() void e2d::EAnimation::_callOn()
{ {
EAction::_callOn();
if (m_pTarget == nullptr) if (m_pTarget == nullptr)
{ {
this->stop(); this->stop();
return; return;
} }
// 判断时间间隔是否足够 // 判断时间间隔是否足够
while (GetInterval(m_tLast) > m_nAnimationInterval) while (GetInterval(m_tLast) > m_nAnimationInterval)
{ {

View File

@ -19,6 +19,7 @@ static std::stack<e2d::EScene*> s_SceneStack;
// 游戏开始时间 // 游戏开始时间
static steady_clock::time_point s_tStart; static steady_clock::time_point s_tStart;
e2d::EApp::EApp() e2d::EApp::EApp()
: m_bEnd(false) : m_bEnd(false)
, m_bPaused(false) , m_bPaused(false)
@ -26,7 +27,7 @@ e2d::EApp::EApp()
, m_bTransitional(false) , m_bTransitional(false)
, m_bTopMost(false) , m_bTopMost(false)
, m_bShowConsole(false) , m_bShowConsole(false)
, nAnimationInterval(17LL) , m_nAnimationInterval(17LL)
, m_ClearColor(EColor::BLACK) , m_ClearColor(EColor::BLACK)
, m_pCurrentScene(nullptr) , m_pCurrentScene(nullptr)
, m_pNextScene(nullptr) , m_pNextScene(nullptr)
@ -251,9 +252,10 @@ void e2d::EApp::run()
{ {
SetWindowPos(GetHWnd(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); SetWindowPos(GetHWnd(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
} }
// 记录开始时间 // 记录开始时间
s_tStart = steady_clock::now(); s_tStart = steady_clock::now();
// 窗口消息
MSG msg; MSG msg;
while (!m_bEnd) while (!m_bEnd)
@ -275,7 +277,7 @@ void e2d::EApp::run()
void e2d::EApp::setFPS(UINT32 fps) void e2d::EApp::setFPS(UINT32 fps)
{ {
fps = min(max(fps, 30), 120); fps = min(max(fps, 30), 120);
s_pInstance->nAnimationInterval = 1000 / fps; s_pInstance->m_nAnimationInterval = 1000 / fps;
} }
bool e2d::EApp::onActivate() bool e2d::EApp::onActivate()
@ -295,10 +297,10 @@ bool e2d::EApp::onCloseWindow()
void e2d::EApp::_mainLoop() void e2d::EApp::_mainLoop()
{ {
// 时间间隔
static LONGLONG nInterval = 0LL;
// 挂起时长 // 挂起时长
static LONGLONG nWaitMS = 0L; static LONGLONG nWaitMS = 0L;
// 时间间隔
static LONGLONG nInterval;
// 上一帧画面绘制时间 // 上一帧画面绘制时间
static steady_clock::time_point tLast = steady_clock::now(); static steady_clock::time_point tLast = steady_clock::now();
@ -307,10 +309,10 @@ void e2d::EApp::_mainLoop()
// 计算时间间隔 // 计算时间间隔
nInterval = GetInterval(tLast); nInterval = GetInterval(tLast);
// 判断间隔时间是否足够 // 判断间隔时间是否足够
if (nInterval >= nAnimationInterval) if (nInterval >= m_nAnimationInterval)
{ {
// 记录当前时间 // 记录当前时间
tLast += microseconds(nAnimationInterval); tLast += microseconds(m_nAnimationInterval);
// 游戏控制流程 // 游戏控制流程
_onControl(); _onControl();
// 刷新游戏画面 // 刷新游戏画面
@ -319,7 +321,7 @@ void e2d::EApp::_mainLoop()
else else
{ {
// 计算挂起时长 // 计算挂起时长
nWaitMS = nAnimationInterval - nInterval - 1; nWaitMS = m_nAnimationInterval - nInterval - 1;
// 挂起线程,释放 CPU 占用 // 挂起线程,释放 CPU 占用
if (nWaitMS > 1LL) if (nWaitMS > 1LL)
{ {
@ -436,6 +438,11 @@ float e2d::EApp::getHeight()
return GetRenderTarget()->GetSize().height; return GetRenderTarget()->GetSize().height;
} }
e2d::ESize e2d::EApp::getSize()
{
return ESize(GetRenderTarget()->GetSize().width, GetRenderTarget()->GetSize().height);
}
void e2d::EApp::enterScene(EScene * scene, bool saveCurrentScene /* = true */) void e2d::EApp::enterScene(EScene * scene, bool saveCurrentScene /* = true */)
{ {
enterScene(scene, nullptr, saveCurrentScene); enterScene(scene, nullptr, saveCurrentScene);

View File

@ -217,16 +217,16 @@
<ClCompile Include="Geometry\EGeometry.cpp" /> <ClCompile Include="Geometry\EGeometry.cpp" />
<ClCompile Include="Geometry\EPhysicsMsg.cpp" /> <ClCompile Include="Geometry\EPhysicsMsg.cpp" />
<ClCompile Include="Geometry\ERectangle.cpp" /> <ClCompile Include="Geometry\ERectangle.cpp" />
<ClCompile Include="Listener\EContactListener.cpp" /> <ClCompile Include="Listener\EListenerPhysicsContact.cpp" />
<ClCompile Include="Listener\EKeyboardListener.cpp" /> <ClCompile Include="Listener\EListenerKeyboard.cpp" />
<ClCompile Include="Listener\EKeyboardPressListener.cpp" /> <ClCompile Include="Listener\EListenerKeyboardPress.cpp" />
<ClCompile Include="Listener\EListener.cpp" /> <ClCompile Include="Listener\EListener.cpp" />
<ClCompile Include="Listener\EMouseClickListener.cpp" /> <ClCompile Include="Listener\EListenerMouseClick.cpp" />
<ClCompile Include="Listener\EMouseDoubleClickListener.cpp" /> <ClCompile Include="Listener\EListenerMouseDoubleClick.cpp" />
<ClCompile Include="Listener\EMouseDragListener.cpp" /> <ClCompile Include="Listener\EListenerMouseDrag.cpp" />
<ClCompile Include="Listener\EMouseListener.cpp" /> <ClCompile Include="Listener\EListenerMouse.cpp" />
<ClCompile Include="Listener\EMousePressListener.cpp" /> <ClCompile Include="Listener\EListenerMousePress.cpp" />
<ClCompile Include="Listener\EPhysicsListener.cpp" /> <ClCompile Include="Listener\EListenerPhysics.cpp" />
<ClCompile Include="Manager\EActionManager.cpp" /> <ClCompile Include="Manager\EActionManager.cpp" />
<ClCompile Include="Manager\EMsgManager.cpp" /> <ClCompile Include="Manager\EMsgManager.cpp" />
<ClCompile Include="Manager\EObjectManager.cpp" /> <ClCompile Include="Manager\EObjectManager.cpp" />

View File

@ -135,30 +135,9 @@
<ClCompile Include="Manager\ETimerManager.cpp"> <ClCompile Include="Manager\ETimerManager.cpp">
<Filter>Manager</Filter> <Filter>Manager</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Listener\EKeyboardListener.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Listener\EKeyboardPressListener.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Listener\EListener.cpp"> <ClCompile Include="Listener\EListener.cpp">
<Filter>Listener</Filter> <Filter>Listener</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Listener\EMouseClickListener.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Listener\EMouseDoubleClickListener.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Listener\EMouseDragListener.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Listener\EMouseListener.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Listener\EMousePressListener.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Node\EButton.cpp"> <ClCompile Include="Node\EButton.cpp">
<Filter>Node</Filter> <Filter>Node</Filter>
</ClCompile> </ClCompile>
@ -201,13 +180,34 @@
<ClCompile Include="Manager\EPhysicsManager.cpp"> <ClCompile Include="Manager\EPhysicsManager.cpp">
<Filter>Manager</Filter> <Filter>Manager</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Listener\EPhysicsListener.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Geometry\EPhysicsMsg.cpp"> <ClCompile Include="Geometry\EPhysicsMsg.cpp">
<Filter>Geometry</Filter> <Filter>Geometry</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Listener\EContactListener.cpp"> <ClCompile Include="Listener\EListenerMouse.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Listener\EListenerKeyboard.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Listener\EListenerKeyboardPress.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Listener\EListenerMouseClick.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Listener\EListenerMouseDoubleClick.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Listener\EListenerMouseDrag.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Listener\EListenerMousePress.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Listener\EListenerPhysics.cpp">
<Filter>Listener</Filter>
</ClCompile>
<ClCompile Include="Listener\EListenerPhysicsContact.cpp">
<Filter>Listener</Filter> <Filter>Listener</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>

View File

@ -1,37 +0,0 @@
#include "..\elisteners.h"
#include "..\egeometry.h"
e2d::EContactListener::EContactListener()
: EPhysicsListener()
{
}
e2d::EContactListener::EContactListener(const EString & name)
: EPhysicsListener(name)
{
}
e2d::EContactListener::EContactListener(const COLLISION_LISTENER_CALLBACK & callback)
: EPhysicsListener()
{
this->m_Callback = callback;
}
e2d::EContactListener::EContactListener(const EString & name, const COLLISION_LISTENER_CALLBACK & callback)
: EPhysicsListener(name)
{
this->m_Callback = callback;
}
void e2d::EContactListener::_callOn()
{
if (EPhysicsMsg::getMsg() == EPhysicsMsg::OVERLAP ||
EPhysicsMsg::getMsg() == EPhysicsMsg::CONTAINS ||
EPhysicsMsg::getMsg() == EPhysicsMsg::IS_CONTAINED)
{
m_Callback(
EPhysicsMsg::getActiveGeometry()->getParentNode(),
EPhysicsMsg::getPassiveGeometry()->getParentNode()
);
}
}

View File

@ -1,29 +0,0 @@
#include "..\elisteners.h"
e2d::EKeyboardPressListener::EKeyboardPressListener()
: EKeyboardListener()
{
}
e2d::EKeyboardPressListener::EKeyboardPressListener(const EString & name)
: EKeyboardListener(name)
{
}
e2d::EKeyboardPressListener::EKeyboardPressListener(const KEY_LISTENER_CALLBACK & callback)
: EKeyboardListener(callback)
{
}
e2d::EKeyboardPressListener::EKeyboardPressListener(const EString & name, const KEY_LISTENER_CALLBACK & callback)
: EKeyboardListener(name, callback)
{
}
void e2d::EKeyboardPressListener::_callOn()
{
if (EKeyboardMsg::getMsg() == EKeyboardMsg::KEYBOARD_MSG::KEY_DOWN)
{
m_Callback();
}
}

View File

@ -1,39 +1,39 @@
#include "..\elisteners.h" #include "..\elisteners.h"
#include "..\emanagers.h" #include "..\emanagers.h"
e2d::EKeyboardListener::EKeyboardListener() e2d::EListenerKeyboard::EListenerKeyboard()
: EListener() : EListener()
{ {
} }
e2d::EKeyboardListener::EKeyboardListener(const EString & name) e2d::EListenerKeyboard::EListenerKeyboard(const EString & name)
: EListener(name) : EListener(name)
{ {
} }
e2d::EKeyboardListener::EKeyboardListener(const KEY_LISTENER_CALLBACK & callback) e2d::EListenerKeyboard::EListenerKeyboard(const KEY_LISTENER_CALLBACK & callback)
: EListener() : EListener()
{ {
m_Callback = callback; m_Callback = callback;
} }
e2d::EKeyboardListener::EKeyboardListener(const EString & name, const KEY_LISTENER_CALLBACK & callback) e2d::EListenerKeyboard::EListenerKeyboard(const EString & name, const KEY_LISTENER_CALLBACK & callback)
: EListener(name) : EListener(name)
{ {
m_Callback = callback; m_Callback = callback;
} }
void e2d::EKeyboardListener::_callOn() void e2d::EListenerKeyboard::_callOn()
{ {
m_Callback(); m_Callback();
} }
void e2d::EKeyboardListener::setCallback(const KEY_LISTENER_CALLBACK & callback) void e2d::EListenerKeyboard::setCallback(const KEY_LISTENER_CALLBACK & callback)
{ {
m_Callback = callback; m_Callback = callback;
} }
void e2d::EKeyboardListener::bindWith(EScene * pParentScene) void e2d::EListenerKeyboard::bindWith(EScene * pParentScene)
{ {
WARN_IF(m_pParentNode != nullptr, "A listener cannot bind with two object."); WARN_IF(m_pParentNode != nullptr, "A listener cannot bind with two object.");
@ -43,7 +43,7 @@ void e2d::EKeyboardListener::bindWith(EScene * pParentScene)
} }
} }
void e2d::EKeyboardListener::bindWith(ENode * pParentNode) void e2d::EListenerKeyboard::bindWith(ENode * pParentNode)
{ {
WARN_IF(m_pParentNode != nullptr, "A listener cannot bind with two object."); WARN_IF(m_pParentNode != nullptr, "A listener cannot bind with two object.");

View File

@ -0,0 +1,29 @@
#include "..\elisteners.h"
e2d::EListenerKeyboardPress::EListenerKeyboardPress()
: EListenerKeyboard()
{
}
e2d::EListenerKeyboardPress::EListenerKeyboardPress(const EString & name)
: EListenerKeyboard(name)
{
}
e2d::EListenerKeyboardPress::EListenerKeyboardPress(const KEY_LISTENER_CALLBACK & callback)
: EListenerKeyboard(callback)
{
}
e2d::EListenerKeyboardPress::EListenerKeyboardPress(const EString & name, const KEY_LISTENER_CALLBACK & callback)
: EListenerKeyboard(name, callback)
{
}
void e2d::EListenerKeyboardPress::_callOn()
{
if (EKeyboardMsg::getMsg() == EKeyboardMsg::KEYBOARD_MSG::KEY_DOWN)
{
m_Callback();
}
}

View File

@ -1,39 +1,39 @@
#include "..\elisteners.h" #include "..\elisteners.h"
#include "..\emanagers.h" #include "..\emanagers.h"
e2d::EMouseListener::EMouseListener() e2d::EListenerMouse::EListenerMouse()
: EListener() : EListener()
{ {
} }
e2d::EMouseListener::EMouseListener(const EString & name) e2d::EListenerMouse::EListenerMouse(const EString & name)
: EListener(name) : EListener(name)
{ {
} }
e2d::EMouseListener::EMouseListener(const MOUSE_LISTENER_CALLBACK & callback) e2d::EListenerMouse::EListenerMouse(const MOUSE_LISTENER_CALLBACK & callback)
: EListener() : EListener()
{ {
m_Callback = callback; m_Callback = callback;
} }
e2d::EMouseListener::EMouseListener(const EString & name, const MOUSE_LISTENER_CALLBACK & callback) e2d::EListenerMouse::EListenerMouse(const EString & name, const MOUSE_LISTENER_CALLBACK & callback)
: EListener(name) : EListener(name)
{ {
m_Callback = callback; m_Callback = callback;
} }
void e2d::EMouseListener::_callOn() void e2d::EListenerMouse::_callOn()
{ {
m_Callback(); m_Callback();
} }
void e2d::EMouseListener::setCallback(const MOUSE_LISTENER_CALLBACK & callback) void e2d::EListenerMouse::setCallback(const MOUSE_LISTENER_CALLBACK & callback)
{ {
m_Callback = callback; m_Callback = callback;
} }
void e2d::EMouseListener::bindWith(EScene * pParentScene) void e2d::EListenerMouse::bindWith(EScene * pParentScene)
{ {
WARN_IF(m_pParentNode != nullptr, "A listener cannot bind with two object."); WARN_IF(m_pParentNode != nullptr, "A listener cannot bind with two object.");
@ -43,7 +43,7 @@ void e2d::EMouseListener::bindWith(EScene * pParentScene)
} }
} }
void e2d::EMouseListener::bindWith(ENode * pParentNode) void e2d::EListenerMouse::bindWith(ENode * pParentNode)
{ {
WARN_IF(m_pParentNode != nullptr, "A listener cannot bind with two object."); WARN_IF(m_pParentNode != nullptr, "A listener cannot bind with two object.");

View File

@ -1,32 +1,32 @@
#include "..\elisteners.h" #include "..\elisteners.h"
e2d::EMouseClickListener::EMouseClickListener() e2d::EListenerMouseClick::EListenerMouseClick()
: EMouseListener() : EListenerMouse()
, m_bPressed(false) , m_bPressed(false)
{ {
} }
e2d::EMouseClickListener::EMouseClickListener(const EString & name) e2d::EListenerMouseClick::EListenerMouseClick(const EString & name)
: EMouseListener(name) : EListenerMouse(name)
, m_bPressed(false) , m_bPressed(false)
{ {
} }
e2d::EMouseClickListener::EMouseClickListener(const MOUSE_CLICK_LISTENER_CALLBACK & callback) e2d::EListenerMouseClick::EListenerMouseClick(const MOUSE_CLICK_LISTENER_CALLBACK & callback)
: EMouseListener() : EListenerMouse()
, m_Callback(callback) , m_Callback(callback)
, m_bPressed(false) , m_bPressed(false)
{ {
} }
e2d::EMouseClickListener::EMouseClickListener(const EString & name, const MOUSE_CLICK_LISTENER_CALLBACK & callback) e2d::EListenerMouseClick::EListenerMouseClick(const EString & name, const MOUSE_CLICK_LISTENER_CALLBACK & callback)
: EMouseListener(name) : EListenerMouse(name)
, m_Callback(callback) , m_Callback(callback)
, m_bPressed(false) , m_bPressed(false)
{ {
} }
void e2d::EMouseClickListener::_callOn() void e2d::EListenerMouseClick::_callOn()
{ {
if (EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DOWN || if (EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DOWN ||
EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DBLCLK) EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DBLCLK)
@ -40,7 +40,7 @@ void e2d::EMouseClickListener::_callOn()
} }
} }
void e2d::EMouseClickListener::setCallback(const MOUSE_CLICK_LISTENER_CALLBACK & callback) void e2d::EListenerMouseClick::setCallback(const MOUSE_CLICK_LISTENER_CALLBACK & callback)
{ {
m_Callback = callback; m_Callback = callback;
} }

View File

@ -1,32 +1,32 @@
#include "..\elisteners.h" #include "..\elisteners.h"
e2d::EMouseDoubleClickListener::EMouseDoubleClickListener() e2d::EListenerMouseDoubleClick::EListenerMouseDoubleClick()
: EMouseListener() : EListenerMouse()
, m_bPressed(false) , m_bPressed(false)
{ {
} }
e2d::EMouseDoubleClickListener::EMouseDoubleClickListener(const EString & name) e2d::EListenerMouseDoubleClick::EListenerMouseDoubleClick(const EString & name)
: EMouseListener(name) : EListenerMouse(name)
, m_bPressed(false) , m_bPressed(false)
{ {
} }
e2d::EMouseDoubleClickListener::EMouseDoubleClickListener(const MOUSE_DBLCLK_LISTENER_CALLBACK & callback) e2d::EListenerMouseDoubleClick::EListenerMouseDoubleClick(const MOUSE_DBLCLK_LISTENER_CALLBACK & callback)
: EMouseListener() : EListenerMouse()
, m_Callback(callback) , m_Callback(callback)
, m_bPressed(false) , m_bPressed(false)
{ {
} }
e2d::EMouseDoubleClickListener::EMouseDoubleClickListener(const EString & name, const MOUSE_DBLCLK_LISTENER_CALLBACK & callback) e2d::EListenerMouseDoubleClick::EListenerMouseDoubleClick(const EString & name, const MOUSE_DBLCLK_LISTENER_CALLBACK & callback)
: EMouseListener(name) : EListenerMouse(name)
, m_Callback(callback) , m_Callback(callback)
, m_bPressed(false) , m_bPressed(false)
{ {
} }
void e2d::EMouseDoubleClickListener::_callOn() void e2d::EListenerMouseDoubleClick::_callOn()
{ {
if (EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DOWN) if (EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DOWN)
{ {
@ -43,7 +43,7 @@ void e2d::EMouseDoubleClickListener::_callOn()
} }
} }
void e2d::EMouseDoubleClickListener::setCallback(const MOUSE_DBLCLK_LISTENER_CALLBACK & callback) void e2d::EListenerMouseDoubleClick::setCallback(const MOUSE_DBLCLK_LISTENER_CALLBACK & callback)
{ {
m_Callback = callback; m_Callback = callback;
} }

View File

@ -1,28 +1,28 @@
#include "..\elisteners.h" #include "..\elisteners.h"
e2d::EMouseDragListener::EMouseDragListener() e2d::EListenerMouseDrag::EListenerMouseDrag()
: EMouseListener() : EListenerMouse()
{ {
} }
e2d::EMouseDragListener::EMouseDragListener(const EString & name) e2d::EListenerMouseDrag::EListenerMouseDrag(const EString & name)
: EMouseListener(name) : EListenerMouse(name)
{ {
} }
e2d::EMouseDragListener::EMouseDragListener(const MOUSE_DRAG_LISTENER_CALLBACK & callback) e2d::EListenerMouseDrag::EListenerMouseDrag(const MOUSE_DRAG_LISTENER_CALLBACK & callback)
: EMouseListener() : EListenerMouse()
, m_Callback(callback) , m_Callback(callback)
{ {
} }
e2d::EMouseDragListener::EMouseDragListener(const EString & name, const MOUSE_DRAG_LISTENER_CALLBACK & callback) e2d::EListenerMouseDrag::EListenerMouseDrag(const EString & name, const MOUSE_DRAG_LISTENER_CALLBACK & callback)
: EMouseListener(name) : EListenerMouse(name)
, m_Callback(callback) , m_Callback(callback)
{ {
} }
void e2d::EMouseDragListener::_callOn() void e2d::EListenerMouseDrag::_callOn()
{ {
if (EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DOWN || if (EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DOWN ||
EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DBLCLK) EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DBLCLK)
@ -35,7 +35,7 @@ void e2d::EMouseDragListener::_callOn()
} }
} }
void e2d::EMouseDragListener::setCallback(const MOUSE_DRAG_LISTENER_CALLBACK & callback) void e2d::EListenerMouseDrag::setCallback(const MOUSE_DRAG_LISTENER_CALLBACK & callback)
{ {
m_Callback = callback; m_Callback = callback;
} }

View File

@ -0,0 +1,37 @@
#include "..\elisteners.h"
e2d::EListenerMousePress::EListenerMousePress()
: EListenerMouse()
{
}
e2d::EListenerMousePress::EListenerMousePress(const EString & name)
: EListenerMouse(name)
{
}
e2d::EListenerMousePress::EListenerMousePress(const MOUSE_PRESS_LISTENER_CALLBACK & callback)
: EListenerMouse()
, m_Callback(callback)
{
}
e2d::EListenerMousePress::EListenerMousePress(const EString & name, const MOUSE_PRESS_LISTENER_CALLBACK & callback)
: EListenerMouse(name)
, m_Callback(callback)
{
}
void e2d::EListenerMousePress::_callOn()
{
if (EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DOWN ||
EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DBLCLK)
{
m_Callback(EMouseMsg::getPos());
}
}
void e2d::EListenerMousePress::setCallback(const MOUSE_PRESS_LISTENER_CALLBACK & callback)
{
m_Callback = callback;
}

View File

@ -2,29 +2,29 @@
#include "..\egeometry.h" #include "..\egeometry.h"
#include "..\emanagers.h" #include "..\emanagers.h"
e2d::EPhysicsListener::EPhysicsListener() e2d::EListenerPhysics::EListenerPhysics()
: EListener() : EListener()
{ {
} }
e2d::EPhysicsListener::EPhysicsListener(const EString & name) e2d::EListenerPhysics::EListenerPhysics(const EString & name)
: EListener(name) : EListener(name)
{ {
} }
e2d::EPhysicsListener::EPhysicsListener(const PHYSICS_LISTENER_CALLBACK & callback) e2d::EListenerPhysics::EListenerPhysics(const PHYSICS_LISTENER_CALLBACK & callback)
: EListener() : EListener()
{ {
m_Callback = callback; m_Callback = callback;
} }
e2d::EPhysicsListener::EPhysicsListener(const EString & name, const PHYSICS_LISTENER_CALLBACK & callback) e2d::EListenerPhysics::EListenerPhysics(const EString & name, const PHYSICS_LISTENER_CALLBACK & callback)
: EListener(name) : EListener(name)
{ {
m_Callback = callback; m_Callback = callback;
} }
void e2d::EPhysicsListener::_callOn() void e2d::EListenerPhysics::_callOn()
{ {
m_Callback( m_Callback(
EPhysicsMsg::getActiveGeometry()->getParentNode(), EPhysicsMsg::getActiveGeometry()->getParentNode(),
@ -33,12 +33,12 @@ void e2d::EPhysicsListener::_callOn()
); );
} }
void e2d::EPhysicsListener::setCallback(const PHYSICS_LISTENER_CALLBACK & callback) void e2d::EListenerPhysics::setCallback(const PHYSICS_LISTENER_CALLBACK & callback)
{ {
m_Callback = callback; m_Callback = callback;
} }
void e2d::EPhysicsListener::bindWith(EScene * pParentScene) void e2d::EListenerPhysics::bindWith(EScene * pParentScene)
{ {
WARN_IF(m_pParentNode != nullptr, "A listener cannot bind with two object."); WARN_IF(m_pParentNode != nullptr, "A listener cannot bind with two object.");
@ -48,7 +48,7 @@ void e2d::EPhysicsListener::bindWith(EScene * pParentScene)
} }
} }
void e2d::EPhysicsListener::bindWith(ENode * pParentNode) void e2d::EListenerPhysics::bindWith(ENode * pParentNode)
{ {
WARN_IF(m_pParentNode != nullptr, "A listener cannot bind with two object."); WARN_IF(m_pParentNode != nullptr, "A listener cannot bind with two object.");

View File

@ -0,0 +1,37 @@
#include "..\elisteners.h"
#include "..\egeometry.h"
e2d::EListenerPhysicsContact::EListenerPhysicsContact()
: EListenerPhysics()
{
}
e2d::EListenerPhysicsContact::EListenerPhysicsContact(const EString & name)
: EListenerPhysics(name)
{
}
e2d::EListenerPhysicsContact::EListenerPhysicsContact(const COLLISION_LISTENER_CALLBACK & callback)
: EListenerPhysics()
{
this->m_Callback = callback;
}
e2d::EListenerPhysicsContact::EListenerPhysicsContact(const EString & name, const COLLISION_LISTENER_CALLBACK & callback)
: EListenerPhysics(name)
{
this->m_Callback = callback;
}
void e2d::EListenerPhysicsContact::_callOn()
{
if (EPhysicsMsg::getMsg() == EPhysicsMsg::OVERLAP ||
EPhysicsMsg::getMsg() == EPhysicsMsg::CONTAINS ||
EPhysicsMsg::getMsg() == EPhysicsMsg::IS_CONTAINED)
{
m_Callback(
EPhysicsMsg::getActiveGeometry()->getParentNode(),
EPhysicsMsg::getPassiveGeometry()->getParentNode()
);
}
}

View File

@ -1,37 +0,0 @@
#include "..\elisteners.h"
e2d::EMousePressListener::EMousePressListener()
: EMouseListener()
{
}
e2d::EMousePressListener::EMousePressListener(const EString & name)
: EMouseListener(name)
{
}
e2d::EMousePressListener::EMousePressListener(const MOUSE_PRESS_LISTENER_CALLBACK & callback)
: EMouseListener()
, m_Callback(callback)
{
}
e2d::EMousePressListener::EMousePressListener(const EString & name, const MOUSE_PRESS_LISTENER_CALLBACK & callback)
: EMouseListener(name)
, m_Callback(callback)
{
}
void e2d::EMousePressListener::_callOn()
{
if (EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DOWN ||
EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DBLCLK)
{
m_Callback(EMouseMsg::getPos());
}
}
void e2d::EMousePressListener::setCallback(const MOUSE_PRESS_LISTENER_CALLBACK & callback)
{
m_Callback = callback;
}

View File

@ -149,11 +149,6 @@ void e2d::EActionManager::ActionProc()
} }
else else
{ {
// 初始化动作
if (!action->m_bInit)
{
action->_init();
}
// 执行动作 // 执行动作
action->_callOn(); action->_callOn();
} }

View File

@ -5,9 +5,9 @@
// 鼠标消息监听器 // 鼠标消息监听器
e2d::EVector<e2d::EMouseListener*> s_vMouseListeners; e2d::EVector<e2d::EListenerMouse*> s_vMouseListeners;
// 按键消息监听器 // 按键消息监听器
e2d::EVector<e2d::EKeyboardListener*> s_vKeyboardListeners; e2d::EVector<e2d::EListenerKeyboard*> s_vKeyboardListeners;
void e2d::EMsgManager::MouseProc(UINT message, WPARAM wParam, LPARAM lParam) void e2d::EMsgManager::MouseProc(UINT message, WPARAM wParam, LPARAM lParam)
@ -60,20 +60,20 @@ void e2d::EMsgManager::KeyboardProc(UINT message, WPARAM wParam, LPARAM lParam)
} }
} }
void e2d::EMsgManager::bindListener(e2d::EMouseListener * listener, EScene * pParentScene, bool always /* = false */) void e2d::EMsgManager::bindListener(e2d::EListenerMouse * listener, EScene * pParentScene, bool always /* = false */)
{ {
EMsgManager::bindListener(listener, pParentScene->getRoot(), always); EMsgManager::bindListener(listener, pParentScene->getRoot(), always);
} }
void e2d::EMsgManager::bindListener(EKeyboardListener * listener, EScene * pParentScene, bool always /* = false */) void e2d::EMsgManager::bindListener(EListenerKeyboard * listener, EScene * pParentScene, bool always /* = false */)
{ {
EMsgManager::bindListener(listener, pParentScene->getRoot(), always); EMsgManager::bindListener(listener, pParentScene->getRoot(), always);
} }
void e2d::EMsgManager::bindListener(EMouseListener * listener, ENode * pParentNode, bool always /* = false */) void e2d::EMsgManager::bindListener(EListenerMouse * listener, ENode * pParentNode, bool always /* = false */)
{ {
WARN_IF(listener == nullptr, "EMouseListener NULL pointer exception!"); WARN_IF(listener == nullptr, "EListenerMouse NULL pointer exception!");
WARN_IF(pParentNode == nullptr, "Bind EMouseListener with a NULL ENode pointer!"); WARN_IF(pParentNode == nullptr, "Bind EListenerMouse with a NULL ENode pointer!");
if (listener && pParentNode) if (listener && pParentNode)
{ {
@ -90,10 +90,10 @@ void e2d::EMsgManager::bindListener(EMouseListener * listener, ENode * pParentNo
} }
} }
void e2d::EMsgManager::bindListener(EKeyboardListener * listener, ENode * pParentNode, bool always /* = false */) void e2d::EMsgManager::bindListener(EListenerKeyboard * listener, ENode * pParentNode, bool always /* = false */)
{ {
WARN_IF(listener == nullptr, "EKeyboardListener NULL pointer exception!"); WARN_IF(listener == nullptr, "EListenerKeyboard NULL pointer exception!");
WARN_IF(pParentNode == nullptr, "Bind EKeyboardListener with a NULL ENode pointer!"); WARN_IF(pParentNode == nullptr, "Bind EListenerKeyboard with a NULL ENode pointer!");
if (listener && pParentNode) if (listener && pParentNode)
{ {
@ -135,7 +135,7 @@ void e2d::EMsgManager::stopMouseListeners(const EString & name)
void e2d::EMsgManager::delMouseListeners(const EString & name) void e2d::EMsgManager::delMouseListeners(const EString & name)
{ {
// 删除鼠标消息监听器 // 删除鼠标消息监听器
EVector<EMouseListener*>::iterator mIter; EVector<EListenerMouse*>::iterator mIter;
for (mIter = s_vMouseListeners.begin(); mIter != s_vMouseListeners.end();) for (mIter = s_vMouseListeners.begin(); mIter != s_vMouseListeners.end();)
{ {
if ((*mIter)->getName() == name) if ((*mIter)->getName() == name)
@ -177,7 +177,7 @@ void e2d::EMsgManager::stopKeyboardListeners(const EString & name)
void e2d::EMsgManager::delKeyboardListeners(const EString & name) void e2d::EMsgManager::delKeyboardListeners(const EString & name)
{ {
// 删除按键消息监听器 // 删除按键消息监听器
EVector<EKeyboardListener*>::iterator kIter; EVector<EListenerKeyboard*>::iterator kIter;
for (kIter = s_vKeyboardListeners.begin(); kIter != s_vKeyboardListeners.end();) for (kIter = s_vKeyboardListeners.begin(); kIter != s_vKeyboardListeners.end();)
{ {
if ((*kIter)->getName() == name) if ((*kIter)->getName() == name)

View File

@ -4,7 +4,7 @@
#include "..\egeometry.h" #include "..\egeometry.h"
// 监听器集合 // 监听器集合
e2d::EVector<e2d::EPhysicsListener*> s_vListeners; e2d::EVector<e2d::EListenerPhysics*> s_vListeners;
// 形状集合 // 形状集合
e2d::EVector<e2d::EGeometry*> s_vGeometries; e2d::EVector<e2d::EGeometry*> s_vGeometries;
@ -62,15 +62,15 @@ void e2d::EPhysicsManager::PhysicsListenerProc()
} }
} }
void e2d::EPhysicsManager::bindListener(EPhysicsListener * listener, EScene * pParentScene) void e2d::EPhysicsManager::bindListener(EListenerPhysics * listener, EScene * pParentScene)
{ {
EPhysicsManager::bindListener(listener, pParentScene->getRoot()); EPhysicsManager::bindListener(listener, pParentScene->getRoot());
} }
void e2d::EPhysicsManager::bindListener(EPhysicsListener * listener, ENode * pParentNode) void e2d::EPhysicsManager::bindListener(EListenerPhysics * listener, ENode * pParentNode)
{ {
WARN_IF(listener == nullptr, "EPhysicsListener NULL pointer exception!"); WARN_IF(listener == nullptr, "EListenerPhysics NULL pointer exception!");
WARN_IF(pParentNode == nullptr, "EPhysicsListener add to a NULL ENode pointer!"); WARN_IF(pParentNode == nullptr, "EListenerPhysics add to a NULL ENode pointer!");
if (listener && pParentNode) if (listener && pParentNode)
{ {
@ -135,7 +135,7 @@ void e2d::EPhysicsManager::stopListeners(const EString & name)
void e2d::EPhysicsManager::delListeners(const EString & name) void e2d::EPhysicsManager::delListeners(const EString & name)
{ {
EVector<EPhysicsListener*>::iterator iter; EVector<EListenerPhysics*>::iterator iter;
for (iter = s_vListeners.begin(); iter != s_vListeners.end();) for (iter = s_vListeners.begin(); iter != s_vListeners.end();)
{ {
if ((*iter)->getName() == name) if ((*iter)->getName() == name)

View File

@ -109,7 +109,7 @@ void e2d::EButton::setDisable(bool disable)
void e2d::EButton::setCallback(const BUTTON_CLICK_CALLBACK & callback) void e2d::EButton::setCallback(const BUTTON_CLICK_CALLBACK & callback)
{ {
auto listener = new EMouseListener(std::bind(&EButton::_listenerCallback, this)); auto listener = new EListenerMouse(std::bind(&EButton::_listenerCallback, this));
EMsgManager::bindListener(listener, this, true); EMsgManager::bindListener(listener, this, true);
m_Callback = callback; m_Callback = callback;
} }

View File

@ -379,14 +379,24 @@ void e2d::ENode::setPos(float x, float y)
m_bTransformChildrenNeeded = true; m_bTransformChildrenNeeded = true;
} }
void e2d::ENode::move(float x, float y) void e2d::ENode::movePosX(float x)
{
this->movePos(x, 0);
}
void e2d::ENode::movePosY(float y)
{
this->movePos(0, y);
}
void e2d::ENode::movePos(float x, float y)
{ {
this->setPos(m_Pos.x + x, m_Pos.y + y); this->setPos(m_Pos.x + x, m_Pos.y + y);
} }
void e2d::ENode::move(const EVec & v) void e2d::ENode::movePos(const EVec & v)
{ {
this->move(v.x, v.y); this->movePos(v.x, v.y);
} }
void e2d::ENode::_setWidth(float width) void e2d::ENode::_setWidth(float width)

View File

@ -33,13 +33,13 @@ e2d::ESprite::ESprite(const EString & imageFileName, float x, float y, float wid
clip(x, y, width, height); clip(x, y, width, height);
} }
e2d::ESprite::ESprite(const EString & resourceName, const EString & resourceType) e2d::ESprite::ESprite(LPCTSTR resourceName, LPCTSTR resourceType)
: ESprite() : ESprite()
{ {
loadFrom(resourceName, resourceType); loadFrom(resourceName, resourceType);
} }
e2d::ESprite::ESprite(const EString & resourceName, const EString & resourceType, float x, float y, float width, float height) e2d::ESprite::ESprite(LPCTSTR resourceName, LPCTSTR resourceType, float x, float y, float width, float height)
{ {
loadFrom(resourceName, resourceType); loadFrom(resourceName, resourceType);
clip(x, y, width, height); clip(x, y, width, height);
@ -69,7 +69,7 @@ void e2d::ESprite::loadFrom(const EString & imageFileName)
loadFrom(new ETexture(imageFileName)); loadFrom(new ETexture(imageFileName));
} }
void e2d::ESprite::loadFrom(const EString & resourceName, const EString & resourceType) void e2d::ESprite::loadFrom(LPCTSTR resourceName, LPCTSTR resourceType)
{ {
loadFrom(new ETexture(resourceName, resourceType)); loadFrom(new ETexture(resourceName, resourceType));
} }

View File

@ -21,7 +21,7 @@ e2d::ESpriteFrame::ESpriteFrame(const EString & imageFileName)
_setTexture(new ETexture(imageFileName)); _setTexture(new ETexture(imageFileName));
} }
e2d::ESpriteFrame::ESpriteFrame(const EString & resourceName, const EString & resourceType) e2d::ESpriteFrame::ESpriteFrame(LPCTSTR resourceName, LPCTSTR resourceType)
: ESpriteFrame() : ESpriteFrame()
{ {
_setTexture(new ETexture(resourceName, resourceType)); _setTexture(new ETexture(resourceName, resourceType));
@ -41,7 +41,7 @@ e2d::ESpriteFrame::ESpriteFrame(const EString & imageFileName, float x, float y,
_clipTexture(x, y, width, height); _clipTexture(x, y, width, height);
} }
e2d::ESpriteFrame::ESpriteFrame(const EString & resourceName, const EString & resourceType, float x, float y, float width, float height) e2d::ESpriteFrame::ESpriteFrame(LPCTSTR resourceName, LPCTSTR resourceType, float x, float y, float width, float height)
: ESpriteFrame() : ESpriteFrame()
{ {
_setTexture(new ETexture(resourceName, resourceType)); _setTexture(new ETexture(resourceName, resourceType));

View File

@ -35,7 +35,7 @@ e2d::ETexture::ETexture(const EString & fileName)
this->loadFromFile(fileName); this->loadFromFile(fileName);
} }
e2d::ETexture::ETexture(const EString & resourceName, const EString & resourceType) e2d::ETexture::ETexture(LPCTSTR resourceName, LPCTSTR resourceType)
{ {
this->loadFromResource(resourceName, resourceType); this->loadFromResource(resourceName, resourceType);
} }
@ -63,11 +63,11 @@ void e2d::ETexture::loadFromFile(const EString & fileName)
m_pBitmap = s_mBitmapsFromFile.at(hash); m_pBitmap = s_mBitmapsFromFile.at(hash);
} }
void e2d::ETexture::loadFromResource(const EString & resourceName, const EString & resourceType) void e2d::ETexture::loadFromResource(LPCTSTR resourceName, LPCTSTR resourceType)
{ {
WARN_IF(resourceName.empty() || resourceType.empty(), "ETexture cannot load bitmap from NULL resource."); WARN_IF(!resourceName || !resourceType, "ETexture cannot load bitmap from NULL resource.");
if (resourceName.empty() || resourceType.empty()) if (!resourceName || !resourceType)
return; return;
if (!e2d::ETexture::preload(resourceName, resourceType)) if (!e2d::ETexture::preload(resourceName, resourceType))
@ -77,7 +77,7 @@ void e2d::ETexture::loadFromResource(const EString & resourceName, const EString
} }
ResKey key; ResKey key;
std::hash<e2d::EString> h; std::hash<LPCTSTR> h;
key.resNameHash = h(resourceName); key.resNameHash = h(resourceName);
key.resTypeHash = h(resourceType); key.resTypeHash = h(resourceType);
@ -202,9 +202,9 @@ bool e2d::ETexture::preload(const EString & fileName)
return SUCCEEDED(hr); return SUCCEEDED(hr);
} }
bool e2d::ETexture::preload(const EString & resourceName, const EString & resourceType) bool e2d::ETexture::preload(LPCTSTR resourceName, LPCTSTR resourceType)
{ {
std::hash<e2d::EString> h; std::hash<LPCTSTR> h;
ResKey key; ResKey key;
key.resNameHash = h(resourceName); key.resNameHash = h(resourceName);
@ -230,7 +230,7 @@ bool e2d::ETexture::preload(const EString & resourceName, const EString & resour
DWORD imageFileSize = 0; DWORD imageFileSize = 0;
// ¶¨Î»×ÊÔ´ // ¶¨Î»×ÊÔ´
imageResHandle = ::FindResourceW(HINST_THISCOMPONENT, resourceName.c_str(), resourceType.c_str()); imageResHandle = ::FindResourceW(HINST_THISCOMPONENT, resourceName, resourceType);
hr = imageResHandle ? S_OK : E_FAIL; hr = imageResHandle ? S_OK : E_FAIL;
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
@ -321,7 +321,7 @@ bool e2d::ETexture::preload(const EString & resourceName, const EString & resour
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
std::hash<e2d::EString> h; std::hash<LPCTSTR> h;
ResKey key; ResKey key;
key.resNameHash = h(resourceName); key.resNameHash = h(resourceName);

View File

@ -40,7 +40,7 @@ bool e2d::ETimer::isRunning() const
void e2d::ETimer::start() void e2d::ETimer::start()
{ {
m_bRunning = true; m_bRunning = true;
m_tLast = GetNow(); m_tLast = steady_clock::now();
} }
void e2d::ETimer::stop() void e2d::ETimer::stop()

View File

@ -35,7 +35,7 @@ void e2d::ETransitionMove::_setTarget(EScene * prev, EScene * next, bool & trans
} }
// 初始化场景属性 // 初始化场景属性
next->getRoot()->move(-distPosX, -distPosY); next->getRoot()->movePos(-distPosX, -distPosY);
// 第一个场景移出 // 第一个场景移出
auto action1 = new EActionMoveBy(m_fMoveDuration, EVec(distPosX, distPosY)); auto action1 = new EActionMoveBy(m_fMoveDuration, EVec(distPosX, distPosY));

View File

@ -65,7 +65,7 @@ protected:
virtual void _init(); virtual void _init();
// 执行动作 // 执行动作
virtual void _callOn() = 0; virtual void _callOn();
// 获取动作结束状态 // 获取动作结束状态
virtual bool _isEnding(); virtual bool _isEnding();
@ -527,7 +527,8 @@ class EActionLoop :
public: public:
// 创建循环动作 // 创建循环动作
EActionLoop( EActionLoop(
EAction * action /* 执行循环的动作 */ EAction * action, /* 执行循环的动作 */
int times = -1 /* 循环次数 */
); );
virtual ~EActionLoop(); virtual ~EActionLoop();
@ -546,7 +547,9 @@ protected:
virtual void _reset() override; virtual void _reset() override;
protected: protected:
EAction * m_Action; EAction * m_pAction;
int m_nTimes;
int m_nTotalTimes;
}; };

View File

@ -11,8 +11,8 @@ namespace e2d
class EScene; class EScene;
class ENode; class ENode;
class EObjectManager; class EObjectManager;
class EMouseListener; class EListenerMouse;
class EKeyboardListener; class EListenerKeyboard;
class EAction; class EAction;
class ETransition; class ETransition;
@ -109,6 +109,9 @@ public:
// 获取窗口高度 // 获取窗口高度
static float getHeight(); static float getHeight();
// 获取窗口大小
static ESize getSize();
// 获取当前场景 // 获取当前场景
static EScene * getCurrentScene(); static EScene * getCurrentScene();
@ -183,7 +186,7 @@ protected:
EString m_sTitle; EString m_sTitle;
EString m_sAppName; EString m_sAppName;
UINT32 m_ClearColor; UINT32 m_ClearColor;
LONGLONG nAnimationInterval; LONGLONG m_nAnimationInterval;
EScene * m_pCurrentScene; EScene * m_pCurrentScene;
EScene * m_pNextScene; EScene * m_pNextScene;
}; };

View File

@ -65,23 +65,23 @@ protected:
// 鼠标消息监听器 // 鼠标消息监听器
class EMouseListener : class EListenerMouse :
public EListener public EListener
{ {
friend EMsgManager; friend EMsgManager;
public: public:
EMouseListener(); EListenerMouse();
EMouseListener( EListenerMouse(
const EString &name const EString &name
); );
EMouseListener( EListenerMouse(
const MOUSE_LISTENER_CALLBACK &callback const MOUSE_LISTENER_CALLBACK &callback
); );
EMouseListener( EListenerMouse(
const EString &name, const EString &name,
const MOUSE_LISTENER_CALLBACK &callback const MOUSE_LISTENER_CALLBACK &callback
); );
@ -111,21 +111,21 @@ protected:
// 鼠标按下消息监听器 // 鼠标按下消息监听器
class EMousePressListener : class EListenerMousePress :
public EMouseListener public EListenerMouse
{ {
public: public:
EMousePressListener(); EListenerMousePress();
EMousePressListener( EListenerMousePress(
const EString &name const EString &name
); );
EMousePressListener( EListenerMousePress(
const MOUSE_PRESS_LISTENER_CALLBACK &callback const MOUSE_PRESS_LISTENER_CALLBACK &callback
); );
EMousePressListener( EListenerMousePress(
const EString &name, const EString &name,
const MOUSE_PRESS_LISTENER_CALLBACK &callback const MOUSE_PRESS_LISTENER_CALLBACK &callback
); );
@ -145,21 +145,21 @@ protected:
// 鼠标点击消息监听器 // 鼠标点击消息监听器
class EMouseClickListener : class EListenerMouseClick :
public EMouseListener public EListenerMouse
{ {
public: public:
EMouseClickListener(); EListenerMouseClick();
EMouseClickListener( EListenerMouseClick(
const EString &name const EString &name
); );
EMouseClickListener( EListenerMouseClick(
const MOUSE_CLICK_LISTENER_CALLBACK &callback const MOUSE_CLICK_LISTENER_CALLBACK &callback
); );
EMouseClickListener( EListenerMouseClick(
const EString &name, const EString &name,
const MOUSE_CLICK_LISTENER_CALLBACK &callback const MOUSE_CLICK_LISTENER_CALLBACK &callback
); );
@ -180,21 +180,21 @@ protected:
// 鼠标点击消息监听器 // 鼠标点击消息监听器
class EMouseDoubleClickListener : class EListenerMouseDoubleClick :
public EMouseListener public EListenerMouse
{ {
public: public:
EMouseDoubleClickListener(); EListenerMouseDoubleClick();
EMouseDoubleClickListener( EListenerMouseDoubleClick(
const EString &name const EString &name
); );
EMouseDoubleClickListener( EListenerMouseDoubleClick(
const MOUSE_DBLCLK_LISTENER_CALLBACK &callback const MOUSE_DBLCLK_LISTENER_CALLBACK &callback
); );
EMouseDoubleClickListener( EListenerMouseDoubleClick(
const EString &name, const EString &name,
const MOUSE_DBLCLK_LISTENER_CALLBACK &callback const MOUSE_DBLCLK_LISTENER_CALLBACK &callback
); );
@ -215,21 +215,21 @@ protected:
// 鼠标拖动消息监听器 // 鼠标拖动消息监听器
class EMouseDragListener : class EListenerMouseDrag :
public EMouseListener public EListenerMouse
{ {
public: public:
EMouseDragListener(); EListenerMouseDrag();
EMouseDragListener( EListenerMouseDrag(
const EString &name const EString &name
); );
EMouseDragListener( EListenerMouseDrag(
const MOUSE_DRAG_LISTENER_CALLBACK &callback const MOUSE_DRAG_LISTENER_CALLBACK &callback
); );
EMouseDragListener( EListenerMouseDrag(
const EString &name, const EString &name,
const MOUSE_DRAG_LISTENER_CALLBACK &callback const MOUSE_DRAG_LISTENER_CALLBACK &callback
); );
@ -250,23 +250,23 @@ protected:
// 按键消息监听器 // 按键消息监听器
class EKeyboardListener : class EListenerKeyboard :
public EListener public EListener
{ {
friend EMsgManager; friend EMsgManager;
public: public:
EKeyboardListener(); EListenerKeyboard();
EKeyboardListener( EListenerKeyboard(
const EString &name const EString &name
); );
EKeyboardListener( EListenerKeyboard(
const KEY_LISTENER_CALLBACK &callback const KEY_LISTENER_CALLBACK &callback
); );
EKeyboardListener( EListenerKeyboard(
const EString &name, const EString &name,
const KEY_LISTENER_CALLBACK &callback const KEY_LISTENER_CALLBACK &callback
); );
@ -296,23 +296,23 @@ protected:
// 按键按下消息监听 // 按键按下消息监听
class EKeyboardPressListener : class EListenerKeyboardPress :
public EKeyboardListener public EListenerKeyboard
{ {
friend EMsgManager; friend EMsgManager;
public: public:
EKeyboardPressListener(); EListenerKeyboardPress();
EKeyboardPressListener( EListenerKeyboardPress(
const EString &name const EString &name
); );
EKeyboardPressListener( EListenerKeyboardPress(
const KEY_LISTENER_CALLBACK &callback const KEY_LISTENER_CALLBACK &callback
); );
EKeyboardPressListener( EListenerKeyboardPress(
const EString &name, const EString &name,
const KEY_LISTENER_CALLBACK &callback const KEY_LISTENER_CALLBACK &callback
); );
@ -330,23 +330,23 @@ typedef std::function<void(ENode *active, ENode *passive, int relation)> PHYSICS
typedef std::function<void(ENode *active, ENode *passive)> COLLISION_LISTENER_CALLBACK; typedef std::function<void(ENode *active, ENode *passive)> COLLISION_LISTENER_CALLBACK;
// 物理世界消息监听器 // 物理世界消息监听器
class EPhysicsListener : class EListenerPhysics :
public EListener public EListener
{ {
friend EPhysicsManager; friend EPhysicsManager;
public: public:
EPhysicsListener(); EListenerPhysics();
EPhysicsListener( EListenerPhysics(
const EString &name const EString &name
); );
EPhysicsListener( EListenerPhysics(
const PHYSICS_LISTENER_CALLBACK &callback const PHYSICS_LISTENER_CALLBACK &callback
); );
EPhysicsListener( EListenerPhysics(
const EString &name, const EString &name,
const PHYSICS_LISTENER_CALLBACK &callback const PHYSICS_LISTENER_CALLBACK &callback
); );
@ -375,23 +375,23 @@ protected:
}; };
class EContactListener : class EListenerPhysicsContact :
public EPhysicsListener public EListenerPhysics
{ {
friend EMsgManager; friend EMsgManager;
public: public:
EContactListener(); EListenerPhysicsContact();
EContactListener( EListenerPhysicsContact(
const EString &name const EString &name
); );
EContactListener( EListenerPhysicsContact(
const COLLISION_LISTENER_CALLBACK &callback const COLLISION_LISTENER_CALLBACK &callback
); );
EContactListener( EListenerPhysicsContact(
const EString &name, const EString &name,
const COLLISION_LISTENER_CALLBACK &callback const COLLISION_LISTENER_CALLBACK &callback
); );

View File

@ -11,10 +11,10 @@ class EScene;
class ENode; class ENode;
class ETimer; class ETimer;
class EAction; class EAction;
class EMouseListener; class EListenerMouse;
class EKeyboardListener; class EListenerKeyboard;
class EGeometry; class EGeometry;
class EPhysicsListener; class EListenerPhysics;
// 对象管理器 // 对象管理器
class EObjectManager class EObjectManager
@ -46,14 +46,14 @@ class EMsgManager
public: public:
// 绑定鼠标消息监听器到场景 // 绑定鼠标消息监听器到场景
static void bindListener( static void bindListener(
EMouseListener * listener, EListenerMouse * listener,
EScene * pParentScene, EScene * pParentScene,
bool always = false /* 是否在游戏暂停时仍然监听 */ bool always = false /* 是否在游戏暂停时仍然监听 */
); );
// 绑定鼠标消息监听器到节点 // 绑定鼠标消息监听器到节点
static void bindListener( static void bindListener(
EMouseListener * listener, EListenerMouse * listener,
ENode * pParentNode, ENode * pParentNode,
bool always = false /* 是否在游戏暂停时仍然监听 */ bool always = false /* 是否在游戏暂停时仍然监听 */
); );
@ -101,14 +101,14 @@ public:
// 绑定按键消息监听器到场景 // 绑定按键消息监听器到场景
static void bindListener( static void bindListener(
EKeyboardListener * listener, EListenerKeyboard * listener,
EScene * pParentScene, EScene * pParentScene,
bool always = false /* 是否在游戏暂停时仍然监听 */ bool always = false /* 是否在游戏暂停时仍然监听 */
); );
// 绑定按键消息监听器到节点 // 绑定按键消息监听器到节点
static void bindListener( static void bindListener(
EKeyboardListener * listener, EListenerKeyboard * listener,
ENode * pParentNode, ENode * pParentNode,
bool always = false /* 是否在游戏暂停时仍然监听 */ bool always = false /* 是否在游戏暂停时仍然监听 */
); );
@ -326,13 +326,13 @@ class EPhysicsManager
public: public:
// 将监听器与场景绑定 // 将监听器与场景绑定
static void bindListener( static void bindListener(
EPhysicsListener * listener, EListenerPhysics * listener,
EScene * pParentScene EScene * pParentScene
); );
// 将监听器与节点绑定 // 将监听器与节点绑定
static void bindListener( static void bindListener(
EPhysicsListener * listener, EListenerPhysics * listener,
ENode * pParentNode ENode * pParentNode
); );

View File

@ -141,13 +141,23 @@ public:
); );
// 移动节点 // 移动节点
virtual void move( virtual void movePosX(
float x
);
// ÒÆ¶¯½Úµã
virtual void movePosY(
float y
);
// ÒÆ¶¯½Úµã
virtual void movePos(
float x, float x,
float y float y
); );
// 移动节点 // 移动节点
virtual void move( virtual void movePos(
const EVec & v const EVec & v
); );
@ -396,8 +406,8 @@ public:
// 读取程序资源 // 读取程序资源
ETexture( ETexture(
const EString & resourceName, LPCTSTR resourceName,
const EString & resourceType LPCTSTR resourceType
); );
virtual ~ETexture(); virtual ~ETexture();
@ -409,8 +419,8 @@ public:
// 读取程序资源 // 读取程序资源
void loadFromResource( void loadFromResource(
const EString & resourceName, LPCTSTR resourceName,
const EString & resourceType LPCTSTR resourceType
); );
// 获取源图片宽度 // 获取源图片宽度
@ -429,8 +439,8 @@ public:
// 预加载资源 // 预加载资源
static bool preload( static bool preload(
const EString & resourceName, LPCTSTR resourceName,
const EString & resourceType LPCTSTR resourceType
); );
// 清空缓存 // 清空缓存
@ -465,8 +475,8 @@ public:
// 创建空的精灵帧 // 创建空的精灵帧
ESpriteFrame( ESpriteFrame(
const EString & resourceName, LPCTSTR resourceName,
const EString & resourceType LPCTSTR resourceType
); );
// 创建空的精灵帧 // 创建空的精灵帧
@ -489,8 +499,8 @@ public:
// 创建空的精灵帧 // 创建空的精灵帧
ESpriteFrame( ESpriteFrame(
const EString & resourceName, LPCTSTR resourceName,
const EString & resourceType, LPCTSTR resourceType,
float x, float x,
float y, float y,
float width, float width,
@ -564,14 +574,14 @@ public:
// 从资源图片创建精灵 // 从资源图片创建精灵
ESprite( ESprite(
const EString & resourceName, LPCTSTR resourceName,
const EString & resourceType LPCTSTR resourceType
); );
// 从资源图片创建精灵并裁剪 // 从资源图片创建精灵并裁剪
ESprite( ESprite(
const EString & resourceName, LPCTSTR resourceName,
const EString & resourceType, LPCTSTR resourceType,
float x, float x,
float y, float y,
float width, float width,
@ -592,8 +602,8 @@ public:
// 从资源加载纹理 // 从资源加载纹理
void loadFrom( void loadFrom(
const EString & resourceName, LPCTSTR resourceName,
const EString & resourceType LPCTSTR resourceType
); );
// 加载纹理并裁剪 // 加载纹理并裁剪