Path类细节调整
This commit is contained in:
		
							parent
							
								
									8c246df955
								
							
						
					
					
						commit
						17d73916ba
					
				|  | @ -28,7 +28,7 @@ e2d::Animation::~Animation() | |||
| 
 | ||||
| void e2d::Animation::setInterval(double interval) | ||||
| { | ||||
| 	_interval = max(interval, 0); | ||||
| 	_interval = std::max(interval, 0.0); | ||||
| } | ||||
| 
 | ||||
| void e2d::Animation::onDestroy() | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ | |||
| 
 | ||||
| e2d::Delay::Delay(double duration) | ||||
| 	: _delta(0) | ||||
| 	, _delay(max(duration, 0)) | ||||
| 	, _delay(std::max(duration, 0.0)) | ||||
| { | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ | |||
| 
 | ||||
| e2d::FiniteTimeAction::FiniteTimeAction(double duration) | ||||
| 	: _delta(0) | ||||
| 	, _duration(max(duration, 0)) | ||||
| 	, _duration(std::max(duration, 0.0)) | ||||
| { | ||||
| } | ||||
| 
 | ||||
|  | @ -28,7 +28,7 @@ void e2d::FiniteTimeAction::_update() | |||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		_delta = min((Time::getTotalTime() - _last) / _duration, 1); | ||||
| 		_delta = std::min((Time::getTotalTime() - _last) / _duration, 1.0); | ||||
| 
 | ||||
| 		if (_delta >= 1) | ||||
| 		{ | ||||
|  |  | |||
|  | @ -62,13 +62,6 @@ bool e2d::Game::init() | |||
| 		throw SystemException(L"初始化 DirectInput 组件失败"); | ||||
| 	} | ||||
| 
 | ||||
| 	// 初始化路径
 | ||||
| 	if (!Path::__init()) | ||||
| 	{ | ||||
| 		DestroyResources(); | ||||
| 		throw SystemException(L"必要系统路径访问失败"); | ||||
| 	} | ||||
| 
 | ||||
| 	// 初始化成功
 | ||||
| 	_initialized = true; | ||||
| 
 | ||||
|  |  | |||
|  | @ -234,8 +234,8 @@ void e2d::Window::setSize(int width, int height) | |||
| 		// 当输入的窗口大小比分辨率大时,给出警告
 | ||||
| 		WARN_IF(screenWidth < width || screenHeight < height, "The window is larger than screen!"); | ||||
| 		// 取最小值
 | ||||
| 		width = min(width, screenWidth); | ||||
| 		height = min(height, screenHeight); | ||||
| 		width = std::min(width, screenWidth); | ||||
| 		height = std::min(height, screenHeight); | ||||
| 		// 修改窗口大小,并设置窗口在屏幕居中
 | ||||
| 		::MoveWindow(_hWnd, (screenWidth - width) / 2, (screenHeight - height) / 2, width, height, TRUE); | ||||
| 	} | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ e2d::CircleCollider::CircleCollider(Point center, double radius) | |||
| e2d::CircleCollider::CircleCollider(Node * node) | ||||
| 	: _d2dCircle(nullptr) | ||||
| { | ||||
| 	double minSide = min(node->getRealWidth(), node->getRealHeight()); | ||||
| 	double minSide = std::min(node->getRealWidth(), node->getRealHeight()); | ||||
| 	this->setCircle( | ||||
| 		Point( | ||||
| 			node->getRealWidth() / 2, | ||||
|  | @ -50,7 +50,7 @@ void e2d::CircleCollider::_resize() | |||
| { | ||||
| 	if (_parentNode && _enable) | ||||
| 	{ | ||||
| 		double minSide = min(_parentNode->getRealWidth(), _parentNode->getRealHeight()); | ||||
| 		double minSide = std::min(_parentNode->getRealWidth(), _parentNode->getRealHeight()); | ||||
| 		this->setCircle( | ||||
| 			Point( | ||||
| 				_parentNode->getRealWidth() / 2, | ||||
|  |  | |||
|  | @ -81,10 +81,10 @@ void e2d::Image::crop(const Rect& cropRect) | |||
| { | ||||
| 	if (_bitmap) | ||||
| 	{ | ||||
| 		_cropRect.origin.x = min(max(cropRect.origin.x, 0), this->getSourceWidth()); | ||||
| 		_cropRect.origin.y = min(max(cropRect.origin.y, 0), this->getSourceHeight()); | ||||
| 		_cropRect.size.width = min(max(cropRect.size.width, 0), this->getSourceWidth() - cropRect.origin.x); | ||||
| 		_cropRect.size.height = min(max(cropRect.size.height, 0), this->getSourceHeight() - cropRect.origin.y); | ||||
| 		_cropRect.origin.x = std::min(std::max(cropRect.origin.x, 0.0), this->getSourceWidth()); | ||||
| 		_cropRect.origin.y = std::min(std::max(cropRect.origin.y, 0.0), this->getSourceHeight()); | ||||
| 		_cropRect.size.width = std::min(std::max(cropRect.size.width, 0.0), this->getSourceWidth() - cropRect.origin.x); | ||||
| 		_cropRect.size.height = std::min(std::max(cropRect.size.height, 0.0), this->getSourceHeight() - cropRect.origin.y); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -476,7 +476,7 @@ void e2d::Node::setOpacity(double opacity) | |||
| 	if (_realOpacity == opacity) | ||||
| 		return; | ||||
| 
 | ||||
| 	_displayOpacity = _realOpacity = min(max(float(opacity), 0), 1); | ||||
| 	_displayOpacity = _realOpacity = std::min(std::max(float(opacity), 0.f), 1.f); | ||||
| 	// 更新节点透明度
 | ||||
| 	_updateOpacity(); | ||||
| } | ||||
|  | @ -496,8 +496,8 @@ void e2d::Node::setPivot(double pivotX, double pivotY) | |||
| 	if (_pivotX == pivotX && _pivotY == pivotY) | ||||
| 		return; | ||||
| 
 | ||||
| 	_pivotX = min(max(float(pivotX), 0), 1); | ||||
| 	_pivotY = min(max(float(pivotY), 0), 1); | ||||
| 	_pivotX = std::min(std::max(float(pivotX), 0.f), 1.f); | ||||
| 	_pivotY = std::min(std::max(float(pivotY), 0.f), 1.f); | ||||
| 	_needTransform = true; | ||||
| } | ||||
| 
 | ||||
|  | @ -913,8 +913,8 @@ void e2d::Node::setAutoUpdate(bool bAutoUpdate) | |||
| 
 | ||||
| void e2d::Node::setDefaultPiovt(double defaultPiovtX, double defaultPiovtY) | ||||
| { | ||||
| 	s_fDefaultPiovtX = min(max(float(defaultPiovtX), 0), 1); | ||||
| 	s_fDefaultPiovtY = min(max(float(defaultPiovtY), 0), 1); | ||||
| 	s_fDefaultPiovtX = std::min(std::max(float(defaultPiovtX), 0.f), 1.f); | ||||
| 	s_fDefaultPiovtY = std::min(std::max(float(defaultPiovtY), 0.f), 1.f); | ||||
| } | ||||
| 
 | ||||
| void e2d::Node::setDefaultCollider(Collider::Type type) | ||||
|  |  | |||
|  | @ -92,8 +92,8 @@ void e2d::Sprite::crop(const Rect& cropRect) | |||
| { | ||||
| 	_image->crop(cropRect); | ||||
| 	Node::setSize( | ||||
| 		min(max(cropRect.size.width, 0), _image->getSourceWidth() - _image->getCropX()), | ||||
| 		min(max(cropRect.size.height, 0), _image->getSourceHeight() - _image->getCropY()) | ||||
| 		std::min(std::max(cropRect.size.width, 0.0), _image->getSourceWidth() - _image->getCropX()), | ||||
| 		std::min(std::max(cropRect.size.height, 0.0), _image->getSourceHeight() - _image->getCropY()) | ||||
| 	); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -218,7 +218,7 @@ void e2d::Text::setWrappingWidth(double wrappingWidth) | |||
| { | ||||
| 	if (_style.wrappingWidth != wrappingWidth) | ||||
| 	{ | ||||
| 		_style.wrappingWidth = max(wrappingWidth, 0); | ||||
| 		_style.wrappingWidth = std::max(wrappingWidth, 0.0); | ||||
| 
 | ||||
| 		if (_style.wrapping) | ||||
| 		{ | ||||
|  |  | |||
|  | @ -3,46 +3,46 @@ | |||
| 
 | ||||
| void e2d::Data::saveInt(const String& key, int value, const String& field) | ||||
| { | ||||
| 	::WritePrivateProfileString((LPCWSTR)field, (LPCWSTR)key, (LPCWSTR)String::parse(value), (LPCWSTR)Path::getDataSavePath()); | ||||
| 	::WritePrivateProfileString((LPCWSTR)field, (LPCWSTR)key, (LPCWSTR)String::parse(value), (LPCWSTR)Path::getDataPath()); | ||||
| } | ||||
| 
 | ||||
| void e2d::Data::saveDouble(const String& key, double value, const String& field) | ||||
| { | ||||
| 	::WritePrivateProfileString((LPCWSTR)field, (LPCWSTR)key, (LPCWSTR)String::parse(value), (LPCWSTR)Path::getDataSavePath()); | ||||
| 	::WritePrivateProfileString((LPCWSTR)field, (LPCWSTR)key, (LPCWSTR)String::parse(value), (LPCWSTR)Path::getDataPath()); | ||||
| } | ||||
| 
 | ||||
| void e2d::Data::saveBool(const String& key, bool value, const String& field) | ||||
| { | ||||
| 	::WritePrivateProfileString((LPCWSTR)field, (LPCWSTR)key, (value ? L"1" : L"0"), (LPCWSTR)Path::getDataSavePath()); | ||||
| 	::WritePrivateProfileString((LPCWSTR)field, (LPCWSTR)key, (value ? L"1" : L"0"), (LPCWSTR)Path::getDataPath()); | ||||
| } | ||||
| 
 | ||||
| void e2d::Data::saveString(const String& key, const String& value, const String& field) | ||||
| { | ||||
| 	::WritePrivateProfileString((LPCWSTR)field, (LPCWSTR)key, (LPCWSTR)value, (LPCWSTR)Path::getDataSavePath()); | ||||
| 	::WritePrivateProfileString((LPCWSTR)field, (LPCWSTR)key, (LPCWSTR)value, (LPCWSTR)Path::getDataPath()); | ||||
| } | ||||
| 
 | ||||
| int e2d::Data::getInt(const String& key, int defaultValue, const String& field) | ||||
| { | ||||
| 	return ::GetPrivateProfileInt((LPCWSTR)field, (LPCWSTR)key, defaultValue, (LPCWSTR)Path::getDataSavePath()); | ||||
| 	return ::GetPrivateProfileInt((LPCWSTR)field, (LPCWSTR)key, defaultValue, (LPCWSTR)Path::getDataPath()); | ||||
| } | ||||
| 
 | ||||
| double e2d::Data::getDouble(const String& key, double defaultValue, const String& field) | ||||
| { | ||||
| 	wchar_t temp[32] = { 0 }; | ||||
| 	::GetPrivateProfileString((LPCWSTR)field, (LPCWSTR)key, (LPCWSTR)String::parse(defaultValue), temp, 31, (LPCWSTR)Path::getDataSavePath()); | ||||
| 	::GetPrivateProfileString((LPCWSTR)field, (LPCWSTR)key, (LPCWSTR)String::parse(defaultValue), temp, 31, (LPCWSTR)Path::getDataPath()); | ||||
| 	return std::stof(temp); | ||||
| } | ||||
| 
 | ||||
| bool e2d::Data::getBool(const String& key, bool defaultValue, const String& field) | ||||
| { | ||||
| 	int nDefaultValue = defaultValue ? 1 : 0; | ||||
| 	int nValue = ::GetPrivateProfileInt((LPCWSTR)field, (LPCWSTR)key, nDefaultValue, (LPCWSTR)Path::getDataSavePath()); | ||||
| 	int nValue = ::GetPrivateProfileInt((LPCWSTR)field, (LPCWSTR)key, nDefaultValue, (LPCWSTR)Path::getDataPath()); | ||||
| 	return nValue != 0; | ||||
| } | ||||
| 
 | ||||
| e2d::String e2d::Data::getString(const String& key, const String& defaultValue, const String& field) | ||||
| { | ||||
| 	wchar_t temp[256] = { 0 }; | ||||
| 	::GetPrivateProfileString((LPCWSTR)field, (LPCWSTR)key, (LPCWSTR)defaultValue, temp, 255, (LPCWSTR)Path::getDataSavePath()); | ||||
| 	::GetPrivateProfileString((LPCWSTR)field, (LPCWSTR)key, (LPCWSTR)defaultValue, temp, 255, (LPCWSTR)Path::getDataPath()); | ||||
| 	return temp; | ||||
| } | ||||
|  | @ -247,7 +247,7 @@ bool e2d::Music::play(int nLoopCount) | |||
| 		stop(); | ||||
| 	} | ||||
| 
 | ||||
| 	nLoopCount = min(nLoopCount, XAUDIO2_LOOP_INFINITE - 1); | ||||
| 	nLoopCount = std::min(nLoopCount, XAUDIO2_LOOP_INFINITE - 1); | ||||
| 	nLoopCount = (nLoopCount < 0) ? XAUDIO2_LOOP_INFINITE : nLoopCount; | ||||
| 
 | ||||
| 	// 提交 wave 样本数据
 | ||||
|  |  | |||
|  | @ -1,70 +1,45 @@ | |||
| #include "..\e2dtool.h" | ||||
| #include <algorithm> | ||||
| #include <list> | ||||
| #include <commdlg.h> | ||||
| 
 | ||||
| #define DEFINE_KNOWN_FOLDER(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ | ||||
| 	EXTERN_C const GUID DECLSPEC_SELECTANY name \ | ||||
| 	= { l, w1, w2,{ b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } } | ||||
| 
 | ||||
| DEFINE_KNOWN_FOLDER(FOLDERID_LocalAppData, 0xF1B32785, 0x6FBA, 0x4FCF, 0x9D, 0x55, 0x7B, 0x8E, 0x7F, 0x15, 0x70, 0x91); | ||||
| extern "C" const GUID DECLSPEC_SELECTANY FOLDERID_LocalAppData = {  | ||||
| 	0xF1B32785, 0x6FBA, 0x4FCF, { 0x9D, 0x55, 0x7B, 0x8E, 0x7F, 0x15, 0x70, 0x91 } | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| static e2d::String s_sLocalAppDataPath; | ||||
| static e2d::String s_sTempPath; | ||||
| static e2d::String s_sDataSavePath; | ||||
| static std::list<e2d::String> s_vPathList; | ||||
| e2d::String				e2d::Path::_tempPath; | ||||
| e2d::String				e2d::Path::_dataPath; | ||||
| std::list<e2d::String>	e2d::Path::_paths; | ||||
| 
 | ||||
| bool e2d::Path::__init() | ||||
| { | ||||
| 	// 获取 AppData\Local 文件夹的路径
 | ||||
| 	typedef HRESULT(WINAPI* pFunSHGetKnownFolderPath)(const GUID& rfid, DWORD dwFlags, HANDLE hToken, PWSTR *ppszPath); | ||||
| 
 | ||||
| 	PWSTR pszPath = nullptr; | ||||
| 	HMODULE hModule = LoadLibrary(L"shell32.dll"); | ||||
| 	pFunSHGetKnownFolderPath SHGetKnownFolderPath = (pFunSHGetKnownFolderPath)GetProcAddress(hModule, "SHGetKnownFolderPath"); | ||||
| 	HRESULT hr = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &pszPath); | ||||
| 
 | ||||
| 	if (SUCCEEDED(hr)) | ||||
| 	{ | ||||
| 		s_sLocalAppDataPath = pszPath; | ||||
| 		CoTaskMemFree(pszPath); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		WARN("Get local AppData path failed!"); | ||||
| 		return false; | ||||
| 	} | ||||
| 
 | ||||
| 	return true; | ||||
| } | ||||
| 
 | ||||
| void e2d::Path::setGameFolderName(const String & name) | ||||
| { | ||||
| 	if (name.isEmpty()) | ||||
| 		return; | ||||
| 
 | ||||
| 	// 获取数据的默认保存路径
 | ||||
| 	if (!s_sLocalAppDataPath.isEmpty()) | ||||
| 	// 设置数据的默认保存路径
 | ||||
| 	String localAppDataPath = Path::getLocalAppDataPath(); | ||||
| 	if (!localAppDataPath.isEmpty()) | ||||
| 	{ | ||||
| 		s_sDataSavePath = s_sLocalAppDataPath + L"\\Easy2DGameData\\" << name << L"\\"; | ||||
| 		_dataPath = localAppDataPath + L"\\Easy2DGameData\\" << name << L"\\"; | ||||
| 		 | ||||
| 		if (!Path::exists(s_sDataSavePath) && !Path::createFolder(s_sDataSavePath)) | ||||
| 		if (!Path::exists(_dataPath) && !Path::createFolder(_dataPath)) | ||||
| 		{ | ||||
| 			s_sDataSavePath = L""; | ||||
| 			_dataPath = L""; | ||||
| 		} | ||||
| 		s_sDataSavePath << L"Data.ini"; | ||||
| 		_dataPath << L"Data.ini"; | ||||
| 	} | ||||
| 
 | ||||
| 	// 获取临时文件目录
 | ||||
| 	// 设置临时文件保存路径
 | ||||
| 	wchar_t path[_MAX_PATH]; | ||||
| 	if (0 != ::GetTempPath(_MAX_PATH, path)) | ||||
| 	{ | ||||
| 		s_sTempPath << path << L"\\Easy2DGameTemp\\" << name << L"\\"; | ||||
| 		_tempPath << path << L"\\Easy2DGameTemp\\" << name << L"\\"; | ||||
| 
 | ||||
| 		if (!Path::exists(s_sTempPath) && !Path::createFolder(s_sTempPath)) | ||||
| 		if (!Path::exists(_tempPath) && !Path::createFolder(_tempPath)) | ||||
| 		{ | ||||
| 			s_sTempPath = L""; | ||||
| 			_tempPath = L""; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | @ -76,19 +51,42 @@ void e2d::Path::addSearchPath(String path) | |||
| 	{ | ||||
| 		path << L"\\"; | ||||
| 	} | ||||
| 	auto iter = std::find(s_vPathList.cbegin(), s_vPathList.cend(), path); | ||||
| 	if (iter == s_vPathList.cend()) | ||||
| 	auto iter = std::find(_paths.cbegin(), _paths.cend(), path); | ||||
| 	if (iter == _paths.cend()) | ||||
| 	{ | ||||
| 		s_vPathList.push_front(path); | ||||
| 		_paths.push_front(path); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| e2d::String e2d::Path::getTempPath() | ||||
| { | ||||
| 	return s_sTempPath; | ||||
| 	return _tempPath; | ||||
| } | ||||
| 
 | ||||
| e2d::String e2d::Path::getExecutableFilePath() | ||||
| e2d::String e2d::Path::getLocalAppDataPath() | ||||
| { | ||||
| 	static String localAppDataPath; | ||||
| 	if (localAppDataPath.isEmpty()) | ||||
| 	{ | ||||
| 		// 获取 AppData/Local 文件夹的路径
 | ||||
| 		typedef HRESULT(WINAPI* pFunSHGetKnownFolderPath)(const GUID& rfid, DWORD dwFlags, HANDLE hToken, PWSTR *ppszPath); | ||||
| 
 | ||||
| 		PWSTR pszPath = nullptr; | ||||
| 		HMODULE hModule = LoadLibrary(L"shell32.dll"); | ||||
| 		pFunSHGetKnownFolderPath SHGetKnownFolderPath = (pFunSHGetKnownFolderPath)GetProcAddress(hModule, "SHGetKnownFolderPath"); | ||||
| 		HRESULT hr = SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, nullptr, &pszPath); | ||||
| 
 | ||||
| 		if (SUCCEEDED(hr)) | ||||
| 		{ | ||||
| 			localAppDataPath = pszPath; | ||||
| 			CoTaskMemFree(pszPath); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	return localAppDataPath; | ||||
| } | ||||
| 
 | ||||
| e2d::String e2d::Path::getCurrentFilePath() | ||||
| { | ||||
| 	TCHAR szPath[_MAX_PATH] = { 0 }; | ||||
| 	if (::GetModuleFileName(nullptr, szPath, _MAX_PATH) != 0) | ||||
|  | @ -106,7 +104,7 @@ e2d::String e2d::Path::findFile(const String& path) | |||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		for (auto& resPath : s_vPathList) | ||||
| 		for (auto& resPath : _paths) | ||||
| 		{ | ||||
| 			if (Path::exists(resPath + path)) | ||||
| 			{ | ||||
|  | @ -119,7 +117,7 @@ e2d::String e2d::Path::findFile(const String& path) | |||
| 
 | ||||
| e2d::String e2d::Path::extractResource(int resNameId, const String & resType, const String & destFileName) | ||||
| { | ||||
| 	String destFilePath = s_sTempPath + destFileName; | ||||
| 	String destFilePath = _tempPath + destFileName; | ||||
| 	// ´´½¨Îļþ
 | ||||
| 	HANDLE hFile = ::CreateFile((LPCWSTR)destFilePath, GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, NULL); | ||||
| 	if (hFile == INVALID_HANDLE_VALUE) | ||||
|  | @ -146,9 +144,9 @@ e2d::String e2d::Path::extractResource(int resNameId, const String & resType, co | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| e2d::String e2d::Path::getDataSavePath() | ||||
| e2d::String e2d::Path::getDataPath() | ||||
| { | ||||
| 	return s_sDataSavePath; | ||||
| 	return _dataPath; | ||||
| } | ||||
| 
 | ||||
| e2d::String e2d::Path::getFileExtension(const String& filePath) | ||||
|  |  | |||
|  | @ -213,7 +213,7 @@ double e2d::Player::getVolume() | |||
| 
 | ||||
| void e2d::Player::setVolume(double volume) | ||||
| { | ||||
| 	_volume = min(max(float(volume), -224), 224); | ||||
| 	_volume = std::min(std::max(float(volume), -224.f), 224.f); | ||||
| 	for (auto pair : _fileList) | ||||
| 	{ | ||||
| 		pair.second->setVolume(_volume); | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ namespace e2d | |||
| 			, stopped(false) | ||||
| 			, runTimes(0) | ||||
| 			, totalTimes(updateTimes) | ||||
| 			, delay(max(delay, 0)) | ||||
| 			, delay(std::max(delay, 0.0)) | ||||
| 			, lastTime(e2d::Time::getTotalTime()) | ||||
| 			, callback(func) | ||||
| 			, name(name) | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ e2d::Transition::Transition(double duration) | |||
| 	, _outLayerParam() | ||||
| 	, _inLayerParam() | ||||
| { | ||||
| 	_duration = max(duration, 0); | ||||
| 	_duration = std::max(duration, 0.0); | ||||
| } | ||||
| 
 | ||||
| e2d::Transition::~Transition() | ||||
|  | @ -68,7 +68,7 @@ void e2d::Transition::_update() | |||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		_delta = min((Time::getTotalTime() - _last) / _duration, 1); | ||||
| 		_delta = std::min((Time::getTotalTime() - _last) / _duration, 1.0); | ||||
| 	} | ||||
| 
 | ||||
| 	this->_updateCustom(); | ||||
|  | @ -92,10 +92,10 @@ void e2d::Transition::_render() | |||
| 	{ | ||||
| 		Point rootPos = _outScene->getRoot()->getPos(); | ||||
| 		auto clipRect = D2D1::RectF( | ||||
| 			float(max(rootPos.x, 0)), | ||||
| 			float(max(rootPos.y, 0)), | ||||
| 			float(min(rootPos.x + _windowSize.width, _windowSize.width)), | ||||
| 			float(min(rootPos.y + _windowSize.height, _windowSize.height)) | ||||
| 			float(std::max(rootPos.x, 0.0)), | ||||
| 			float(std::max(rootPos.y, 0.0)), | ||||
| 			float(std::min(rootPos.x + _windowSize.width, _windowSize.width)), | ||||
| 			float(std::min(rootPos.y + _windowSize.height, _windowSize.height)) | ||||
| 		); | ||||
| 		pRT->SetTransform(D2D1::Matrix3x2F::Identity()); | ||||
| 		pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); | ||||
|  | @ -111,10 +111,10 @@ void e2d::Transition::_render() | |||
| 	{ | ||||
| 		Point rootPos = _inScene->getRoot()->getPos(); | ||||
| 		auto clipRect = D2D1::RectF( | ||||
| 			float(max(rootPos.x, 0)), | ||||
| 			float(max(rootPos.y, 0)), | ||||
| 			float(min(rootPos.x + _windowSize.width, _windowSize.width)), | ||||
| 			float(min(rootPos.y + _windowSize.height, _windowSize.height)) | ||||
| 			float(std::max(rootPos.x, 0.0)), | ||||
| 			float(std::max(rootPos.y, 0.0)), | ||||
| 			float(std::min(rootPos.x + _windowSize.width, _windowSize.width)), | ||||
| 			float(std::min(rootPos.y + _windowSize.height, _windowSize.height)) | ||||
| 		); | ||||
| 		pRT->SetTransform(D2D1::Matrix3x2F::Identity()); | ||||
| 		pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); | ||||
|  |  | |||
|  | @ -41,6 +41,7 @@ | |||
| // C++ RunTime Header Files
 | ||||
| #include <map> | ||||
| #include <set> | ||||
| #include <list> | ||||
| #include <stack> | ||||
| #include <vector> | ||||
| #include <random> | ||||
|  | @ -97,3 +98,12 @@ | |||
| 	Class(const Class &); \ | ||||
| 	Class & operator= (const Class &) | ||||
| #endif | ||||
| 
 | ||||
| 
 | ||||
| #ifdef max | ||||
| #	undef max | ||||
| #endif | ||||
| 
 | ||||
| #ifdef min | ||||
| #	undef min | ||||
| #endif | ||||
|  | @ -477,13 +477,16 @@ public: | |||
| 	); | ||||
| 
 | ||||
| 	// 获取数据的默认保存路径
 | ||||
| 	static String getDataSavePath(); | ||||
| 	static String getDataPath(); | ||||
| 
 | ||||
| 	// 获取临时文件目录
 | ||||
| 	static String getTempPath(); | ||||
| 
 | ||||
| 	// 获取执行程序的绝对路径
 | ||||
| 	static String getExecutableFilePath(); | ||||
| 	// 获取 LocalAppData 目录
 | ||||
| 	static String getLocalAppDataPath(); | ||||
| 
 | ||||
| 	// 获取当前程序的运行路径
 | ||||
| 	static String getCurrentFilePath(); | ||||
| 
 | ||||
| 	// 获取文件扩展名
 | ||||
| 	static String getFileExtension( | ||||
|  | @ -507,8 +510,9 @@ public: | |||
| 	); | ||||
| 
 | ||||
| private: | ||||
| 	// 初始化
 | ||||
| 	static bool __init(); | ||||
| 	static String _tempPath; | ||||
| 	static String _dataPath; | ||||
| 	static std::list<String> _paths; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
		Loading…
	
		Reference in New Issue