适应vs2015
This commit is contained in:
parent
bb6d71a1b0
commit
8da04219bf
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
|
@ -23,13 +23,13 @@
|
||||||
<ProjectGuid>{9D85A92F-BCCE-4EF0-BAD3-601C0086661C}</ProjectGuid>
|
<ProjectGuid>{9D85A92F-BCCE-4EF0-BAD3-601C0086661C}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>Demo</RootNamespace>
|
<RootNamespace>Demo</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,13 @@
|
||||||
<ProjectGuid>{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}</ProjectGuid>
|
<ProjectGuid>{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>Easy2D</RootNamespace>
|
<RootNamespace>Easy2D</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
|
|
||||||
|
|
@ -1 +1,69 @@
|
||||||
#include "..\etools.h"
|
#include "..\etools.h"
|
||||||
|
|
||||||
|
e2d::EMouseListener::EMouseListener()
|
||||||
|
: m_bRunning(false)
|
||||||
|
, m_bWaiting(false)
|
||||||
|
, m_sName(L"")
|
||||||
|
, m_callback([] {})
|
||||||
|
, m_pParentScene(nullptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
e2d::EMouseListener::EMouseListener(EString name)
|
||||||
|
: EMouseListener()
|
||||||
|
{
|
||||||
|
m_sName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
e2d::EMouseListener::EMouseListener(const MOUSE_CALLBACK & callback)
|
||||||
|
: EMouseListener()
|
||||||
|
{
|
||||||
|
m_callback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
e2d::EMouseListener::EMouseListener(EString name, const MOUSE_CALLBACK & callback)
|
||||||
|
: EMouseListener()
|
||||||
|
{
|
||||||
|
m_sName = name;
|
||||||
|
m_callback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool e2d::EMouseListener::isRunnint() const
|
||||||
|
{
|
||||||
|
return m_bRunning && !m_bWaiting;
|
||||||
|
}
|
||||||
|
|
||||||
|
void e2d::EMouseListener::start()
|
||||||
|
{
|
||||||
|
m_bRunning = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void e2d::EMouseListener::stop()
|
||||||
|
{
|
||||||
|
m_bRunning = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void e2d::EMouseListener::wait()
|
||||||
|
{
|
||||||
|
m_bWaiting = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void e2d::EMouseListener::notify()
|
||||||
|
{
|
||||||
|
m_bWaiting = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void e2d::EMouseListener::runCallback()
|
||||||
|
{
|
||||||
|
m_callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
e2d::EString e2d::EMouseListener::getName() const
|
||||||
|
{
|
||||||
|
return m_sName;
|
||||||
|
}
|
||||||
|
|
||||||
|
e2d::EScene * e2d::EMouseListener::getParentScene()
|
||||||
|
{
|
||||||
|
return m_pParentScene;
|
||||||
|
}
|
||||||
|
|
@ -166,8 +166,9 @@ protected:
|
||||||
|
|
||||||
class EScene
|
class EScene
|
||||||
{
|
{
|
||||||
public:
|
friend EApp;
|
||||||
|
|
||||||
|
public:
|
||||||
EScene();
|
EScene();
|
||||||
|
|
||||||
~EScene();
|
~EScene();
|
||||||
|
|
@ -200,7 +201,6 @@ public:
|
||||||
void clearAllChildren();
|
void clearAllChildren();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend EApp;
|
|
||||||
std::vector<e2d::ENode*> m_vChildren;
|
std::vector<e2d::ENode*> m_vChildren;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -213,6 +213,8 @@ protected:
|
||||||
|
|
||||||
class EObject
|
class EObject
|
||||||
{
|
{
|
||||||
|
friend EObjectManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EObject();
|
EObject();
|
||||||
|
|
||||||
|
|
@ -228,7 +230,6 @@ public:
|
||||||
void autoRelease();
|
void autoRelease();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend EObjectManager;
|
|
||||||
int m_nRefCount;
|
int m_nRefCount;
|
||||||
bool m_bManaged;
|
bool m_bManaged;
|
||||||
bool m_bAutoRelease;
|
bool m_bAutoRelease;
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,16 @@
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <atltypes.h>
|
#include <atltypes.h>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
namespace e2d
|
namespace e2d
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef std::wstring EString;
|
typedef std::wstring EString;
|
||||||
|
|
||||||
|
//typedef std::function<void(VK_KEY)> KEY_CALLBACK;
|
||||||
|
typedef std::function<void()> MOUSE_CALLBACK;
|
||||||
|
|
||||||
|
|
||||||
typedef CSize ESize;
|
typedef CSize ESize;
|
||||||
typedef CPoint EPoint;
|
typedef CPoint EPoint;
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,13 @@
|
||||||
namespace e2d
|
namespace e2d
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class EMsgManager;
|
||||||
|
|
||||||
|
|
||||||
class EObjectManager
|
class EObjectManager
|
||||||
{
|
{
|
||||||
|
friend EApp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// 将一个节点放入释放池
|
// 将一个节点放入释放池
|
||||||
static void add(
|
static void add(
|
||||||
|
|
@ -16,8 +21,6 @@ public:
|
||||||
static void clearAllObjects();
|
static void clearAllObjects();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend EApp;
|
|
||||||
|
|
||||||
// 刷新内存池
|
// 刷新内存池
|
||||||
static void __flush();
|
static void __flush();
|
||||||
};
|
};
|
||||||
|
|
@ -54,15 +57,67 @@ public:
|
||||||
class EMouseListener :
|
class EMouseListener :
|
||||||
public EObject
|
public EObject
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
friend EMsgManager;
|
friend EMsgManager;
|
||||||
e2d::EString name;
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
EMouseListener();
|
||||||
|
|
||||||
|
EMouseListener(
|
||||||
|
EString name
|
||||||
|
);
|
||||||
|
|
||||||
|
EMouseListener(
|
||||||
|
const MOUSE_CALLBACK &callback
|
||||||
|
);
|
||||||
|
|
||||||
|
EMouseListener(
|
||||||
|
EString name,
|
||||||
|
const MOUSE_CALLBACK &callback
|
||||||
|
);
|
||||||
|
|
||||||
|
// 获取监听器状态
|
||||||
|
bool isRunnint() const;
|
||||||
|
|
||||||
|
// 启动监听
|
||||||
|
void start();
|
||||||
|
|
||||||
|
// 停止监听
|
||||||
|
void stop();
|
||||||
|
|
||||||
|
// 进入等待状态
|
||||||
|
void wait();
|
||||||
|
|
||||||
|
// 唤醒
|
||||||
|
void notify();
|
||||||
|
|
||||||
|
// 执行监听器回调函数
|
||||||
|
void runCallback();
|
||||||
|
|
||||||
|
// 获取监听器名称
|
||||||
|
EString getName() const;
|
||||||
|
|
||||||
|
// 获取监听器所在场景
|
||||||
|
EScene * getParentScene();
|
||||||
|
|
||||||
|
// 设置监听器名称
|
||||||
|
void setName(EString name);
|
||||||
|
|
||||||
|
// 设置监听器回调函数
|
||||||
|
void setCallback(const MOUSE_CALLBACK &callback);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EString m_sName;
|
||||||
|
bool m_bRunning;
|
||||||
|
bool m_bWaiting;
|
||||||
|
MOUSE_CALLBACK m_callback;
|
||||||
|
EScene * m_pParentScene;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class EMsgManager
|
class EMsgManager
|
||||||
{
|
{
|
||||||
|
friend EApp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void setMouseMsg(
|
static void setMouseMsg(
|
||||||
UINT message
|
UINT message
|
||||||
|
|
@ -75,7 +130,6 @@ public:
|
||||||
);
|
);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend EApp;
|
|
||||||
|
|
||||||
static void __exec();
|
static void __exec();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue