vs2010 supported
This commit is contained in:
parent
32126a723a
commit
1fb8d761e6
|
|
@ -29,7 +29,7 @@ e2d::ActionSequence::ActionSequence(int number, Action * action1, ...) :
|
|||
|
||||
e2d::ActionSequence::~ActionSequence()
|
||||
{
|
||||
for (auto action : m_vActions)
|
||||
FOR_LOOP(action, m_vActions)
|
||||
{
|
||||
SafeRelease(&action);
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ void e2d::ActionSequence::_init()
|
|||
// ½«ËùÓж¯×÷ÓëÄ¿±ê°ó¶¨
|
||||
if (m_pTarget)
|
||||
{
|
||||
for (auto action : m_vActions)
|
||||
FOR_LOOP(action, m_vActions)
|
||||
{
|
||||
action->m_pTarget = m_pTarget;
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ void e2d::ActionSequence::_update()
|
|||
void e2d::ActionSequence::reset()
|
||||
{
|
||||
Action::reset();
|
||||
for (auto action : m_vActions)
|
||||
FOR_LOOP(action, m_vActions)
|
||||
{
|
||||
action->reset();
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ void e2d::ActionSequence::reset()
|
|||
|
||||
void e2d::ActionSequence::_resetTime()
|
||||
{
|
||||
for (auto action : m_vActions)
|
||||
FOR_LOOP(action, m_vActions)
|
||||
{
|
||||
action->_resetTime();
|
||||
}
|
||||
|
|
@ -124,7 +124,7 @@ void e2d::ActionSequence::add(int number, Action * action, ...)
|
|||
e2d::ActionSequence * e2d::ActionSequence::clone() const
|
||||
{
|
||||
auto a = new ActionSequence();
|
||||
for (auto action : m_vActions)
|
||||
FOR_LOOP(action, m_vActions)
|
||||
{
|
||||
a->add(action->clone());
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ e2d::ActionSequence * e2d::ActionSequence::clone() const
|
|||
e2d::ActionSequence * e2d::ActionSequence::reverse(bool actionReverse) const
|
||||
{
|
||||
auto a = new ActionSequence();
|
||||
for (auto action : m_vActions)
|
||||
FOR_LOOP(action, m_vActions)
|
||||
{
|
||||
if (actionReverse)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ e2d::Animation::Animation(double interval, int number, Image * frame, ...)
|
|||
|
||||
e2d::Animation::~Animation()
|
||||
{
|
||||
for (auto frame : m_vFrames)
|
||||
FOR_LOOP(frame, m_vFrames)
|
||||
{
|
||||
SafeRelease(&frame);
|
||||
}
|
||||
|
|
@ -148,7 +148,7 @@ void e2d::Animation::add(int number, Image * frame, ...)
|
|||
e2d::Animation * e2d::Animation::clone() const
|
||||
{
|
||||
auto a = new Animation(m_fInterval);
|
||||
for (auto frame : m_vFrames)
|
||||
FOR_LOOP(frame, m_vFrames)
|
||||
{
|
||||
a->add(frame);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include "..\emanagers.h"
|
||||
|
||||
#pragma comment(lib, "dinput8.lib")
|
||||
#pragma comment(lib, "dxguid.lib")
|
||||
|
||||
using namespace e2d;
|
||||
|
||||
|
|
@ -142,14 +141,14 @@ void Input::__updateDeviceState()
|
|||
ScreenToClient(Window::getHWnd(), &s_MousePosition);
|
||||
}
|
||||
|
||||
bool Input::isKeyDown(KeyCode nKeyCode)
|
||||
bool Input::isKeyDown(int nKeyCode)
|
||||
{
|
||||
if (s_KeyBuffer[static_cast<int>(nKeyCode)] & 0x80)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Input::isKeyPress(KeyCode nKeyCode)
|
||||
bool Input::isKeyPress(int nKeyCode)
|
||||
{
|
||||
if ((s_KeyBuffer[static_cast<int>(nKeyCode)] & 0x80) &&
|
||||
!(s_KeyRecordBuffer[static_cast<int>(nKeyCode)] & 0x80))
|
||||
|
|
@ -157,7 +156,7 @@ bool Input::isKeyPress(KeyCode nKeyCode)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Input::isKeyRelease(KeyCode nKeyCode)
|
||||
bool Input::isKeyRelease(int nKeyCode)
|
||||
{
|
||||
if (!(s_KeyBuffer[static_cast<int>(nKeyCode)] & 0x80) &&
|
||||
(s_KeyRecordBuffer[static_cast<int>(nKeyCode)] & 0x80))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,24 @@
|
|||
#include "..\ebase.h"
|
||||
|
||||
// 上一帧与当前帧的时间间隔
|
||||
static int s_nInterval = 0;
|
||||
// 游戏开始时长
|
||||
static double s_fTotalTime = 0;
|
||||
|
||||
|
||||
double e2d::Time::getTotalTime()
|
||||
{
|
||||
return s_fTotalTime;
|
||||
}
|
||||
|
||||
int e2d::Time::getDeltaTime()
|
||||
{
|
||||
return s_nInterval;
|
||||
}
|
||||
|
||||
|
||||
#if HIGHER_THAN_VS2010
|
||||
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
using namespace std::chrono;
|
||||
|
|
@ -12,24 +32,10 @@ static steady_clock::time_point s_tNow;
|
|||
static steady_clock::time_point s_tFixedUpdate;
|
||||
// 上一次更新时间
|
||||
static steady_clock::time_point s_tLastUpdate;
|
||||
// 上一帧与当前帧的时间间隔
|
||||
static int s_nInterval = 0;
|
||||
// 游戏开始时长
|
||||
static double s_fTotalTime = 0;
|
||||
// 每一帧间隔
|
||||
static milliseconds s_tExceptedInvertal;
|
||||
|
||||
|
||||
double e2d::Time::getTotalTime()
|
||||
{
|
||||
return s_fTotalTime;
|
||||
}
|
||||
|
||||
int e2d::Time::getDeltaTime()
|
||||
{
|
||||
return s_nInterval;
|
||||
}
|
||||
|
||||
bool e2d::Time::__init()
|
||||
{
|
||||
s_tStart = s_tLastUpdate = s_tFixedUpdate = s_tNow = steady_clock::now();
|
||||
|
|
@ -73,3 +79,73 @@ void e2d::Time::__sleep()
|
|||
std::this_thread::sleep_for(milliseconds(nWaitMS));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
#include <mmsystem.h>
|
||||
#pragma comment(lib, "winmm.lib")
|
||||
|
||||
// 时钟频率
|
||||
static LARGE_INTEGER s_tFreq;
|
||||
// 游戏开始时间
|
||||
static LARGE_INTEGER s_tStart;
|
||||
// 当前时间
|
||||
static LARGE_INTEGER s_tNow;
|
||||
// 上一帧刷新时间
|
||||
static LARGE_INTEGER s_tFixedUpdate;
|
||||
// 上一次更新时间
|
||||
static LARGE_INTEGER s_tLastUpdate;
|
||||
// 每一帧间隔
|
||||
static LONGLONG s_tExceptedInvertal;
|
||||
|
||||
|
||||
bool e2d::Time::__init()
|
||||
{
|
||||
::timeBeginPeriod(1); // 修改时间精度
|
||||
::QueryPerformanceFrequency(&s_tFreq); // 获取时钟频率
|
||||
::QueryPerformanceCounter(&s_tNow); // 刷新当前时间
|
||||
s_tStart = s_tLastUpdate = s_tFixedUpdate = s_tNow;
|
||||
s_tExceptedInvertal = 17LL * s_tFreq.QuadPart / 1000LL;
|
||||
return true;
|
||||
}
|
||||
|
||||
void e2d::Time::__uninit()
|
||||
{
|
||||
::timeEndPeriod(1); // 重置时间精度
|
||||
}
|
||||
|
||||
bool e2d::Time::__isReady()
|
||||
{
|
||||
return s_tExceptedInvertal < (s_tNow.QuadPart - s_tFixedUpdate.QuadPart);
|
||||
}
|
||||
|
||||
void e2d::Time::__updateNow()
|
||||
{
|
||||
::QueryPerformanceCounter(&s_tNow);
|
||||
}
|
||||
|
||||
void e2d::Time::__updateLast()
|
||||
{
|
||||
s_tFixedUpdate.QuadPart += s_tExceptedInvertal;
|
||||
s_tLastUpdate = s_tNow;
|
||||
|
||||
::QueryPerformanceCounter(&s_tNow);
|
||||
s_nInterval = static_cast<int>((s_tNow.QuadPart - s_tLastUpdate.QuadPart) * 1000LL / s_tFreq.QuadPart);
|
||||
s_fTotalTime = static_cast<double>(s_tNow.QuadPart - s_tStart.QuadPart) / s_tFreq.QuadPart;
|
||||
}
|
||||
|
||||
void e2d::Time::__sleep()
|
||||
{
|
||||
// 计算挂起时长
|
||||
int nWaitMS = 16 - static_cast<int>((s_tNow.QuadPart - s_tFixedUpdate.QuadPart) * 1000LL / s_tFreq.QuadPart);
|
||||
// 挂起线程,释放 CPU 占用
|
||||
if (nWaitMS > 1)
|
||||
{
|
||||
::Sleep(nWaitMS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -202,9 +202,9 @@ bool e2d::Image::preload(String fileName)
|
|||
|
||||
void e2d::Image::clearCache()
|
||||
{
|
||||
for (auto child : s_mBitmapsFromFile)
|
||||
for (auto child = s_mBitmapsFromFile.begin(); child != s_mBitmapsFromFile.end(); child++)
|
||||
{
|
||||
SafeReleaseInterface(&child.second);
|
||||
SafeReleaseInterface(&(*child).second);
|
||||
}
|
||||
s_mBitmapsFromFile.clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,39 @@ e2d::String & e2d::String::operator=(const char *cstr)
|
|||
return (*this);
|
||||
}
|
||||
|
||||
e2d::String e2d::String::parse(int value)
|
||||
{
|
||||
String tmp;
|
||||
#if HIGHER_THAN_VS2010
|
||||
tmp.m_str = std::to_wstring(value);
|
||||
#else
|
||||
tmp.m_str = std::to_wstring(static_cast<long long>(value));
|
||||
#endif
|
||||
return std::move(tmp);
|
||||
}
|
||||
|
||||
e2d::String e2d::String::parse(float value)
|
||||
{
|
||||
String tmp;
|
||||
#if HIGHER_THAN_VS2010
|
||||
tmp.m_str = std::to_wstring(value);
|
||||
#else
|
||||
tmp.m_str = std::to_wstring(static_cast<long double>(value));
|
||||
#endif
|
||||
return std::move(tmp);
|
||||
}
|
||||
|
||||
e2d::String e2d::String::parse(double value)
|
||||
{
|
||||
String tmp;
|
||||
#if HIGHER_THAN_VS2010
|
||||
tmp.m_str = std::to_wstring(value);
|
||||
#else
|
||||
tmp.m_str = std::to_wstring(static_cast<long double>(value));
|
||||
#endif
|
||||
return std::move(tmp);
|
||||
}
|
||||
|
||||
e2d::String & e2d::String::format(const char * format, ...)
|
||||
{
|
||||
std::string tmp;
|
||||
|
|
@ -266,25 +299,19 @@ e2d::String & e2d::String::operator<<(char * cstr)
|
|||
|
||||
e2d::String & e2d::String::operator<<(int value)
|
||||
{
|
||||
(*this) += String::toString(value);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
e2d::String & e2d::String::operator<<(unsigned int value)
|
||||
{
|
||||
(*this) += String::toString(value);
|
||||
(*this) += String::parse(value);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
e2d::String & e2d::String::operator<<(float value)
|
||||
{
|
||||
(*this) += String::toString(value);
|
||||
(*this) += String::parse(value);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
e2d::String & e2d::String::operator<<(double value)
|
||||
{
|
||||
(*this) += String::toString(value);
|
||||
(*this) += String::parse(value);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ void e2d::ActionManager::__add(Action * pAction)
|
|||
{
|
||||
if (pAction)
|
||||
{
|
||||
for (const auto action : s_vActions)
|
||||
FOR_LOOP(action, s_vActions)
|
||||
{
|
||||
if (action == pAction)
|
||||
{
|
||||
|
|
@ -76,7 +76,7 @@ void e2d::ActionManager::__resumeAllBindedWith(Node * pTargetNode)
|
|||
{
|
||||
if (pTargetNode)
|
||||
{
|
||||
for (auto action : s_vRunningActions)
|
||||
FOR_LOOP(action, s_vRunningActions)
|
||||
{
|
||||
if (action->getTarget() == pTargetNode)
|
||||
{
|
||||
|
|
@ -90,7 +90,7 @@ void e2d::ActionManager::__pauseAllBindedWith(Node * pTargetNode)
|
|||
{
|
||||
if (pTargetNode)
|
||||
{
|
||||
for (auto action : s_vRunningActions)
|
||||
FOR_LOOP(action, s_vRunningActions)
|
||||
{
|
||||
if (action->getTarget() == pTargetNode)
|
||||
{
|
||||
|
|
@ -104,7 +104,7 @@ void e2d::ActionManager::__stopAllBindedWith(Node * pTargetNode)
|
|||
{
|
||||
if (pTargetNode)
|
||||
{
|
||||
for (auto action : s_vRunningActions)
|
||||
FOR_LOOP(action, s_vRunningActions)
|
||||
{
|
||||
if (action->getTarget() == pTargetNode)
|
||||
{
|
||||
|
|
@ -116,7 +116,7 @@ void e2d::ActionManager::__stopAllBindedWith(Node * pTargetNode)
|
|||
|
||||
void e2d::ActionManager::resume(String strActionName)
|
||||
{
|
||||
for (auto action : s_vRunningActions)
|
||||
FOR_LOOP(action, s_vRunningActions)
|
||||
{
|
||||
if (action->getName() == strActionName)
|
||||
{
|
||||
|
|
@ -127,7 +127,7 @@ void e2d::ActionManager::resume(String strActionName)
|
|||
|
||||
void e2d::ActionManager::pause(String strActionName)
|
||||
{
|
||||
for (auto action : s_vRunningActions)
|
||||
FOR_LOOP(action, s_vRunningActions)
|
||||
{
|
||||
if (action->getName() == strActionName)
|
||||
{
|
||||
|
|
@ -138,7 +138,7 @@ void e2d::ActionManager::pause(String strActionName)
|
|||
|
||||
void e2d::ActionManager::stop(String strActionName)
|
||||
{
|
||||
for (auto action : s_vRunningActions)
|
||||
FOR_LOOP(action, s_vRunningActions)
|
||||
{
|
||||
if (action->getName() == strActionName)
|
||||
{
|
||||
|
|
@ -169,7 +169,7 @@ void e2d::ActionManager::__clearAllBindedWith(Node * pTargetNode)
|
|||
|
||||
void e2d::ActionManager::resumeAll()
|
||||
{
|
||||
for (auto child : SceneManager::getCurrentScene()->getRoot()->getChildren())
|
||||
FOR_LOOP(child, SceneManager::getCurrentScene()->getRoot()->getChildren())
|
||||
{
|
||||
ActionManager::__resumeAllBindedWith(child);
|
||||
}
|
||||
|
|
@ -177,7 +177,7 @@ void e2d::ActionManager::resumeAll()
|
|||
|
||||
void e2d::ActionManager::pauseAll()
|
||||
{
|
||||
for (auto child : SceneManager::getCurrentScene()->getRoot()->getChildren())
|
||||
FOR_LOOP(child, SceneManager::getCurrentScene()->getRoot()->getChildren())
|
||||
{
|
||||
ActionManager::__pauseAllBindedWith(child);
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ void e2d::ActionManager::pauseAll()
|
|||
|
||||
void e2d::ActionManager::stopAll()
|
||||
{
|
||||
for (auto child : SceneManager::getCurrentScene()->getRoot()->getChildren())
|
||||
FOR_LOOP(child, SceneManager::getCurrentScene()->getRoot()->getChildren())
|
||||
{
|
||||
ActionManager::__stopAllBindedWith(child);
|
||||
}
|
||||
|
|
@ -194,7 +194,7 @@ void e2d::ActionManager::stopAll()
|
|||
std::vector<e2d::Action*> e2d::ActionManager::get(String strActionName)
|
||||
{
|
||||
std::vector<Action*> vActions;
|
||||
for (const auto action : s_vActions)
|
||||
FOR_LOOP(action, s_vActions)
|
||||
{
|
||||
if (action->getName() == strActionName)
|
||||
{
|
||||
|
|
@ -211,7 +211,7 @@ std::vector<e2d::Action*> e2d::ActionManager::getAll()
|
|||
|
||||
void e2d::ActionManager::__resetAllActions()
|
||||
{
|
||||
for (auto action : s_vRunningActions)
|
||||
FOR_LOOP(action, s_vRunningActions)
|
||||
{
|
||||
action->_resetTime();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,9 +67,9 @@ void e2d::CollisionManager::__updateShape(e2d::ShapeBase * pActiveShape)
|
|||
pPassiveNode->getParentScene() == pCurrentScene)
|
||||
{
|
||||
// 判断两物体是否是相互冲突的物体
|
||||
auto IsCollideWith = [](Node * active, unsigned int hash)
|
||||
auto IsCollideWith = [](Node * active, unsigned int hash) -> bool
|
||||
{
|
||||
for (auto collider : active->m_vColliders)
|
||||
FOR_LOOP(collider, active->m_vColliders)
|
||||
if (collider == hash)
|
||||
return true;
|
||||
return false;
|
||||
|
|
@ -78,7 +78,7 @@ void e2d::CollisionManager::__updateShape(e2d::ShapeBase * pActiveShape)
|
|||
if (IsCollideWith(pActiveNode, pPassiveNode->getHashName()))
|
||||
{
|
||||
// 判断两形状交集情况
|
||||
Relation relation = pActiveShape->getRelationWith(pPassiveShape);
|
||||
int relation = pActiveShape->getRelationWith(pPassiveShape);
|
||||
// 忽略 UNKNOWN 和 DISJOINT 情况
|
||||
if (relation != Relation::UNKNOWN && relation != Relation::DISJOINT)
|
||||
{
|
||||
|
|
@ -105,7 +105,7 @@ void e2d::CollisionManager::__add(CollisionListener * pListener)
|
|||
{
|
||||
auto findListener = [](CollisionListener * pListener) -> bool
|
||||
{
|
||||
for (const auto &l : s_vListeners)
|
||||
FOR_LOOP(l, s_vListeners)
|
||||
{
|
||||
if (pListener == l)
|
||||
{
|
||||
|
|
@ -133,7 +133,7 @@ void e2d::CollisionManager::add(Function func, String name)
|
|||
|
||||
void e2d::CollisionManager::start(String name)
|
||||
{
|
||||
for (const auto & pListener : s_vListeners)
|
||||
FOR_LOOP(pListener, s_vListeners)
|
||||
{
|
||||
if (pListener->getName() == name)
|
||||
{
|
||||
|
|
@ -144,7 +144,7 @@ void e2d::CollisionManager::start(String name)
|
|||
|
||||
void e2d::CollisionManager::stop(String name)
|
||||
{
|
||||
for (const auto & pListener : s_vListeners)
|
||||
FOR_LOOP(pListener, s_vListeners)
|
||||
{
|
||||
if (pListener->getName() == name)
|
||||
{
|
||||
|
|
@ -155,7 +155,7 @@ void e2d::CollisionManager::stop(String name)
|
|||
|
||||
void e2d::CollisionManager::clear(String name)
|
||||
{
|
||||
for (const auto & pListener : s_vListeners)
|
||||
FOR_LOOP(pListener, s_vListeners)
|
||||
{
|
||||
if (pListener->getName() == name)
|
||||
{
|
||||
|
|
@ -166,7 +166,7 @@ void e2d::CollisionManager::clear(String name)
|
|||
|
||||
void e2d::CollisionManager::startAll()
|
||||
{
|
||||
for (const auto & pListener : s_vListeners)
|
||||
FOR_LOOP(pListener, s_vListeners)
|
||||
{
|
||||
pListener->start();
|
||||
}
|
||||
|
|
@ -174,7 +174,7 @@ void e2d::CollisionManager::startAll()
|
|||
|
||||
void e2d::CollisionManager::stopAll()
|
||||
{
|
||||
for (const auto & pListener : s_vListeners)
|
||||
FOR_LOOP(pListener, s_vListeners)
|
||||
{
|
||||
pListener->stop();
|
||||
}
|
||||
|
|
@ -182,7 +182,7 @@ void e2d::CollisionManager::stopAll()
|
|||
|
||||
void e2d::CollisionManager::clearAll()
|
||||
{
|
||||
for (const auto & pListener : s_vListeners)
|
||||
FOR_LOOP(pListener, s_vListeners)
|
||||
{
|
||||
pListener->stopAndClear();
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ void e2d::CollisionManager::clearAll()
|
|||
std::vector<e2d::CollisionListener*> e2d::CollisionManager::get(String name)
|
||||
{
|
||||
std::vector<CollisionListener*> vListeners;
|
||||
for (auto pListener : s_vListeners)
|
||||
FOR_LOOP(pListener, s_vListeners)
|
||||
{
|
||||
if (pListener->getName() == name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ void e2d::InputManager::__add(InputListener * pListener)
|
|||
{
|
||||
auto findListener = [](InputListener * pListener) -> bool
|
||||
{
|
||||
for (const auto &l : s_vListeners)
|
||||
FOR_LOOP(l, s_vListeners)
|
||||
{
|
||||
if (pListener == l)
|
||||
{
|
||||
|
|
@ -59,7 +59,7 @@ void e2d::InputManager::add(Function func, String name)
|
|||
|
||||
void e2d::InputManager::start(String name)
|
||||
{
|
||||
for (const auto & pListener : s_vListeners)
|
||||
FOR_LOOP(pListener, s_vListeners)
|
||||
{
|
||||
if (pListener->getName() == name)
|
||||
{
|
||||
|
|
@ -70,7 +70,7 @@ void e2d::InputManager::start(String name)
|
|||
|
||||
void e2d::InputManager::stop(String name)
|
||||
{
|
||||
for (const auto & pListener : s_vListeners)
|
||||
FOR_LOOP(pListener, s_vListeners)
|
||||
{
|
||||
if (pListener->getName() == name)
|
||||
{
|
||||
|
|
@ -81,7 +81,7 @@ void e2d::InputManager::stop(String name)
|
|||
|
||||
void e2d::InputManager::clear(String name)
|
||||
{
|
||||
for (const auto & pListener : s_vListeners)
|
||||
FOR_LOOP(pListener, s_vListeners)
|
||||
{
|
||||
if (pListener->getName() == name)
|
||||
{
|
||||
|
|
@ -92,7 +92,7 @@ void e2d::InputManager::clear(String name)
|
|||
|
||||
void e2d::InputManager::startAll()
|
||||
{
|
||||
for (const auto & pListener : s_vListeners)
|
||||
FOR_LOOP(pListener, s_vListeners)
|
||||
{
|
||||
pListener->start();
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ void e2d::InputManager::startAll()
|
|||
|
||||
void e2d::InputManager::stopAll()
|
||||
{
|
||||
for (const auto & pListener : s_vListeners)
|
||||
FOR_LOOP(pListener, s_vListeners)
|
||||
{
|
||||
pListener->stop();
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ void e2d::InputManager::stopAll()
|
|||
|
||||
void e2d::InputManager::clearAll()
|
||||
{
|
||||
for (const auto & pListener : s_vListeners)
|
||||
FOR_LOOP(pListener, s_vListeners)
|
||||
{
|
||||
pListener->stopAndClear();
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ void e2d::InputManager::clearAll()
|
|||
std::vector<e2d::InputListener*> e2d::InputManager::get(String name)
|
||||
{
|
||||
std::vector<InputListener*> vListeners;
|
||||
for (auto pListener : s_vListeners)
|
||||
FOR_LOOP(pListener, s_vListeners)
|
||||
{
|
||||
if (pListener->getName() == name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,9 +2,18 @@
|
|||
#include "..\etools.h"
|
||||
#include <map>
|
||||
|
||||
#if HIGHER_THAN_VS2010
|
||||
|
||||
static IXAudio2 * s_pXAudio2 = nullptr;
|
||||
static IXAudio2MasteringVoice * s_pMasteringVoice = nullptr;
|
||||
|
||||
#else
|
||||
|
||||
static HINSTANCE s_hInstance = nullptr;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
typedef std::pair<UINT, e2d::Music *> MusicPair;
|
||||
typedef std::map<UINT, e2d::Music *> MusicList;
|
||||
|
||||
|
|
@ -98,28 +107,31 @@ e2d::Music * e2d::MusicManager::get(String strFilePath)
|
|||
|
||||
void e2d::MusicManager::pauseAll()
|
||||
{
|
||||
for (auto iter : getMusicList())
|
||||
for (auto iter = getMusicList().begin(); iter != getMusicList().end(); iter++)
|
||||
{
|
||||
iter.second->pause();
|
||||
(*iter).second->pause();
|
||||
}
|
||||
}
|
||||
|
||||
void e2d::MusicManager::resumeAll()
|
||||
{
|
||||
for (auto iter : getMusicList())
|
||||
for (auto iter = getMusicList().begin(); iter != getMusicList().end(); iter++)
|
||||
{
|
||||
iter.second->resume();
|
||||
(*iter).second->resume();
|
||||
}
|
||||
}
|
||||
|
||||
void e2d::MusicManager::stopAll()
|
||||
{
|
||||
for (auto iter : getMusicList())
|
||||
for (auto iter = getMusicList().begin(); iter != getMusicList().end(); iter++)
|
||||
{
|
||||
iter.second->stop();
|
||||
(*iter).second->stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if HIGHER_THAN_VS2010
|
||||
|
||||
IXAudio2 * e2d::MusicManager::getIXAudio2()
|
||||
{
|
||||
return s_pXAudio2;
|
||||
|
|
@ -166,3 +178,45 @@ void e2d::MusicManager::__uninit()
|
|||
|
||||
SafeReleaseInterface(&s_pXAudio2);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
HINSTANCE e2d::MusicManager::getHInstance()
|
||||
{
|
||||
return s_hInstance;
|
||||
}
|
||||
|
||||
bool e2d::MusicManager::__init()
|
||||
{
|
||||
s_hInstance = HINST_THISCOMPONENT;
|
||||
|
||||
WNDCLASS wc;
|
||||
wc.style = 0;
|
||||
wc.lpfnWndProc = Music::MusicProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = s_hInstance;
|
||||
wc.hIcon = 0;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = NULL;
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.lpszClassName = MUSIC_CLASS_NAME;
|
||||
|
||||
if (!RegisterClass(&wc) && 1410 != GetLastError())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void e2d::MusicManager::__uninit()
|
||||
{
|
||||
for (auto iter = getMusicList().begin(); iter != getMusicList().end(); iter++)
|
||||
{
|
||||
(*iter).second->close();
|
||||
(*iter).second->release();
|
||||
}
|
||||
getMusicList().clear();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -41,7 +41,7 @@ void e2d::TimerManager::__add(Timer * pTimer)
|
|||
{
|
||||
auto findTimer = [](Timer * pTimer) -> bool
|
||||
{
|
||||
for (const auto &t : s_vTimers)
|
||||
FOR_LOOP(t, s_vTimers)
|
||||
{
|
||||
if (pTimer == t)
|
||||
{
|
||||
|
|
@ -64,7 +64,7 @@ void e2d::TimerManager::__add(Timer * pTimer)
|
|||
|
||||
void e2d::TimerManager::start(String name)
|
||||
{
|
||||
for (auto timer : s_vTimers)
|
||||
FOR_LOOP(timer, s_vTimers)
|
||||
{
|
||||
if (timer->getName() == name)
|
||||
{
|
||||
|
|
@ -75,7 +75,7 @@ void e2d::TimerManager::start(String name)
|
|||
|
||||
void e2d::TimerManager::stop(String name)
|
||||
{
|
||||
for (auto timer : s_vTimers)
|
||||
FOR_LOOP(timer, s_vTimers)
|
||||
{
|
||||
if (timer->getName() == name)
|
||||
{
|
||||
|
|
@ -86,7 +86,7 @@ void e2d::TimerManager::stop(String name)
|
|||
|
||||
void e2d::TimerManager::clear(String name)
|
||||
{
|
||||
for (auto timer : s_vTimers)
|
||||
FOR_LOOP(timer, s_vTimers)
|
||||
{
|
||||
if (timer->getName() == name)
|
||||
{
|
||||
|
|
@ -98,7 +98,7 @@ void e2d::TimerManager::clear(String name)
|
|||
std::vector<e2d::Timer*> e2d::TimerManager::get(String name)
|
||||
{
|
||||
std::vector<Timer*> vTimers;
|
||||
for (auto timer : s_vTimers)
|
||||
FOR_LOOP(timer, s_vTimers)
|
||||
{
|
||||
if (timer->getName() == name)
|
||||
{
|
||||
|
|
@ -110,7 +110,7 @@ std::vector<e2d::Timer*> e2d::TimerManager::get(String name)
|
|||
|
||||
void e2d::TimerManager::startAll()
|
||||
{
|
||||
for (auto timer : s_vTimers)
|
||||
FOR_LOOP(timer, s_vTimers)
|
||||
{
|
||||
timer->start();
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ void e2d::TimerManager::startAll()
|
|||
|
||||
void e2d::TimerManager::stopAll()
|
||||
{
|
||||
for (auto timer : s_vTimers)
|
||||
FOR_LOOP(timer, s_vTimers)
|
||||
{
|
||||
timer->stop();
|
||||
}
|
||||
|
|
@ -126,7 +126,7 @@ void e2d::TimerManager::stopAll()
|
|||
|
||||
void e2d::TimerManager::stopAndClearAll()
|
||||
{
|
||||
for (auto timer : s_vTimers)
|
||||
FOR_LOOP(timer, s_vTimers)
|
||||
{
|
||||
timer->stop();
|
||||
timer->release();
|
||||
|
|
@ -141,7 +141,7 @@ std::vector<e2d::Timer*> e2d::TimerManager::getAll()
|
|||
|
||||
void e2d::TimerManager::__resetAllTimers()
|
||||
{
|
||||
for (auto timer : s_vTimers)
|
||||
FOR_LOOP(timer, s_vTimers)
|
||||
{
|
||||
timer->m_fLast = Time::getTotalTime();
|
||||
}
|
||||
|
|
@ -149,7 +149,7 @@ void e2d::TimerManager::__resetAllTimers()
|
|||
|
||||
void e2d::TimerManager::__uninit()
|
||||
{
|
||||
for (const auto timer : s_vTimers)
|
||||
FOR_LOOP(timer, s_vTimers)
|
||||
{
|
||||
timer->release();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ void e2d::Menu::setEnable(bool enable)
|
|||
{
|
||||
m_bEnable = enable;
|
||||
|
||||
for (auto button : m_vButtons)
|
||||
FOR_LOOP(button, m_vButtons)
|
||||
{
|
||||
button->setEnable(enable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ e2d::Node::~Node()
|
|||
{
|
||||
ActionManager::__clearAllBindedWith(this);
|
||||
CollisionManager::__removeShape(m_pShape);
|
||||
for (auto child : m_vChildren)
|
||||
FOR_LOOP(child, m_vChildren)
|
||||
{
|
||||
SafeRelease(&child);
|
||||
}
|
||||
|
|
@ -174,7 +174,7 @@ void e2d::Node::_drawShape()
|
|||
}
|
||||
|
||||
// 绘制所有子节点的几何形状
|
||||
for (auto child : m_vChildren)
|
||||
FOR_LOOP(child, m_vChildren)
|
||||
{
|
||||
child->_drawShape();
|
||||
}
|
||||
|
|
@ -187,7 +187,7 @@ void e2d::Node::_onEnter()
|
|||
this->m_bDisplayedInScene = true;
|
||||
this->onEnter();
|
||||
|
||||
for (auto child : m_vChildren)
|
||||
FOR_LOOP(child, m_vChildren)
|
||||
{
|
||||
child->_onEnter();
|
||||
}
|
||||
|
|
@ -201,7 +201,7 @@ void e2d::Node::_onExit()
|
|||
this->m_bDisplayedInScene = false;
|
||||
this->onExit();
|
||||
|
||||
for (auto child : m_vChildren)
|
||||
FOR_LOOP(child, m_vChildren)
|
||||
{
|
||||
child->_onExit();
|
||||
}
|
||||
|
|
@ -240,7 +240,7 @@ void e2d::Node::_updateTransform()
|
|||
|
||||
void e2d::Node::_updateChildrenTransform()
|
||||
{
|
||||
for (auto child : m_vChildren)
|
||||
FOR_LOOP(child, m_vChildren)
|
||||
{
|
||||
_updateTransform(child);
|
||||
}
|
||||
|
|
@ -263,7 +263,7 @@ void e2d::Node::_updateTransform(Node * node)
|
|||
|
||||
void e2d::Node::_updateChildrenOpacity()
|
||||
{
|
||||
for (auto child : m_vChildren)
|
||||
FOR_LOOP(child, m_vChildren)
|
||||
{
|
||||
_updateOpacity(child);
|
||||
}
|
||||
|
|
@ -547,7 +547,7 @@ void e2d::Node::setSize(Size size)
|
|||
this->setSize(size.width, size.height);
|
||||
}
|
||||
|
||||
void e2d::Node::setShape(Shape type)
|
||||
void e2d::Node::setShape(int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
|
@ -683,7 +683,7 @@ std::vector<e2d::Node*> e2d::Node::getChildren(String name)
|
|||
std::vector<Node*> vChildren;
|
||||
unsigned int hash = name.getHashCode();
|
||||
|
||||
for (auto child : m_vChildren)
|
||||
FOR_LOOP(child, m_vChildren)
|
||||
{
|
||||
// 不同的名称可能会有相同的 Hash 值,但是先比较 Hash 可以提升搜索速度
|
||||
if (child->m_nHashName == hash && child->m_sName == name)
|
||||
|
|
@ -784,7 +784,7 @@ void e2d::Node::removeChildren(String childName)
|
|||
void e2d::Node::clearAllChildren()
|
||||
{
|
||||
// 所有节点的引用计数减一
|
||||
for (auto child : m_vChildren)
|
||||
FOR_LOOP(child, m_vChildren)
|
||||
{
|
||||
if (child->m_bDisplayedInScene)
|
||||
{
|
||||
|
|
@ -820,7 +820,7 @@ void e2d::Node::runAction(Action * action)
|
|||
void e2d::Node::resumeAction(String strActionName)
|
||||
{
|
||||
auto actions = ActionManager::get(strActionName);
|
||||
for (auto action : actions)
|
||||
FOR_LOOP(action, actions)
|
||||
{
|
||||
if (action->getTarget() == this)
|
||||
{
|
||||
|
|
@ -832,7 +832,7 @@ void e2d::Node::resumeAction(String strActionName)
|
|||
void e2d::Node::pauseAction(String strActionName)
|
||||
{
|
||||
auto actions = ActionManager::get(strActionName);
|
||||
for (auto action : actions)
|
||||
FOR_LOOP(action, actions)
|
||||
{
|
||||
if (action->getTarget() == this)
|
||||
{
|
||||
|
|
@ -844,7 +844,7 @@ void e2d::Node::pauseAction(String strActionName)
|
|||
void e2d::Node::stopAction(String strActionName)
|
||||
{
|
||||
auto actions = ActionManager::get(strActionName);
|
||||
for (auto action : actions)
|
||||
FOR_LOOP(action, actions)
|
||||
{
|
||||
if (action->getTarget() == this)
|
||||
{
|
||||
|
|
@ -856,7 +856,7 @@ void e2d::Node::stopAction(String strActionName)
|
|||
e2d::Action * e2d::Node::getAction(String strActionName)
|
||||
{
|
||||
auto actions = ActionManager::get(strActionName);
|
||||
for (auto action : actions)
|
||||
FOR_LOOP(action, actions)
|
||||
{
|
||||
if (action->getTarget() == this)
|
||||
{
|
||||
|
|
@ -924,7 +924,7 @@ bool e2d::Node::isPointIn(Point point) const
|
|||
}
|
||||
|
||||
// 判断点是否在子节点内
|
||||
for (auto child : m_vChildren)
|
||||
FOR_LOOP(child, m_vChildren)
|
||||
if (child->isPointIn(point))
|
||||
return true;
|
||||
|
||||
|
|
@ -936,7 +936,7 @@ bool e2d::Node::isIntersectWith(const Node * pNode) const
|
|||
// 如果存在形状,用形状判断
|
||||
if (this->m_pShape && pNode->m_pShape)
|
||||
{
|
||||
Relation relation = this->m_pShape->getRelationWith(pNode->m_pShape);
|
||||
int relation = this->m_pShape->getRelationWith(pNode->m_pShape);
|
||||
if ((relation != Relation::UNKNOWN) &&
|
||||
(relation != Relation::DISJOINT))
|
||||
{
|
||||
|
|
@ -977,20 +977,20 @@ bool e2d::Node::isIntersectWith(const Node * pNode) const
|
|||
SafeReleaseInterface(&pRect1);
|
||||
SafeReleaseInterface(&pRect2);
|
||||
SafeReleaseInterface(&pShape);
|
||||
if ((relation != D2D1_GEOMETRY_RELATION::D2D1_GEOMETRY_RELATION_UNKNOWN) &&
|
||||
(relation != D2D1_GEOMETRY_RELATION::D2D1_GEOMETRY_RELATION_DISJOINT))
|
||||
if ((relation != D2D1_GEOMETRY_RELATION_UNKNOWN) &&
|
||||
(relation != D2D1_GEOMETRY_RELATION_DISJOINT))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 判断和其子节点是否相交
|
||||
for (auto child : pNode->m_vChildren)
|
||||
if (this->isIntersectWith(child))
|
||||
FOR_LOOP(pNodeChild, pNode->m_vChildren)
|
||||
if (this->isIntersectWith(pNodeChild))
|
||||
return true;
|
||||
|
||||
// 判断子节点和其是否相交
|
||||
for (auto child : m_vChildren)
|
||||
FOR_LOOP(child, m_vChildren)
|
||||
if (child->isIntersectWith(pNode))
|
||||
return true;
|
||||
|
||||
|
|
@ -1050,7 +1050,7 @@ void e2d::Node::setName(String name)
|
|||
void e2d::Node::_setParentScene(Scene * scene)
|
||||
{
|
||||
m_pParentScene = scene;
|
||||
for (auto child : m_vChildren)
|
||||
FOR_LOOP(child, m_vChildren)
|
||||
{
|
||||
child->_setParentScene(scene);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ void e2d::Text::setLineSpacing(double fLineSpacing)
|
|||
}
|
||||
}
|
||||
|
||||
void e2d::Text::setAlignment(TextAlign nAlign)
|
||||
void e2d::Text::setAlignment(int nAlign)
|
||||
{
|
||||
if (m_nAlign != nAlign)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ void e2d::ShapeBase::_render()
|
|||
}
|
||||
}
|
||||
|
||||
e2d::Relation e2d::ShapeBase::getRelationWith(ShapeBase * pShape) const
|
||||
int e2d::ShapeBase::getRelationWith(ShapeBase * pShape) const
|
||||
{
|
||||
if (m_pTransformedShape && pShape->m_pTransformedShape)
|
||||
{
|
||||
|
|
@ -79,7 +79,7 @@ e2d::Relation e2d::ShapeBase::getRelationWith(ShapeBase * pShape) const
|
|||
&relation
|
||||
);
|
||||
|
||||
return Relation(relation);
|
||||
return relation;
|
||||
}
|
||||
}
|
||||
return Relation::UNKNOWN;
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ static e2d::String s_sDefaultFileName = L"DefaultData.ini";
|
|||
|
||||
void e2d::Data::saveInt(String key, int value, String field)
|
||||
{
|
||||
::WritePrivateProfileString(field, key, String::toString(value), Data::getDataFilePath());
|
||||
::WritePrivateProfileString(field, key, String::parse(value), Data::getDataFilePath());
|
||||
}
|
||||
|
||||
void e2d::Data::saveDouble(String key, double value, String field)
|
||||
{
|
||||
::WritePrivateProfileString(field, key, String::toString(value), Data::getDataFilePath());
|
||||
::WritePrivateProfileString(field, key, String::parse(value), Data::getDataFilePath());
|
||||
}
|
||||
|
||||
void e2d::Data::saveBool(String key, bool value, String field)
|
||||
|
|
@ -31,7 +31,7 @@ int e2d::Data::getInt(String key, int defaultValue, String field)
|
|||
double e2d::Data::getDouble(String key, double defaultValue, String field)
|
||||
{
|
||||
wchar_t temp[32] = { 0 };
|
||||
::GetPrivateProfileString(field, key, String::toString(defaultValue), temp, 31, Data::getDataFilePath());
|
||||
::GetPrivateProfileString(field, key, String::parse(defaultValue), temp, 31, Data::getDataFilePath());
|
||||
return std::stof(temp);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
using namespace e2d;
|
||||
|
||||
#if HIGHER_THAN_VS2010
|
||||
|
||||
#ifndef SAFE_DELETE
|
||||
#define SAFE_DELETE(p) { if (p) { delete (p); (p)=nullptr; } }
|
||||
#endif
|
||||
|
|
@ -231,7 +233,7 @@ void Music::close()
|
|||
m_bPlaying = false;
|
||||
}
|
||||
|
||||
bool Music::isPlaying()
|
||||
bool Music::isPlaying() const
|
||||
{
|
||||
if (m_bOpened && m_pSourceVoice)
|
||||
{
|
||||
|
|
@ -490,3 +492,196 @@ bool Music::_findMediaFileCch(wchar_t* strDestPath, int cchDest, const wchar_t *
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
e2d::Music::Music()
|
||||
: m_wnd(NULL)
|
||||
, m_dev(0L)
|
||||
, m_nMusicID(0)
|
||||
, m_bPlaying(false)
|
||||
, m_nRepeatTimes(0)
|
||||
{
|
||||
m_wnd = CreateWindowEx(
|
||||
WS_EX_APPWINDOW,
|
||||
MUSIC_CLASS_NAME,
|
||||
NULL,
|
||||
WS_POPUPWINDOW,
|
||||
0, 0, 0, 0,
|
||||
NULL,
|
||||
NULL,
|
||||
MusicManager::getHInstance(),
|
||||
NULL);
|
||||
|
||||
if (m_wnd)
|
||||
{
|
||||
SetWindowLongPtr(m_wnd, GWLP_USERDATA, (LONG_PTR)this);
|
||||
}
|
||||
}
|
||||
|
||||
e2d::Music::~Music()
|
||||
{
|
||||
close();
|
||||
DestroyWindow(m_wnd);
|
||||
}
|
||||
|
||||
bool e2d::Music::open(String pFileName)
|
||||
{
|
||||
if (pFileName.isEmpty())
|
||||
return false;
|
||||
|
||||
close();
|
||||
|
||||
MCI_OPEN_PARMS mciOpen = { 0 };
|
||||
mciOpen.lpstrDeviceType = 0;
|
||||
mciOpen.lpstrElementName = pFileName;
|
||||
|
||||
MCIERROR mciError;
|
||||
mciError = mciSendCommand(
|
||||
0,
|
||||
MCI_OPEN,
|
||||
MCI_OPEN_ELEMENT,
|
||||
reinterpret_cast<DWORD_PTR>(&mciOpen)
|
||||
);
|
||||
|
||||
if (mciError == 0)
|
||||
{
|
||||
m_dev = mciOpen.wDeviceID;
|
||||
m_nMusicID = pFileName.getHashCode();
|
||||
m_bPlaying = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool e2d::Music::play(int nLoopCount)
|
||||
{
|
||||
if (!m_dev)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
MCI_PLAY_PARMS mciPlay = { 0 };
|
||||
mciPlay.dwCallback = reinterpret_cast<DWORD_PTR>(m_wnd);
|
||||
|
||||
// 播放声音
|
||||
MCIERROR mciError = mciSendCommand(
|
||||
m_dev,
|
||||
MCI_PLAY,
|
||||
MCI_FROM | MCI_NOTIFY,
|
||||
reinterpret_cast<DWORD_PTR>(&mciPlay)
|
||||
);
|
||||
|
||||
if (!mciError)
|
||||
{
|
||||
m_bPlaying = true;
|
||||
m_nRepeatTimes = nLoopCount;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void e2d::Music::close()
|
||||
{
|
||||
if (m_bPlaying)
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
if (m_dev)
|
||||
{
|
||||
_sendCommand(MCI_CLOSE);
|
||||
}
|
||||
|
||||
m_dev = 0;
|
||||
m_bPlaying = false;
|
||||
}
|
||||
|
||||
void e2d::Music::pause()
|
||||
{
|
||||
_sendCommand(MCI_PAUSE);
|
||||
m_bPlaying = false;
|
||||
}
|
||||
|
||||
void e2d::Music::resume()
|
||||
{
|
||||
_sendCommand(MCI_RESUME);
|
||||
m_bPlaying = true;
|
||||
}
|
||||
|
||||
void e2d::Music::stop()
|
||||
{
|
||||
_sendCommand(MCI_STOP);
|
||||
m_bPlaying = false;
|
||||
}
|
||||
|
||||
bool e2d::Music::isPlaying() const
|
||||
{
|
||||
return m_bPlaying;
|
||||
}
|
||||
|
||||
double Music::getVolume() const
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
bool Music::setVolume(double fVolume)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
double Music::getFrequencyRatio() const
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
bool Music::setFrequencyRatio(double fFrequencyRatio)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void e2d::Music::_sendCommand(int nCommand, DWORD_PTR param1, DWORD_PTR parma2)
|
||||
{
|
||||
// 空设备时忽略这次操作
|
||||
if (!m_dev)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// 向当前设备发送操作
|
||||
mciSendCommand(m_dev, nCommand, param1, parma2);
|
||||
}
|
||||
|
||||
|
||||
LRESULT WINAPI e2d::Music::MusicProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
e2d::Music * pPlayer = NULL;
|
||||
|
||||
if (Msg == MM_MCINOTIFY
|
||||
&& wParam == MCI_NOTIFY_SUCCESSFUL
|
||||
&& (pPlayer = (Music *)GetWindowLongPtr(hWnd, GWLP_USERDATA)))
|
||||
{
|
||||
if (pPlayer->m_nRepeatTimes > 0)
|
||||
{
|
||||
pPlayer->m_nRepeatTimes--;
|
||||
}
|
||||
|
||||
if (pPlayer->m_nRepeatTimes)
|
||||
{
|
||||
mciSendCommand(static_cast<MCIDEVICEID>(lParam), MCI_SEEK, MCI_SEEK_TO_START, 0);
|
||||
|
||||
MCI_PLAY_PARMS mciPlay = { 0 };
|
||||
mciPlay.dwCallback = reinterpret_cast<DWORD_PTR>(hWnd);
|
||||
mciSendCommand(static_cast<MCIDEVICEID>(lParam), MCI_PLAY, MCI_NOTIFY, reinterpret_cast<DWORD_PTR>(&mciPlay));
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->m_bPlaying = false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return DefWindowProc(hWnd, Msg, wParam, lParam);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -12,8 +12,8 @@
|
|||
#error 仅能在 C++ 环境下使用 Easy2D
|
||||
#endif
|
||||
|
||||
#if _MSC_VER < 1700
|
||||
#error Easy2D 不支持 Visual Studio 2012 以下版本
|
||||
#if _MSC_VER < 1600
|
||||
#error Easy2D 不支持 Visual Studio 2010 以下版本
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -152,17 +152,17 @@ class Input
|
|||
public:
|
||||
// 检测键盘某按键是否正被按下
|
||||
static bool isKeyDown(
|
||||
KeyCode nKeyCode
|
||||
int nKeyCode
|
||||
);
|
||||
|
||||
// 检测键盘某按键是否被点击
|
||||
static bool isKeyPress(
|
||||
KeyCode nKeyCode
|
||||
int nKeyCode
|
||||
);
|
||||
|
||||
// 检测键盘某按键是否正在松开
|
||||
static bool isKeyRelease(
|
||||
KeyCode nKeyCode
|
||||
int nKeyCode
|
||||
);
|
||||
|
||||
// 检测鼠标左键是否正被按下
|
||||
|
|
|
|||
176
core/ecommon.h
176
core/ecommon.h
|
|
@ -135,10 +135,12 @@ public:
|
|||
// 将字符串转化为 bool 型
|
||||
bool toBool() const;
|
||||
|
||||
// 将数字转化为字符串
|
||||
template<typename T>
|
||||
static String toString(T value);
|
||||
// 数字类型转字符串
|
||||
static String parse(int value);
|
||||
static String parse(float value);
|
||||
static String parse(double value);
|
||||
|
||||
// 格式化字符串
|
||||
String& format(const char * format, ...);
|
||||
String& format(const wchar_t * format, ...);
|
||||
|
||||
|
|
@ -182,7 +184,6 @@ public:
|
|||
String& operator<< (const wchar_t *);
|
||||
String& operator<< (wchar_t *);
|
||||
String& operator<< (int value);
|
||||
String& operator<< (unsigned int value);
|
||||
String& operator<< (float value);
|
||||
String& operator<< (double value);
|
||||
|
||||
|
|
@ -300,93 +301,109 @@ public:
|
|||
|
||||
|
||||
// 文本对齐方式
|
||||
enum class TextAlign : int
|
||||
class TextAlign
|
||||
{
|
||||
LEFT, /* 左对齐 */
|
||||
RIGHT, /* 右对齐 */
|
||||
CENTER /* 居中对齐 */
|
||||
public:
|
||||
enum : int
|
||||
{
|
||||
LEFT, /* 左对齐 */
|
||||
RIGHT, /* 右对齐 */
|
||||
CENTER /* 居中对齐 */
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// 键值集合
|
||||
enum class KeyCode : int
|
||||
class KeyCode
|
||||
{
|
||||
UP = 0xC8,
|
||||
LEFT = 0xCB,
|
||||
RIGHT = 0xCD,
|
||||
DOWN = 0xD0,
|
||||
ENTER = 0x1C,
|
||||
SPACE = 0x39,
|
||||
ESC = 0x01,
|
||||
BACK = 0x0E,
|
||||
TAB = 0x0F,
|
||||
PAUSE = 0xC5,
|
||||
Q = 0x10,
|
||||
W = 0x11,
|
||||
E = 0x12,
|
||||
R = 0x13,
|
||||
T = 0x14,
|
||||
Y = 0x15,
|
||||
U = 0x16,
|
||||
I = 0x17,
|
||||
O = 0x18,
|
||||
P = 0x19,
|
||||
A = 0x1E,
|
||||
S = 0x1F,
|
||||
D = 0x20,
|
||||
F = 0x21,
|
||||
G = 0x22,
|
||||
H = 0x23,
|
||||
J = 0x24,
|
||||
K = 0x25,
|
||||
L = 0x26,
|
||||
Z = 0x2C,
|
||||
X = 0x2D,
|
||||
C = 0x2E,
|
||||
V = 0x2F,
|
||||
B = 0x30,
|
||||
N = 0x31,
|
||||
M = 0x32,
|
||||
NUM1 = 0x02,
|
||||
NUM2 = 0x03,
|
||||
NUM3 = 0x04,
|
||||
NUM4 = 0x05,
|
||||
NUM5 = 0x06,
|
||||
NUM6 = 0x07,
|
||||
NUM7 = 0x08,
|
||||
NUM8 = 0x09,
|
||||
NUM9 = 0x0A,
|
||||
NUM0 = 0x0B,
|
||||
NUMPAD7 = 0x47,
|
||||
NUMPAD8 = 0x48,
|
||||
NUMPAD9 = 0x49,
|
||||
NUMPAD4 = 0x4B,
|
||||
NUMPAD5 = 0x4C,
|
||||
NUMPAD6 = 0x4D,
|
||||
NUMPAD1 = 0x4F,
|
||||
NUMPAD2 = 0x50,
|
||||
NUMPAD3 = 0x51,
|
||||
NUMPAD0 = 0x52
|
||||
public:
|
||||
enum : int
|
||||
{
|
||||
UP = 0xC8,
|
||||
LEFT = 0xCB,
|
||||
RIGHT = 0xCD,
|
||||
DOWN = 0xD0,
|
||||
ENTER = 0x1C,
|
||||
SPACE = 0x39,
|
||||
ESC = 0x01,
|
||||
BACK = 0x0E,
|
||||
TAB = 0x0F,
|
||||
PAUSE = 0xC5,
|
||||
Q = 0x10,
|
||||
W = 0x11,
|
||||
E = 0x12,
|
||||
R = 0x13,
|
||||
T = 0x14,
|
||||
Y = 0x15,
|
||||
U = 0x16,
|
||||
I = 0x17,
|
||||
O = 0x18,
|
||||
P = 0x19,
|
||||
A = 0x1E,
|
||||
S = 0x1F,
|
||||
D = 0x20,
|
||||
F = 0x21,
|
||||
G = 0x22,
|
||||
H = 0x23,
|
||||
J = 0x24,
|
||||
K = 0x25,
|
||||
L = 0x26,
|
||||
Z = 0x2C,
|
||||
X = 0x2D,
|
||||
C = 0x2E,
|
||||
V = 0x2F,
|
||||
B = 0x30,
|
||||
N = 0x31,
|
||||
M = 0x32,
|
||||
NUM1 = 0x02,
|
||||
NUM2 = 0x03,
|
||||
NUM3 = 0x04,
|
||||
NUM4 = 0x05,
|
||||
NUM5 = 0x06,
|
||||
NUM6 = 0x07,
|
||||
NUM7 = 0x08,
|
||||
NUM8 = 0x09,
|
||||
NUM9 = 0x0A,
|
||||
NUM0 = 0x0B,
|
||||
NUMPAD7 = 0x47,
|
||||
NUMPAD8 = 0x48,
|
||||
NUMPAD9 = 0x49,
|
||||
NUMPAD4 = 0x4B,
|
||||
NUMPAD5 = 0x4C,
|
||||
NUMPAD6 = 0x4D,
|
||||
NUMPAD1 = 0x4F,
|
||||
NUMPAD2 = 0x50,
|
||||
NUMPAD3 = 0x51,
|
||||
NUMPAD0 = 0x52
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// 形状交集关系
|
||||
enum class Relation : int
|
||||
class Relation
|
||||
{
|
||||
UNKNOWN = 0, /* 关系不确定 */
|
||||
DISJOINT = 1, /* 没有交集 */
|
||||
IS_CONTAINED = 2, /* 完全被包含 */
|
||||
CONTAINS = 3, /* 完全包含 */
|
||||
OVERLAP = 4 /* 部分重叠 */
|
||||
public:
|
||||
enum : int
|
||||
{
|
||||
UNKNOWN = 0, /* 关系不确定 */
|
||||
DISJOINT = 1, /* 没有交集 */
|
||||
IS_CONTAINED = 2, /* 完全被包含 */
|
||||
CONTAINS = 3, /* 完全包含 */
|
||||
OVERLAP = 4 /* 部分重叠 */
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// 形状类别
|
||||
enum class Shape : int
|
||||
class Shape
|
||||
{
|
||||
RECTANGLE, /* 矩形 */
|
||||
CIRCLE, /* 圆形 */
|
||||
ELLIPSE /* 椭圆形 */
|
||||
public:
|
||||
enum : int
|
||||
{
|
||||
RECTANGLE, /* 矩形 */
|
||||
CIRCLE, /* 圆形 */
|
||||
ELLIPSE /* 椭圆形 */
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -604,15 +621,6 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
// String 类模板函数定义
|
||||
template<typename T>
|
||||
inline e2d::String e2d::String::toString(T value)
|
||||
{
|
||||
String tmp;
|
||||
tmp.m_str = std::to_wstring(value);
|
||||
return std::move(tmp);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void SafeDelete(T** p) { if (*p) { delete *p; *p = nullptr; } }
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#endif
|
||||
|
||||
#define INITGUID
|
||||
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
#include <wincodec.h>
|
||||
|
|
@ -35,7 +37,6 @@
|
|||
#include <d2d1.h>
|
||||
#include <dwrite.h>
|
||||
#include <dinput.h>
|
||||
#include <xaudio2.h>
|
||||
#include <d2d1helper.h>
|
||||
|
||||
// C RunTime Header Files
|
||||
|
|
@ -45,16 +46,35 @@
|
|||
// Import Libraries
|
||||
#pragma comment(lib, "d2d1.lib")
|
||||
#pragma comment(lib, "dwrite.lib")
|
||||
#pragma comment(lib, "xaudio2.lib")
|
||||
#pragma comment(lib, "windowscodecs.lib")
|
||||
#pragma comment(lib, "winmm.lib")
|
||||
|
||||
#if _MSC_VER > 1600
|
||||
#include <xaudio2.h>
|
||||
#pragma comment(lib, "xaudio2.lib")
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HINST_THISCOMPONENT
|
||||
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
|
||||
#define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)
|
||||
#endif
|
||||
|
||||
#define MUSIC_CLASS_NAME L"Easy2DMusicCallbackWnd"
|
||||
|
||||
|
||||
#if _MSC_VER > 1700
|
||||
#define HIGHER_THAN_VS2012 1
|
||||
#else
|
||||
#define HIGHER_THAN_VS2012 0
|
||||
#endif
|
||||
|
||||
#if _MSC_VER > 1600
|
||||
#define HIGHER_THAN_VS2010 1
|
||||
#else
|
||||
#define HIGHER_THAN_VS2010 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef ASSERT
|
||||
#if defined( DEBUG ) || defined( _DEBUG )
|
||||
|
|
@ -73,8 +93,9 @@ EXTERN_C IMAGE_DOS_HEADER __ImageBase;
|
|||
#endif
|
||||
|
||||
|
||||
#if _MSC_VER > 1700
|
||||
#define HIGHER_THAN_VS2012 1
|
||||
#if HIGHER_THAN_VS2010
|
||||
#define FOR_LOOP(i, container) for (auto i : (container))
|
||||
#else
|
||||
#define HIGHER_THAN_VS2012 0
|
||||
#define FOR_LOOP(i, container) auto i = (container.begin() == container.end()) ? NULL : (*(container.begin())); \
|
||||
for (auto __iter__=(container.begin()); (__iter__ != (container.end())) && (i = (*__iter__)); __iter__++)
|
||||
#endif
|
||||
|
|
@ -280,12 +280,21 @@ public:
|
|||
// 停止所有音乐
|
||||
static void stopAll();
|
||||
|
||||
#if HIGHER_THAN_VS2010
|
||||
|
||||
// 获取 IXAudio2 对象
|
||||
static IXAudio2 * getIXAudio2();
|
||||
|
||||
// 获取 IXAudio2MasteringVoice 对象
|
||||
static IXAudio2MasteringVoice * getIXAudio2MasteringVoice();
|
||||
|
||||
#else
|
||||
|
||||
// ťńČĄ HINSTANCE
|
||||
static HINSTANCE getHInstance();
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
// 初始化 XAudio2
|
||||
static bool __init();
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ public:
|
|||
|
||||
// 设置节点形状
|
||||
virtual void setShape(
|
||||
Shape type
|
||||
int type
|
||||
);
|
||||
|
||||
// 设置节点形状
|
||||
|
|
@ -627,7 +627,7 @@ public:
|
|||
|
||||
// 设置对齐方式(默认为 TextAlign::LEFT)
|
||||
void setAlignment(
|
||||
TextAlign nAlign
|
||||
int nAlign
|
||||
);
|
||||
|
||||
// 设置下划线(默认值为 false)
|
||||
|
|
@ -659,7 +659,7 @@ protected:
|
|||
float m_fWrappingWidth;
|
||||
Font m_Font;
|
||||
float m_fLineSpacing;
|
||||
TextAlign m_nAlign;
|
||||
int m_nAlign;
|
||||
IDWriteTextFormat * m_pDWriteTextFormat;
|
||||
IDWriteTextLayout * m_pDWriteTextLayout;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public:
|
|||
virtual ~ShapeBase();
|
||||
|
||||
// 判断两形状的交集关系
|
||||
virtual Relation getRelationWith(
|
||||
virtual int getRelationWith(
|
||||
ShapeBase * pShape
|
||||
) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ public:
|
|||
void close();
|
||||
|
||||
// 获取音乐播放状态
|
||||
bool isPlaying();
|
||||
bool isPlaying() const;
|
||||
|
||||
// 获取音量
|
||||
double getVolume() const;
|
||||
|
|
@ -372,7 +372,7 @@ public:
|
|||
|
||||
// 设置音量
|
||||
bool setVolume(
|
||||
double fVolume /* 音量范围为 -224 ~ 224,其中 0 是静音,1 是正常音量 */
|
||||
double fVolume /* 音量范围为 -224 ~ 224,其中 0 是静音,1 是正常音量 */
|
||||
);
|
||||
|
||||
// 设置频率比
|
||||
|
|
@ -380,6 +380,8 @@ public:
|
|||
double fFrequencyRatio /* 频率比范围为 1/1024.0f ~ 1024.0f,其中 1.0 为正常声调 */
|
||||
);
|
||||
|
||||
#if HIGHER_THAN_VS2010
|
||||
|
||||
// 获取 IXAudio2SourceVoice 对象
|
||||
IXAudio2SourceVoice* getIXAudio2SourceVoice() const;
|
||||
|
||||
|
|
@ -401,7 +403,7 @@ protected:
|
|||
|
||||
protected:
|
||||
bool m_bOpened;
|
||||
bool m_bPlaying;
|
||||
mutable bool m_bPlaying;
|
||||
DWORD m_dwSize;
|
||||
CHAR* m_pResourceBuffer;
|
||||
BYTE* m_pbWaveData;
|
||||
|
|
@ -410,6 +412,22 @@ protected:
|
|||
MMCKINFO m_ckRiff;
|
||||
WAVEFORMATEX* m_pwfx;
|
||||
IXAudio2SourceVoice* m_pSourceVoice;
|
||||
|
||||
#else
|
||||
|
||||
protected:
|
||||
void _sendCommand(int nCommand, DWORD_PTR param1 = 0, DWORD_PTR parma2 = 0);
|
||||
|
||||
static LRESULT WINAPI MusicProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
protected:
|
||||
MCIDEVICEID m_dev;
|
||||
HWND m_wnd;
|
||||
UINT m_nMusicID;
|
||||
bool m_bPlaying;
|
||||
int m_nRepeatTimes;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Easy2D", "Easy2D.vcxproj", "{47AF11E1-8725-4ECA-B8CF-951ABC397B31}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{47AF11E1-8725-4ECA-B8CF-951ABC397B31}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{47AF11E1-8725-4ECA-B8CF-951ABC397B31}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{47AF11E1-8725-4ECA-B8CF-951ABC397B31}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{47AF11E1-8725-4ECA-B8CF-951ABC397B31}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\core\Action\Action.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\ActionDelay.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\ActionFunc.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\ActionGradual.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\ActionLoop.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\ActionMoveBy.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\ActionMoveTo.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\ActionOpacityBy.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\ActionOpacityTo.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\ActionRotateBy.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\ActionRotateTo.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\ActionScaleBy.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\ActionScaleTo.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\ActionSequence.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\ActionTwo.cpp" />
|
||||
<ClCompile Include="..\..\core\Action\Animation.cpp" />
|
||||
<ClCompile Include="..\..\core\Base\Game.cpp" />
|
||||
<ClCompile Include="..\..\core\Base\Input.cpp" />
|
||||
<ClCompile Include="..\..\core\Base\Renderer.cpp" />
|
||||
<ClCompile Include="..\..\core\Base\Time.cpp" />
|
||||
<ClCompile Include="..\..\core\Base\Window.cpp" />
|
||||
<ClCompile Include="..\..\core\Common\Font.cpp" />
|
||||
<ClCompile Include="..\..\core\Common\Image.cpp" />
|
||||
<ClCompile Include="..\..\core\Common\Object.cpp" />
|
||||
<ClCompile Include="..\..\core\Common\Point.cpp" />
|
||||
<ClCompile Include="..\..\core\Common\Scene.cpp" />
|
||||
<ClCompile Include="..\..\core\Common\Size.cpp" />
|
||||
<ClCompile Include="..\..\core\Common\String.cpp" />
|
||||
<ClCompile Include="..\..\core\Manager\ActionManager.cpp" />
|
||||
<ClCompile Include="..\..\core\Manager\CollisionManager.cpp" />
|
||||
<ClCompile Include="..\..\core\Manager\InputManager.cpp" />
|
||||
<ClCompile Include="..\..\core\Manager\MusicManager.cpp" />
|
||||
<ClCompile Include="..\..\core\Manager\ObjectManager.cpp" />
|
||||
<ClCompile Include="..\..\core\Manager\SceneManager.cpp" />
|
||||
<ClCompile Include="..\..\core\Manager\TimerManager.cpp" />
|
||||
<ClCompile Include="..\..\core\Node\Button.cpp" />
|
||||
<ClCompile Include="..\..\core\Node\ButtonToggle.cpp" />
|
||||
<ClCompile Include="..\..\core\Node\Menu.cpp" />
|
||||
<ClCompile Include="..\..\core\Node\Node.cpp" />
|
||||
<ClCompile Include="..\..\core\Node\Sprite.cpp" />
|
||||
<ClCompile Include="..\..\core\Node\Text.cpp" />
|
||||
<ClCompile Include="..\..\core\Shape\ShapeBase.cpp" />
|
||||
<ClCompile Include="..\..\core\Shape\ShapeCircle.cpp" />
|
||||
<ClCompile Include="..\..\core\Shape\ShapeEllipse.cpp" />
|
||||
<ClCompile Include="..\..\core\Shape\ShapeRectangle.cpp" />
|
||||
<ClCompile Include="..\..\core\Tool\CollisionListener.cpp" />
|
||||
<ClCompile Include="..\..\core\Tool\Data.cpp" />
|
||||
<ClCompile Include="..\..\core\Tool\InputListener.cpp" />
|
||||
<ClCompile Include="..\..\core\Tool\Listener.cpp" />
|
||||
<ClCompile Include="..\..\core\Tool\Music.cpp" />
|
||||
<ClCompile Include="..\..\core\Tool\Path.cpp" />
|
||||
<ClCompile Include="..\..\core\Tool\Random.cpp" />
|
||||
<ClCompile Include="..\..\core\Tool\Timer.cpp" />
|
||||
<ClCompile Include="..\..\core\Transition\Transition.cpp" />
|
||||
<ClCompile Include="..\..\core\Transition\TransitionEmerge.cpp" />
|
||||
<ClCompile Include="..\..\core\Transition\TransitionFade.cpp" />
|
||||
<ClCompile Include="..\..\core\Transition\TransitionMove.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\core\eactions.h" />
|
||||
<ClInclude Include="..\..\core\easy2d.h" />
|
||||
<ClInclude Include="..\..\core\ebase.h" />
|
||||
<ClInclude Include="..\..\core\ecommon.h" />
|
||||
<ClInclude Include="..\..\core\emacros.h" />
|
||||
<ClInclude Include="..\..\core\emanagers.h" />
|
||||
<ClInclude Include="..\..\core\enodes.h" />
|
||||
<ClInclude Include="..\..\core\eshape.h" />
|
||||
<ClInclude Include="..\..\core\etools.h" />
|
||||
<ClInclude Include="..\..\core\etransitions.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{47AF11E1-8725-4ECA-B8CF-951ABC397B31}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>Easy2D</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<TargetName>Easy2Dw</TargetName>
|
||||
<OutDir>$(SolutionDir)$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<TargetName>Easy2Ddw</TargetName>
|
||||
<OutDir>$(SolutionDir)$(Platform)\</OutDir>
|
||||
<IntDir>$(Configuration)\$(Platform)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,214 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Action">
|
||||
<UniqueIdentifier>{5be538cb-a432-4f84-9678-bbf408eca288}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Base">
|
||||
<UniqueIdentifier>{d4a509dd-1bc0-4456-9554-d414de91b50c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Common">
|
||||
<UniqueIdentifier>{c907d829-e510-472c-bd47-cf4eab6f9266}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Manager">
|
||||
<UniqueIdentifier>{7b102f67-5905-4c0e-8400-51c128da026a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Node">
|
||||
<UniqueIdentifier>{c536c42c-283d-4a10-b19b-0699b4f1e051}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Tool">
|
||||
<UniqueIdentifier>{17bdc67b-1801-4b69-b79b-ffcbbee8dae0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Transition">
|
||||
<UniqueIdentifier>{6c760a81-9bc8-4fb0-a145-8e119b783365}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Shape">
|
||||
<UniqueIdentifier>{508b39c8-a430-45c3-9405-364fbc281220}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\core\Action\Action.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\ActionDelay.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\ActionFunc.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\ActionGradual.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\ActionLoop.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\ActionMoveBy.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\ActionMoveTo.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\ActionOpacityBy.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\ActionOpacityTo.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\ActionRotateBy.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\ActionRotateTo.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\ActionScaleBy.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\ActionScaleTo.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\ActionSequence.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\ActionTwo.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Action\Animation.cpp">
|
||||
<Filter>Action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Base\Game.cpp">
|
||||
<Filter>Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Base\Input.cpp">
|
||||
<Filter>Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Base\Renderer.cpp">
|
||||
<Filter>Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Base\Time.cpp">
|
||||
<Filter>Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Base\Window.cpp">
|
||||
<Filter>Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Common\Font.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Common\Image.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Common\Object.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Common\Point.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Common\Scene.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Common\Size.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Common\String.cpp">
|
||||
<Filter>Common</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Shape\ShapeBase.cpp">
|
||||
<Filter>Shape</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Shape\ShapeCircle.cpp">
|
||||
<Filter>Shape</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Shape\ShapeEllipse.cpp">
|
||||
<Filter>Shape</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Shape\ShapeRectangle.cpp">
|
||||
<Filter>Shape</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Manager\ActionManager.cpp">
|
||||
<Filter>Manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Manager\CollisionManager.cpp">
|
||||
<Filter>Manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Manager\InputManager.cpp">
|
||||
<Filter>Manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Manager\MusicManager.cpp">
|
||||
<Filter>Manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Manager\ObjectManager.cpp">
|
||||
<Filter>Manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Manager\SceneManager.cpp">
|
||||
<Filter>Manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Manager\TimerManager.cpp">
|
||||
<Filter>Manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Node\Button.cpp">
|
||||
<Filter>Node</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Node\ButtonToggle.cpp">
|
||||
<Filter>Node</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Node\Menu.cpp">
|
||||
<Filter>Node</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Node\Node.cpp">
|
||||
<Filter>Node</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Node\Sprite.cpp">
|
||||
<Filter>Node</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Node\Text.cpp">
|
||||
<Filter>Node</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Tool\CollisionListener.cpp">
|
||||
<Filter>Tool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Tool\Data.cpp">
|
||||
<Filter>Tool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Tool\InputListener.cpp">
|
||||
<Filter>Tool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Tool\Listener.cpp">
|
||||
<Filter>Tool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Tool\Music.cpp">
|
||||
<Filter>Tool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Tool\Path.cpp">
|
||||
<Filter>Tool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Tool\Random.cpp">
|
||||
<Filter>Tool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Tool\Timer.cpp">
|
||||
<Filter>Tool</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Transition\Transition.cpp">
|
||||
<Filter>Transition</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Transition\TransitionEmerge.cpp">
|
||||
<Filter>Transition</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Transition\TransitionFade.cpp">
|
||||
<Filter>Transition</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\core\Transition\TransitionMove.cpp">
|
||||
<Filter>Transition</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\core\eactions.h" />
|
||||
<ClInclude Include="..\..\core\easy2d.h" />
|
||||
<ClInclude Include="..\..\core\ebase.h" />
|
||||
<ClInclude Include="..\..\core\ecommon.h" />
|
||||
<ClInclude Include="..\..\core\emacros.h" />
|
||||
<ClInclude Include="..\..\core\emanagers.h" />
|
||||
<ClInclude Include="..\..\core\enodes.h" />
|
||||
<ClInclude Include="..\..\core\eshape.h" />
|
||||
<ClInclude Include="..\..\core\etools.h" />
|
||||
<ClInclude Include="..\..\core\etransitions.h" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Loading…
Reference in New Issue