更新了监听器的命名
This commit is contained in:
parent
56464a36e2
commit
1d5f3c7e55
|
|
@ -96,6 +96,9 @@
|
|||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>DeclareDPIAware.manifest</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
|
|
@ -128,6 +131,9 @@
|
|||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>DeclareDPIAware.manifest</AdditionalManifestFiles>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 95 KiB |
|
|
@ -4,43 +4,33 @@ int main()
|
|||
{
|
||||
EApp app;
|
||||
|
||||
if (app.init(L"Easy2D Demo", 640, 480, true))
|
||||
if (app.init(L"Easy2D Demo", 320, 320))
|
||||
{
|
||||
auto scene = new EScene();
|
||||
|
||||
auto node = new ENode();
|
||||
node->setPos(50, 80);
|
||||
node->_setSize(30, 180);
|
||||
scene->add(node);
|
||||
|
||||
/*auto listener = new EMouseListener([=] {
|
||||
if (!EMouseMsg::isLButtonDown())
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
auto sprite = new ESprite(L"elyse.png");
|
||||
sprite->setScale(0.3f);
|
||||
// 获取窗口宽度
|
||||
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 EListenerMouseClick([=](EPoint) {
|
||||
EPoint p = EMouseMsg::getPos();
|
||||
sprite->setPos(p);
|
||||
});
|
||||
|
||||
listener->bindWith(node);
|
||||
|
||||
EMsgManager::bindListener(listener, scene);
|
||||
|
||||
listener->bindWith(scene);
|
||||
EMsgManager::stopAllMouseListeners();
|
||||
EMsgManager::stopAllKeyboardListeners();
|
||||
scene->add(text, -1);
|
||||
app.enterScene(scene);
|
||||
|
||||
app.run();
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
|
|
@ -16,18 +16,16 @@ int WINAPI WinMain(
|
|||
float h = EApp::getHeight();
|
||||
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->setWordWrapping(true);
|
||||
//text->setWordWrappingWidth(130);
|
||||
text->setRotation(40);
|
||||
text->getFont()->setItalic(true);
|
||||
text->setAnchor(0.5f, 0.5f);
|
||||
text->setColor(EColor::WHITE);
|
||||
//text->runAction(new EActionLoop(new EActionTwo(new EActionFadeOut(1), new EActionFadeIn(1))));
|
||||
scene->add(text);
|
||||
|
||||
auto listener = new EKeyboardPressListener([=]() {
|
||||
auto listener = new EListenerKeyboardPress([=]() {
|
||||
if (EKeyboardMsg::getVal() == EKeyboardMsg::KEY::SPACE)
|
||||
{
|
||||
EApp::backScene(new ETransitionFade(0.5f, 0.5f));
|
||||
|
|
|
|||
|
|
@ -55,6 +55,12 @@ void e2d::EAction::setInterval(LONGLONG milliSeconds)
|
|||
|
||||
void e2d::EAction::setTarget(ENode * node)
|
||||
{
|
||||
if (m_pTarget)
|
||||
{
|
||||
// 动作只能有一个目标
|
||||
return;
|
||||
}
|
||||
|
||||
if (node)
|
||||
{
|
||||
m_pTarget = node;
|
||||
|
|
@ -79,6 +85,14 @@ void e2d::EAction::_init()
|
|||
m_tLast = GetNow();
|
||||
}
|
||||
|
||||
void e2d::EAction::_callOn()
|
||||
{
|
||||
if (!m_bInit)
|
||||
{
|
||||
_init();
|
||||
}
|
||||
}
|
||||
|
||||
void e2d::EAction::_reset()
|
||||
{
|
||||
m_bInit = false;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ e2d::EActionCallback * e2d::EActionCallback::clone() const
|
|||
|
||||
void e2d::EActionCallback::_init()
|
||||
{
|
||||
EAction::_init();
|
||||
// 执行回调函数的动作不需要初始化
|
||||
}
|
||||
|
||||
void e2d::EActionCallback::_callOn()
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ void e2d::EActionDelay::_init()
|
|||
|
||||
void e2d::EActionDelay::_callOn()
|
||||
{
|
||||
EAction::_callOn();
|
||||
// 判断时间间隔是否足够
|
||||
if (GetInterval(m_tLast) > m_nAnimationInterval)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,6 +21,12 @@ void e2d::EActionGradual::_init()
|
|||
bool e2d::EActionGradual::_isDelayEnough()
|
||||
{
|
||||
// 判断时间间隔是否足够
|
||||
if (m_fTotalDuration == 0)
|
||||
{
|
||||
m_fRateOfProgress = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (GetInterval(m_tLast) > m_nAnimationInterval)
|
||||
{
|
||||
// 重新记录时间
|
||||
|
|
|
|||
|
|
@ -1,42 +1,55 @@
|
|||
#include "..\eactions.h"
|
||||
|
||||
e2d::EActionLoop::EActionLoop(EAction * action) :
|
||||
m_Action(action)
|
||||
e2d::EActionLoop::EActionLoop(EAction * action, int times /* = -1 */)
|
||||
: m_pAction(action)
|
||||
, m_nTimes(0)
|
||||
, m_nTotalTimes(times)
|
||||
{
|
||||
m_Action->retain();
|
||||
m_pAction->retain();
|
||||
}
|
||||
|
||||
e2d::EActionLoop::~EActionLoop()
|
||||
{
|
||||
SafeRelease(&m_Action);
|
||||
SafeRelease(&m_pAction);
|
||||
}
|
||||
|
||||
e2d::EActionLoop * e2d::EActionLoop::clone() const
|
||||
{
|
||||
return new EActionLoop(m_Action->clone());
|
||||
return new EActionLoop(m_pAction->clone());
|
||||
}
|
||||
|
||||
void e2d::EActionLoop::_init()
|
||||
{
|
||||
EAction::_init();
|
||||
if (!m_Action->getTarget() && m_pTarget)
|
||||
{
|
||||
m_Action->setTarget(m_pTarget);
|
||||
}
|
||||
m_Action->_init();
|
||||
m_pAction->setTarget(m_pTarget);
|
||||
m_pAction->_init();
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
EAction::_reset();
|
||||
|
||||
m_pAction->_reset();
|
||||
m_nTimes = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,11 +18,14 @@ void e2d::EActionMoveBy::_init()
|
|||
|
||||
void e2d::EActionMoveBy::_callOn()
|
||||
{
|
||||
EAction::_callOn();
|
||||
|
||||
if (m_pTarget == nullptr)
|
||||
{
|
||||
this->stop();
|
||||
return;
|
||||
}
|
||||
|
||||
while (EActionGradual::_isDelayEnough())
|
||||
{
|
||||
// 移动节点
|
||||
|
|
|
|||
|
|
@ -18,11 +18,14 @@ void e2d::EActionOpacityBy::_init()
|
|||
|
||||
void e2d::EActionOpacityBy::_callOn()
|
||||
{
|
||||
EAction::_callOn();
|
||||
|
||||
if (m_pTarget == nullptr)
|
||||
{
|
||||
this->stop();
|
||||
return;
|
||||
}
|
||||
|
||||
while (EActionGradual::_isDelayEnough())
|
||||
{
|
||||
// 设置节点透明度
|
||||
|
|
|
|||
|
|
@ -12,17 +12,20 @@ void e2d::EActionRotateBy::_init()
|
|||
EActionGradual::_init();
|
||||
if (m_pTarget)
|
||||
{
|
||||
m_nBeginVal = m_pTarget->getOpacity();
|
||||
m_nBeginVal = m_pTarget->getRotation();
|
||||
}
|
||||
}
|
||||
|
||||
void e2d::EActionRotateBy::_callOn()
|
||||
{
|
||||
EAction::_callOn();
|
||||
|
||||
if (m_pTarget == nullptr)
|
||||
{
|
||||
this->stop();
|
||||
return;
|
||||
}
|
||||
|
||||
while (EActionGradual::_isDelayEnough())
|
||||
{
|
||||
// 旋转节点
|
||||
|
|
|
|||
|
|
@ -27,11 +27,14 @@ void e2d::EActionScaleBy::_init()
|
|||
|
||||
void e2d::EActionScaleBy::_callOn()
|
||||
{
|
||||
EAction::_callOn();
|
||||
|
||||
if (m_pTarget == nullptr)
|
||||
{
|
||||
this->stop();
|
||||
return;
|
||||
}
|
||||
|
||||
while (EActionGradual::_isDelayEnough())
|
||||
{
|
||||
// 缩放节点
|
||||
|
|
|
|||
|
|
@ -37,10 +37,7 @@ void e2d::EActionSequence::_init()
|
|||
{
|
||||
for (auto action : m_vActions)
|
||||
{
|
||||
if (!action->getTarget())
|
||||
{
|
||||
action->setTarget(m_pTarget);
|
||||
}
|
||||
action->setTarget(m_pTarget);
|
||||
}
|
||||
}
|
||||
// 初始化第一个动作
|
||||
|
|
@ -49,6 +46,8 @@ void e2d::EActionSequence::_init()
|
|||
|
||||
void e2d::EActionSequence::_callOn()
|
||||
{
|
||||
EAction::_callOn();
|
||||
|
||||
auto &action = m_vActions[m_nActionIndex];
|
||||
action->_callOn();
|
||||
|
||||
|
|
|
|||
|
|
@ -34,20 +34,16 @@ e2d::EActionTwo * e2d::EActionTwo::reverse(bool actionReverse) const
|
|||
void e2d::EActionTwo::_init()
|
||||
{
|
||||
EAction::_init();
|
||||
if (!m_pFirstAction->getTarget() && m_pTarget)
|
||||
{
|
||||
m_pFirstAction->setTarget(m_pTarget);
|
||||
}
|
||||
if (!m_pSecondAction->getTarget() && m_pTarget)
|
||||
{
|
||||
m_pSecondAction->setTarget(m_pTarget);
|
||||
}
|
||||
m_pFirstAction->setTarget(m_pTarget);
|
||||
m_pSecondAction->setTarget(m_pTarget);
|
||||
|
||||
m_pFirstAction->_init();
|
||||
}
|
||||
|
||||
void e2d::EActionTwo::_callOn()
|
||||
{
|
||||
EAction::_callOn();
|
||||
|
||||
if (!m_pFirstAction->_isEnding())
|
||||
{
|
||||
m_pFirstAction->_callOn();
|
||||
|
|
|
|||
|
|
@ -34,14 +34,8 @@ e2d::EActionTwoAtSameTime * e2d::EActionTwoAtSameTime::reverse(bool actionRevers
|
|||
void e2d::EActionTwoAtSameTime::_init()
|
||||
{
|
||||
EAction::_init();
|
||||
if (!m_pFirstAction->getTarget() && m_pTarget)
|
||||
{
|
||||
m_pFirstAction->setTarget(m_pTarget);
|
||||
}
|
||||
if (!m_pSecondAction->getTarget() && m_pTarget)
|
||||
{
|
||||
m_pSecondAction->setTarget(m_pTarget);
|
||||
}
|
||||
m_pFirstAction->setTarget(m_pTarget);
|
||||
m_pSecondAction->setTarget(m_pTarget);
|
||||
|
||||
m_pFirstAction->_init();
|
||||
m_pSecondAction->_init();
|
||||
|
|
@ -49,6 +43,8 @@ void e2d::EActionTwoAtSameTime::_init()
|
|||
|
||||
void e2d::EActionTwoAtSameTime::_callOn()
|
||||
{
|
||||
EAction::_callOn();
|
||||
|
||||
if (!m_pFirstAction->_isEnding())
|
||||
{
|
||||
m_pFirstAction->_callOn();
|
||||
|
|
|
|||
|
|
@ -30,11 +30,14 @@ void e2d::EAnimation::_init()
|
|||
|
||||
void e2d::EAnimation::_callOn()
|
||||
{
|
||||
EAction::_callOn();
|
||||
|
||||
if (m_pTarget == nullptr)
|
||||
{
|
||||
this->stop();
|
||||
return;
|
||||
}
|
||||
|
||||
// 判断时间间隔是否足够
|
||||
while (GetInterval(m_tLast) > m_nAnimationInterval)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ static std::stack<e2d::EScene*> s_SceneStack;
|
|||
// 游戏开始时间
|
||||
static steady_clock::time_point s_tStart;
|
||||
|
||||
|
||||
e2d::EApp::EApp()
|
||||
: m_bEnd(false)
|
||||
, m_bPaused(false)
|
||||
|
|
@ -26,7 +27,7 @@ e2d::EApp::EApp()
|
|||
, m_bTransitional(false)
|
||||
, m_bTopMost(false)
|
||||
, m_bShowConsole(false)
|
||||
, nAnimationInterval(17LL)
|
||||
, m_nAnimationInterval(17LL)
|
||||
, m_ClearColor(EColor::BLACK)
|
||||
, m_pCurrentScene(nullptr)
|
||||
, m_pNextScene(nullptr)
|
||||
|
|
@ -112,7 +113,7 @@ bool e2d::EApp::init(const EString &title, UINT32 width, UINT32 height, EWindowS
|
|||
// 取最小值
|
||||
width = min(width, screenWidth);
|
||||
height = min(height, screenHeight);
|
||||
|
||||
|
||||
// 创建窗口样式
|
||||
DWORD dwStyle = WS_OVERLAPPED | WS_SYSMENU;
|
||||
if (!wStyle.m_bNoMiniSize)
|
||||
|
|
@ -251,9 +252,10 @@ void e2d::EApp::run()
|
|||
{
|
||||
SetWindowPos(GetHWnd(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
// 记录开始时间
|
||||
s_tStart = steady_clock::now();
|
||||
|
||||
// 窗口消息
|
||||
MSG msg;
|
||||
|
||||
while (!m_bEnd)
|
||||
|
|
@ -275,7 +277,7 @@ void e2d::EApp::run()
|
|||
void e2d::EApp::setFPS(UINT32 fps)
|
||||
{
|
||||
fps = min(max(fps, 30), 120);
|
||||
s_pInstance->nAnimationInterval = 1000 / fps;
|
||||
s_pInstance->m_nAnimationInterval = 1000 / fps;
|
||||
}
|
||||
|
||||
bool e2d::EApp::onActivate()
|
||||
|
|
@ -295,10 +297,10 @@ bool e2d::EApp::onCloseWindow()
|
|||
|
||||
void e2d::EApp::_mainLoop()
|
||||
{
|
||||
// 时间间隔
|
||||
static LONGLONG nInterval = 0LL;
|
||||
// 挂起时长
|
||||
static LONGLONG nWaitMS = 0L;
|
||||
// 时间间隔
|
||||
static LONGLONG nInterval;
|
||||
// 上一帧画面绘制时间
|
||||
static steady_clock::time_point tLast = steady_clock::now();
|
||||
|
||||
|
|
@ -307,10 +309,10 @@ void e2d::EApp::_mainLoop()
|
|||
// 计算时间间隔
|
||||
nInterval = GetInterval(tLast);
|
||||
// 判断间隔时间是否足够
|
||||
if (nInterval >= nAnimationInterval)
|
||||
if (nInterval >= m_nAnimationInterval)
|
||||
{
|
||||
// 记录当前时间
|
||||
tLast += microseconds(nAnimationInterval);
|
||||
tLast += microseconds(m_nAnimationInterval);
|
||||
// 游戏控制流程
|
||||
_onControl();
|
||||
// 刷新游戏画面
|
||||
|
|
@ -319,7 +321,7 @@ void e2d::EApp::_mainLoop()
|
|||
else
|
||||
{
|
||||
// 计算挂起时长
|
||||
nWaitMS = nAnimationInterval - nInterval - 1;
|
||||
nWaitMS = m_nAnimationInterval - nInterval - 1;
|
||||
// 挂起线程,释放 CPU 占用
|
||||
if (nWaitMS > 1LL)
|
||||
{
|
||||
|
|
@ -436,6 +438,11 @@ float e2d::EApp::getHeight()
|
|||
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 */)
|
||||
{
|
||||
enterScene(scene, nullptr, saveCurrentScene);
|
||||
|
|
|
|||
|
|
@ -217,16 +217,16 @@
|
|||
<ClCompile Include="Geometry\EGeometry.cpp" />
|
||||
<ClCompile Include="Geometry\EPhysicsMsg.cpp" />
|
||||
<ClCompile Include="Geometry\ERectangle.cpp" />
|
||||
<ClCompile Include="Listener\EContactListener.cpp" />
|
||||
<ClCompile Include="Listener\EKeyboardListener.cpp" />
|
||||
<ClCompile Include="Listener\EKeyboardPressListener.cpp" />
|
||||
<ClCompile Include="Listener\EListenerPhysicsContact.cpp" />
|
||||
<ClCompile Include="Listener\EListenerKeyboard.cpp" />
|
||||
<ClCompile Include="Listener\EListenerKeyboardPress.cpp" />
|
||||
<ClCompile Include="Listener\EListener.cpp" />
|
||||
<ClCompile Include="Listener\EMouseClickListener.cpp" />
|
||||
<ClCompile Include="Listener\EMouseDoubleClickListener.cpp" />
|
||||
<ClCompile Include="Listener\EMouseDragListener.cpp" />
|
||||
<ClCompile Include="Listener\EMouseListener.cpp" />
|
||||
<ClCompile Include="Listener\EMousePressListener.cpp" />
|
||||
<ClCompile Include="Listener\EPhysicsListener.cpp" />
|
||||
<ClCompile Include="Listener\EListenerMouseClick.cpp" />
|
||||
<ClCompile Include="Listener\EListenerMouseDoubleClick.cpp" />
|
||||
<ClCompile Include="Listener\EListenerMouseDrag.cpp" />
|
||||
<ClCompile Include="Listener\EListenerMouse.cpp" />
|
||||
<ClCompile Include="Listener\EListenerMousePress.cpp" />
|
||||
<ClCompile Include="Listener\EListenerPhysics.cpp" />
|
||||
<ClCompile Include="Manager\EActionManager.cpp" />
|
||||
<ClCompile Include="Manager\EMsgManager.cpp" />
|
||||
<ClCompile Include="Manager\EObjectManager.cpp" />
|
||||
|
|
|
|||
|
|
@ -135,30 +135,9 @@
|
|||
<ClCompile Include="Manager\ETimerManager.cpp">
|
||||
<Filter>Manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Listener\EKeyboardListener.cpp">
|
||||
<Filter>Listener</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Listener\EKeyboardPressListener.cpp">
|
||||
<Filter>Listener</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Listener\EListener.cpp">
|
||||
<Filter>Listener</Filter>
|
||||
</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">
|
||||
<Filter>Node</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -201,13 +180,34 @@
|
|||
<ClCompile Include="Manager\EPhysicsManager.cpp">
|
||||
<Filter>Manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Listener\EPhysicsListener.cpp">
|
||||
<Filter>Listener</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Geometry\EPhysicsMsg.cpp">
|
||||
<Filter>Geometry</Filter>
|
||||
</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>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +1,39 @@
|
|||
#include "..\elisteners.h"
|
||||
#include "..\emanagers.h"
|
||||
|
||||
e2d::EKeyboardListener::EKeyboardListener()
|
||||
e2d::EListenerKeyboard::EListenerKeyboard()
|
||||
: EListener()
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EKeyboardListener::EKeyboardListener(const EString & name)
|
||||
e2d::EListenerKeyboard::EListenerKeyboard(const EString & name)
|
||||
: EListener(name)
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EKeyboardListener::EKeyboardListener(const KEY_LISTENER_CALLBACK & callback)
|
||||
e2d::EListenerKeyboard::EListenerKeyboard(const KEY_LISTENER_CALLBACK & callback)
|
||||
: EListener()
|
||||
{
|
||||
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)
|
||||
{
|
||||
m_Callback = callback;
|
||||
}
|
||||
|
||||
void e2d::EKeyboardListener::_callOn()
|
||||
void e2d::EListenerKeyboard::_callOn()
|
||||
{
|
||||
m_Callback();
|
||||
}
|
||||
|
||||
void e2d::EKeyboardListener::setCallback(const KEY_LISTENER_CALLBACK & callback)
|
||||
void e2d::EListenerKeyboard::setCallback(const KEY_LISTENER_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.");
|
||||
|
||||
|
|
@ -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.");
|
||||
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +1,39 @@
|
|||
#include "..\elisteners.h"
|
||||
#include "..\emanagers.h"
|
||||
|
||||
e2d::EMouseListener::EMouseListener()
|
||||
e2d::EListenerMouse::EListenerMouse()
|
||||
: EListener()
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EMouseListener::EMouseListener(const EString & name)
|
||||
e2d::EListenerMouse::EListenerMouse(const EString & name)
|
||||
: EListener(name)
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EMouseListener::EMouseListener(const MOUSE_LISTENER_CALLBACK & callback)
|
||||
e2d::EListenerMouse::EListenerMouse(const MOUSE_LISTENER_CALLBACK & callback)
|
||||
: EListener()
|
||||
{
|
||||
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)
|
||||
{
|
||||
m_Callback = callback;
|
||||
}
|
||||
|
||||
void e2d::EMouseListener::_callOn()
|
||||
void e2d::EListenerMouse::_callOn()
|
||||
{
|
||||
m_Callback();
|
||||
}
|
||||
|
||||
void e2d::EMouseListener::setCallback(const MOUSE_LISTENER_CALLBACK & callback)
|
||||
void e2d::EListenerMouse::setCallback(const MOUSE_LISTENER_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.");
|
||||
|
||||
|
|
@ -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.");
|
||||
|
||||
|
|
@ -1,32 +1,32 @@
|
|||
#include "..\elisteners.h"
|
||||
|
||||
e2d::EMouseClickListener::EMouseClickListener()
|
||||
: EMouseListener()
|
||||
e2d::EListenerMouseClick::EListenerMouseClick()
|
||||
: EListenerMouse()
|
||||
, m_bPressed(false)
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EMouseClickListener::EMouseClickListener(const EString & name)
|
||||
: EMouseListener(name)
|
||||
e2d::EListenerMouseClick::EListenerMouseClick(const EString & name)
|
||||
: EListenerMouse(name)
|
||||
, m_bPressed(false)
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EMouseClickListener::EMouseClickListener(const MOUSE_CLICK_LISTENER_CALLBACK & callback)
|
||||
: EMouseListener()
|
||||
e2d::EListenerMouseClick::EListenerMouseClick(const MOUSE_CLICK_LISTENER_CALLBACK & callback)
|
||||
: EListenerMouse()
|
||||
, m_Callback(callback)
|
||||
, m_bPressed(false)
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EMouseClickListener::EMouseClickListener(const EString & name, const MOUSE_CLICK_LISTENER_CALLBACK & callback)
|
||||
: EMouseListener(name)
|
||||
e2d::EListenerMouseClick::EListenerMouseClick(const EString & name, const MOUSE_CLICK_LISTENER_CALLBACK & callback)
|
||||
: EListenerMouse(name)
|
||||
, m_Callback(callback)
|
||||
, m_bPressed(false)
|
||||
{
|
||||
}
|
||||
|
||||
void e2d::EMouseClickListener::_callOn()
|
||||
void e2d::EListenerMouseClick::_callOn()
|
||||
{
|
||||
if (EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DOWN ||
|
||||
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;
|
||||
}
|
||||
|
|
@ -1,32 +1,32 @@
|
|||
#include "..\elisteners.h"
|
||||
|
||||
e2d::EMouseDoubleClickListener::EMouseDoubleClickListener()
|
||||
: EMouseListener()
|
||||
e2d::EListenerMouseDoubleClick::EListenerMouseDoubleClick()
|
||||
: EListenerMouse()
|
||||
, m_bPressed(false)
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EMouseDoubleClickListener::EMouseDoubleClickListener(const EString & name)
|
||||
: EMouseListener(name)
|
||||
e2d::EListenerMouseDoubleClick::EListenerMouseDoubleClick(const EString & name)
|
||||
: EListenerMouse(name)
|
||||
, m_bPressed(false)
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EMouseDoubleClickListener::EMouseDoubleClickListener(const MOUSE_DBLCLK_LISTENER_CALLBACK & callback)
|
||||
: EMouseListener()
|
||||
e2d::EListenerMouseDoubleClick::EListenerMouseDoubleClick(const MOUSE_DBLCLK_LISTENER_CALLBACK & callback)
|
||||
: EListenerMouse()
|
||||
, m_Callback(callback)
|
||||
, m_bPressed(false)
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EMouseDoubleClickListener::EMouseDoubleClickListener(const EString & name, const MOUSE_DBLCLK_LISTENER_CALLBACK & callback)
|
||||
: EMouseListener(name)
|
||||
e2d::EListenerMouseDoubleClick::EListenerMouseDoubleClick(const EString & name, const MOUSE_DBLCLK_LISTENER_CALLBACK & callback)
|
||||
: EListenerMouse(name)
|
||||
, m_Callback(callback)
|
||||
, m_bPressed(false)
|
||||
{
|
||||
}
|
||||
|
||||
void e2d::EMouseDoubleClickListener::_callOn()
|
||||
void e2d::EListenerMouseDoubleClick::_callOn()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
@ -1,28 +1,28 @@
|
|||
#include "..\elisteners.h"
|
||||
|
||||
e2d::EMouseDragListener::EMouseDragListener()
|
||||
: EMouseListener()
|
||||
e2d::EListenerMouseDrag::EListenerMouseDrag()
|
||||
: EListenerMouse()
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EMouseDragListener::EMouseDragListener(const EString & name)
|
||||
: EMouseListener(name)
|
||||
e2d::EListenerMouseDrag::EListenerMouseDrag(const EString & name)
|
||||
: EListenerMouse(name)
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EMouseDragListener::EMouseDragListener(const MOUSE_DRAG_LISTENER_CALLBACK & callback)
|
||||
: EMouseListener()
|
||||
e2d::EListenerMouseDrag::EListenerMouseDrag(const MOUSE_DRAG_LISTENER_CALLBACK & callback)
|
||||
: EListenerMouse()
|
||||
, m_Callback(callback)
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EMouseDragListener::EMouseDragListener(const EString & name, const MOUSE_DRAG_LISTENER_CALLBACK & callback)
|
||||
: EMouseListener(name)
|
||||
e2d::EListenerMouseDrag::EListenerMouseDrag(const EString & name, const MOUSE_DRAG_LISTENER_CALLBACK & callback)
|
||||
: EListenerMouse(name)
|
||||
, m_Callback(callback)
|
||||
{
|
||||
}
|
||||
|
||||
void e2d::EMouseDragListener::_callOn()
|
||||
void e2d::EListenerMouseDrag::_callOn()
|
||||
{
|
||||
if (EMouseMsg::getMsg() == EMouseMsg::LBUTTON_DOWN ||
|
||||
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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -2,29 +2,29 @@
|
|||
#include "..\egeometry.h"
|
||||
#include "..\emanagers.h"
|
||||
|
||||
e2d::EPhysicsListener::EPhysicsListener()
|
||||
e2d::EListenerPhysics::EListenerPhysics()
|
||||
: EListener()
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EPhysicsListener::EPhysicsListener(const EString & name)
|
||||
e2d::EListenerPhysics::EListenerPhysics(const EString & name)
|
||||
: EListener(name)
|
||||
{
|
||||
}
|
||||
|
||||
e2d::EPhysicsListener::EPhysicsListener(const PHYSICS_LISTENER_CALLBACK & callback)
|
||||
e2d::EListenerPhysics::EListenerPhysics(const PHYSICS_LISTENER_CALLBACK & callback)
|
||||
: EListener()
|
||||
{
|
||||
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)
|
||||
{
|
||||
m_Callback = callback;
|
||||
}
|
||||
|
||||
void e2d::EPhysicsListener::_callOn()
|
||||
void e2d::EListenerPhysics::_callOn()
|
||||
{
|
||||
m_Callback(
|
||||
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;
|
||||
}
|
||||
|
||||
void e2d::EPhysicsListener::bindWith(EScene * pParentScene)
|
||||
void e2d::EListenerPhysics::bindWith(EScene * pParentScene)
|
||||
{
|
||||
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.");
|
||||
|
||||
|
|
@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -149,11 +149,6 @@ void e2d::EActionManager::ActionProc()
|
|||
}
|
||||
else
|
||||
{
|
||||
// 初始化动作
|
||||
if (!action->m_bInit)
|
||||
{
|
||||
action->_init();
|
||||
}
|
||||
// 执行动作
|
||||
action->_callOn();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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(pParentNode == nullptr, "Bind EMouseListener with a NULL ENode pointer!");
|
||||
WARN_IF(listener == nullptr, "EListenerMouse NULL pointer exception!");
|
||||
WARN_IF(pParentNode == nullptr, "Bind EListenerMouse with a NULL ENode pointer!");
|
||||
|
||||
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(pParentNode == nullptr, "Bind EKeyboardListener with a NULL ENode pointer!");
|
||||
WARN_IF(listener == nullptr, "EListenerKeyboard NULL pointer exception!");
|
||||
WARN_IF(pParentNode == nullptr, "Bind EListenerKeyboard with a NULL ENode pointer!");
|
||||
|
||||
if (listener && pParentNode)
|
||||
{
|
||||
|
|
@ -135,7 +135,7 @@ void e2d::EMsgManager::stopMouseListeners(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();)
|
||||
{
|
||||
if ((*mIter)->getName() == name)
|
||||
|
|
@ -177,7 +177,7 @@ void e2d::EMsgManager::stopKeyboardListeners(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();)
|
||||
{
|
||||
if ((*kIter)->getName() == name)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include "..\egeometry.h"
|
||||
|
||||
// 监听器集合
|
||||
e2d::EVector<e2d::EPhysicsListener*> s_vListeners;
|
||||
e2d::EVector<e2d::EListenerPhysics*> s_vListeners;
|
||||
// 形状集合
|
||||
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());
|
||||
}
|
||||
|
||||
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(pParentNode == nullptr, "EPhysicsListener add to a NULL ENode pointer!");
|
||||
WARN_IF(listener == nullptr, "EListenerPhysics NULL pointer exception!");
|
||||
WARN_IF(pParentNode == nullptr, "EListenerPhysics add to a NULL ENode pointer!");
|
||||
|
||||
if (listener && pParentNode)
|
||||
{
|
||||
|
|
@ -135,7 +135,7 @@ void e2d::EPhysicsManager::stopListeners(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();)
|
||||
{
|
||||
if ((*iter)->getName() == name)
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ void e2d::EButton::setDisable(bool disable)
|
|||
|
||||
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);
|
||||
m_Callback = callback;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -379,14 +379,24 @@ void e2d::ENode::setPos(float x, float y)
|
|||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -33,13 +33,13 @@ e2d::ESprite::ESprite(const EString & imageFileName, float x, float y, float wid
|
|||
clip(x, y, width, height);
|
||||
}
|
||||
|
||||
e2d::ESprite::ESprite(const EString & resourceName, const EString & resourceType)
|
||||
e2d::ESprite::ESprite(LPCTSTR resourceName, LPCTSTR resourceType)
|
||||
: ESprite()
|
||||
{
|
||||
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);
|
||||
clip(x, y, width, height);
|
||||
|
|
@ -69,7 +69,7 @@ void e2d::ESprite::loadFrom(const EString & 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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ e2d::ESpriteFrame::ESpriteFrame(const EString & imageFileName)
|
|||
_setTexture(new ETexture(imageFileName));
|
||||
}
|
||||
|
||||
e2d::ESpriteFrame::ESpriteFrame(const EString & resourceName, const EString & resourceType)
|
||||
e2d::ESpriteFrame::ESpriteFrame(LPCTSTR resourceName, LPCTSTR resourceType)
|
||||
: ESpriteFrame()
|
||||
{
|
||||
_setTexture(new ETexture(resourceName, resourceType));
|
||||
|
|
@ -41,7 +41,7 @@ e2d::ESpriteFrame::ESpriteFrame(const EString & imageFileName, float x, float y,
|
|||
_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()
|
||||
{
|
||||
_setTexture(new ETexture(resourceName, resourceType));
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ e2d::ETexture::ETexture(const EString & fileName)
|
|||
this->loadFromFile(fileName);
|
||||
}
|
||||
|
||||
e2d::ETexture::ETexture(const EString & resourceName, const EString & resourceType)
|
||||
e2d::ETexture::ETexture(LPCTSTR resourceName, LPCTSTR resourceType)
|
||||
{
|
||||
this->loadFromResource(resourceName, resourceType);
|
||||
}
|
||||
|
|
@ -63,11 +63,11 @@ void e2d::ETexture::loadFromFile(const EString & fileName)
|
|||
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;
|
||||
|
||||
if (!e2d::ETexture::preload(resourceName, resourceType))
|
||||
|
|
@ -77,7 +77,7 @@ void e2d::ETexture::loadFromResource(const EString & resourceName, const EString
|
|||
}
|
||||
|
||||
ResKey key;
|
||||
std::hash<e2d::EString> h;
|
||||
std::hash<LPCTSTR> h;
|
||||
key.resNameHash = h(resourceName);
|
||||
key.resTypeHash = h(resourceType);
|
||||
|
||||
|
|
@ -202,9 +202,9 @@ bool e2d::ETexture::preload(const EString & fileName)
|
|||
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;
|
||||
key.resNameHash = h(resourceName);
|
||||
|
|
@ -230,7 +230,7 @@ bool e2d::ETexture::preload(const EString & resourceName, const EString & resour
|
|||
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;
|
||||
if (SUCCEEDED(hr))
|
||||
|
|
@ -321,7 +321,7 @@ bool e2d::ETexture::preload(const EString & resourceName, const EString & resour
|
|||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
std::hash<e2d::EString> h;
|
||||
std::hash<LPCTSTR> h;
|
||||
|
||||
ResKey key;
|
||||
key.resNameHash = h(resourceName);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ bool e2d::ETimer::isRunning() const
|
|||
void e2d::ETimer::start()
|
||||
{
|
||||
m_bRunning = true;
|
||||
m_tLast = GetNow();
|
||||
m_tLast = steady_clock::now();
|
||||
}
|
||||
|
||||
void e2d::ETimer::stop()
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ protected:
|
|||
virtual void _init();
|
||||
|
||||
// 执行动作
|
||||
virtual void _callOn() = 0;
|
||||
virtual void _callOn();
|
||||
|
||||
// 获取动作结束状态
|
||||
virtual bool _isEnding();
|
||||
|
|
@ -527,7 +527,8 @@ class EActionLoop :
|
|||
public:
|
||||
// 创建循环动作
|
||||
EActionLoop(
|
||||
EAction * action /* 执行循环的动作 */
|
||||
EAction * action, /* 执行循环的动作 */
|
||||
int times = -1 /* 循环次数 */
|
||||
);
|
||||
|
||||
virtual ~EActionLoop();
|
||||
|
|
@ -546,7 +547,9 @@ protected:
|
|||
virtual void _reset() override;
|
||||
|
||||
protected:
|
||||
EAction * m_Action;
|
||||
EAction * m_pAction;
|
||||
int m_nTimes;
|
||||
int m_nTotalTimes;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ namespace e2d
|
|||
class EScene;
|
||||
class ENode;
|
||||
class EObjectManager;
|
||||
class EMouseListener;
|
||||
class EKeyboardListener;
|
||||
class EListenerMouse;
|
||||
class EListenerKeyboard;
|
||||
class EAction;
|
||||
class ETransition;
|
||||
|
||||
|
|
@ -109,6 +109,9 @@ public:
|
|||
// 获取窗口高度
|
||||
static float getHeight();
|
||||
|
||||
// 获取窗口大小
|
||||
static ESize getSize();
|
||||
|
||||
// 获取当前场景
|
||||
static EScene * getCurrentScene();
|
||||
|
||||
|
|
@ -183,7 +186,7 @@ protected:
|
|||
EString m_sTitle;
|
||||
EString m_sAppName;
|
||||
UINT32 m_ClearColor;
|
||||
LONGLONG nAnimationInterval;
|
||||
LONGLONG m_nAnimationInterval;
|
||||
EScene * m_pCurrentScene;
|
||||
EScene * m_pNextScene;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -65,23 +65,23 @@ protected:
|
|||
|
||||
|
||||
// 鼠标消息监听器
|
||||
class EMouseListener :
|
||||
class EListenerMouse :
|
||||
public EListener
|
||||
{
|
||||
friend EMsgManager;
|
||||
|
||||
public:
|
||||
EMouseListener();
|
||||
EListenerMouse();
|
||||
|
||||
EMouseListener(
|
||||
EListenerMouse(
|
||||
const EString &name
|
||||
);
|
||||
|
||||
EMouseListener(
|
||||
EListenerMouse(
|
||||
const MOUSE_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
||||
EMouseListener(
|
||||
EListenerMouse(
|
||||
const EString &name,
|
||||
const MOUSE_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
|
@ -111,21 +111,21 @@ protected:
|
|||
|
||||
|
||||
// 鼠标按下消息监听器
|
||||
class EMousePressListener :
|
||||
public EMouseListener
|
||||
class EListenerMousePress :
|
||||
public EListenerMouse
|
||||
{
|
||||
public:
|
||||
EMousePressListener();
|
||||
EListenerMousePress();
|
||||
|
||||
EMousePressListener(
|
||||
EListenerMousePress(
|
||||
const EString &name
|
||||
);
|
||||
|
||||
EMousePressListener(
|
||||
EListenerMousePress(
|
||||
const MOUSE_PRESS_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
||||
EMousePressListener(
|
||||
EListenerMousePress(
|
||||
const EString &name,
|
||||
const MOUSE_PRESS_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
|
@ -145,21 +145,21 @@ protected:
|
|||
|
||||
|
||||
// 鼠标点击消息监听器
|
||||
class EMouseClickListener :
|
||||
public EMouseListener
|
||||
class EListenerMouseClick :
|
||||
public EListenerMouse
|
||||
{
|
||||
public:
|
||||
EMouseClickListener();
|
||||
EListenerMouseClick();
|
||||
|
||||
EMouseClickListener(
|
||||
EListenerMouseClick(
|
||||
const EString &name
|
||||
);
|
||||
|
||||
EMouseClickListener(
|
||||
EListenerMouseClick(
|
||||
const MOUSE_CLICK_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
||||
EMouseClickListener(
|
||||
EListenerMouseClick(
|
||||
const EString &name,
|
||||
const MOUSE_CLICK_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
|
@ -180,21 +180,21 @@ protected:
|
|||
|
||||
|
||||
// 鼠标点击消息监听器
|
||||
class EMouseDoubleClickListener :
|
||||
public EMouseListener
|
||||
class EListenerMouseDoubleClick :
|
||||
public EListenerMouse
|
||||
{
|
||||
public:
|
||||
EMouseDoubleClickListener();
|
||||
EListenerMouseDoubleClick();
|
||||
|
||||
EMouseDoubleClickListener(
|
||||
EListenerMouseDoubleClick(
|
||||
const EString &name
|
||||
);
|
||||
|
||||
EMouseDoubleClickListener(
|
||||
EListenerMouseDoubleClick(
|
||||
const MOUSE_DBLCLK_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
||||
EMouseDoubleClickListener(
|
||||
EListenerMouseDoubleClick(
|
||||
const EString &name,
|
||||
const MOUSE_DBLCLK_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
|
@ -215,21 +215,21 @@ protected:
|
|||
|
||||
|
||||
// 鼠标拖动消息监听器
|
||||
class EMouseDragListener :
|
||||
public EMouseListener
|
||||
class EListenerMouseDrag :
|
||||
public EListenerMouse
|
||||
{
|
||||
public:
|
||||
EMouseDragListener();
|
||||
EListenerMouseDrag();
|
||||
|
||||
EMouseDragListener(
|
||||
EListenerMouseDrag(
|
||||
const EString &name
|
||||
);
|
||||
|
||||
EMouseDragListener(
|
||||
EListenerMouseDrag(
|
||||
const MOUSE_DRAG_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
||||
EMouseDragListener(
|
||||
EListenerMouseDrag(
|
||||
const EString &name,
|
||||
const MOUSE_DRAG_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
|
@ -250,23 +250,23 @@ protected:
|
|||
|
||||
|
||||
// 按键消息监听器
|
||||
class EKeyboardListener :
|
||||
class EListenerKeyboard :
|
||||
public EListener
|
||||
{
|
||||
friend EMsgManager;
|
||||
|
||||
public:
|
||||
EKeyboardListener();
|
||||
EListenerKeyboard();
|
||||
|
||||
EKeyboardListener(
|
||||
EListenerKeyboard(
|
||||
const EString &name
|
||||
);
|
||||
|
||||
EKeyboardListener(
|
||||
EListenerKeyboard(
|
||||
const KEY_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
||||
EKeyboardListener(
|
||||
EListenerKeyboard(
|
||||
const EString &name,
|
||||
const KEY_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
|
@ -296,23 +296,23 @@ protected:
|
|||
|
||||
|
||||
// 按键按下消息监听
|
||||
class EKeyboardPressListener :
|
||||
public EKeyboardListener
|
||||
class EListenerKeyboardPress :
|
||||
public EListenerKeyboard
|
||||
{
|
||||
friend EMsgManager;
|
||||
|
||||
public:
|
||||
EKeyboardPressListener();
|
||||
EListenerKeyboardPress();
|
||||
|
||||
EKeyboardPressListener(
|
||||
EListenerKeyboardPress(
|
||||
const EString &name
|
||||
);
|
||||
|
||||
EKeyboardPressListener(
|
||||
EListenerKeyboardPress(
|
||||
const KEY_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
||||
EKeyboardPressListener(
|
||||
EListenerKeyboardPress(
|
||||
const EString &name,
|
||||
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;
|
||||
|
||||
// 物理世界消息监听器
|
||||
class EPhysicsListener :
|
||||
class EListenerPhysics :
|
||||
public EListener
|
||||
{
|
||||
friend EPhysicsManager;
|
||||
|
||||
public:
|
||||
EPhysicsListener();
|
||||
EListenerPhysics();
|
||||
|
||||
EPhysicsListener(
|
||||
EListenerPhysics(
|
||||
const EString &name
|
||||
);
|
||||
|
||||
EPhysicsListener(
|
||||
EListenerPhysics(
|
||||
const PHYSICS_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
||||
EPhysicsListener(
|
||||
EListenerPhysics(
|
||||
const EString &name,
|
||||
const PHYSICS_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
|
@ -375,23 +375,23 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
class EContactListener :
|
||||
public EPhysicsListener
|
||||
class EListenerPhysicsContact :
|
||||
public EListenerPhysics
|
||||
{
|
||||
friend EMsgManager;
|
||||
|
||||
public:
|
||||
EContactListener();
|
||||
EListenerPhysicsContact();
|
||||
|
||||
EContactListener(
|
||||
EListenerPhysicsContact(
|
||||
const EString &name
|
||||
);
|
||||
|
||||
EContactListener(
|
||||
EListenerPhysicsContact(
|
||||
const COLLISION_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
||||
EContactListener(
|
||||
EListenerPhysicsContact(
|
||||
const EString &name,
|
||||
const COLLISION_LISTENER_CALLBACK &callback
|
||||
);
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ class EScene;
|
|||
class ENode;
|
||||
class ETimer;
|
||||
class EAction;
|
||||
class EMouseListener;
|
||||
class EKeyboardListener;
|
||||
class EListenerMouse;
|
||||
class EListenerKeyboard;
|
||||
class EGeometry;
|
||||
class EPhysicsListener;
|
||||
class EListenerPhysics;
|
||||
|
||||
// 对象管理器
|
||||
class EObjectManager
|
||||
|
|
@ -46,14 +46,14 @@ class EMsgManager
|
|||
public:
|
||||
// 绑定鼠标消息监听器到场景
|
||||
static void bindListener(
|
||||
EMouseListener * listener,
|
||||
EListenerMouse * listener,
|
||||
EScene * pParentScene,
|
||||
bool always = false /* 是否在游戏暂停时仍然监听 */
|
||||
);
|
||||
|
||||
// 绑定鼠标消息监听器到节点
|
||||
static void bindListener(
|
||||
EMouseListener * listener,
|
||||
EListenerMouse * listener,
|
||||
ENode * pParentNode,
|
||||
bool always = false /* 是否在游戏暂停时仍然监听 */
|
||||
);
|
||||
|
|
@ -101,14 +101,14 @@ public:
|
|||
|
||||
// 绑定按键消息监听器到场景
|
||||
static void bindListener(
|
||||
EKeyboardListener * listener,
|
||||
EListenerKeyboard * listener,
|
||||
EScene * pParentScene,
|
||||
bool always = false /* 是否在游戏暂停时仍然监听 */
|
||||
);
|
||||
|
||||
// 绑定按键消息监听器到节点
|
||||
static void bindListener(
|
||||
EKeyboardListener * listener,
|
||||
EListenerKeyboard * listener,
|
||||
ENode * pParentNode,
|
||||
bool always = false /* 是否在游戏暂停时仍然监听 */
|
||||
);
|
||||
|
|
@ -326,13 +326,13 @@ class EPhysicsManager
|
|||
public:
|
||||
// 将监听器与场景绑定
|
||||
static void bindListener(
|
||||
EPhysicsListener * listener,
|
||||
EListenerPhysics * listener,
|
||||
EScene * pParentScene
|
||||
);
|
||||
|
||||
// 将监听器与节点绑定
|
||||
static void bindListener(
|
||||
EPhysicsListener * listener,
|
||||
EListenerPhysics * listener,
|
||||
ENode * pParentNode
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -141,13 +141,23 @@ public:
|
|||
);
|
||||
|
||||
// 移动节点
|
||||
virtual void move(
|
||||
virtual void movePosX(
|
||||
float x
|
||||
);
|
||||
|
||||
// ÒÆ¶¯½Úµã
|
||||
virtual void movePosY(
|
||||
float y
|
||||
);
|
||||
|
||||
// ÒÆ¶¯½Úµã
|
||||
virtual void movePos(
|
||||
float x,
|
||||
float y
|
||||
);
|
||||
|
||||
// 移动节点
|
||||
virtual void move(
|
||||
virtual void movePos(
|
||||
const EVec & v
|
||||
);
|
||||
|
||||
|
|
@ -396,8 +406,8 @@ public:
|
|||
|
||||
// 读取程序资源
|
||||
ETexture(
|
||||
const EString & resourceName,
|
||||
const EString & resourceType
|
||||
LPCTSTR resourceName,
|
||||
LPCTSTR resourceType
|
||||
);
|
||||
|
||||
virtual ~ETexture();
|
||||
|
|
@ -409,8 +419,8 @@ public:
|
|||
|
||||
// 读取程序资源
|
||||
void loadFromResource(
|
||||
const EString & resourceName,
|
||||
const EString & resourceType
|
||||
LPCTSTR resourceName,
|
||||
LPCTSTR resourceType
|
||||
);
|
||||
|
||||
// 获取源图片宽度
|
||||
|
|
@ -429,8 +439,8 @@ public:
|
|||
|
||||
// 预加载资源
|
||||
static bool preload(
|
||||
const EString & resourceName,
|
||||
const EString & resourceType
|
||||
LPCTSTR resourceName,
|
||||
LPCTSTR resourceType
|
||||
);
|
||||
|
||||
// 清空缓存
|
||||
|
|
@ -465,8 +475,8 @@ public:
|
|||
|
||||
// 创建空的精灵帧
|
||||
ESpriteFrame(
|
||||
const EString & resourceName,
|
||||
const EString & resourceType
|
||||
LPCTSTR resourceName,
|
||||
LPCTSTR resourceType
|
||||
);
|
||||
|
||||
// 创建空的精灵帧
|
||||
|
|
@ -489,8 +499,8 @@ public:
|
|||
|
||||
// 创建空的精灵帧
|
||||
ESpriteFrame(
|
||||
const EString & resourceName,
|
||||
const EString & resourceType,
|
||||
LPCTSTR resourceName,
|
||||
LPCTSTR resourceType,
|
||||
float x,
|
||||
float y,
|
||||
float width,
|
||||
|
|
@ -564,14 +574,14 @@ public:
|
|||
|
||||
// 从资源图片创建精灵
|
||||
ESprite(
|
||||
const EString & resourceName,
|
||||
const EString & resourceType
|
||||
LPCTSTR resourceName,
|
||||
LPCTSTR resourceType
|
||||
);
|
||||
|
||||
// 从资源图片创建精灵并裁剪
|
||||
ESprite(
|
||||
const EString & resourceName,
|
||||
const EString & resourceType,
|
||||
LPCTSTR resourceName,
|
||||
LPCTSTR resourceType,
|
||||
float x,
|
||||
float y,
|
||||
float width,
|
||||
|
|
@ -592,8 +602,8 @@ public:
|
|||
|
||||
// 从资源加载纹理
|
||||
void loadFrom(
|
||||
const EString & resourceName,
|
||||
const EString & resourceType
|
||||
LPCTSTR resourceName,
|
||||
LPCTSTR resourceType
|
||||
);
|
||||
|
||||
// 加载纹理并裁剪
|
||||
|
|
|
|||
Loading…
Reference in New Issue