📄 core_common.cpp
字号:
/**************************************************
公用头文件和公用函数模块
Author: LittleFish QQ:93663886
E-Mail: kittyfish_1981@yahoo.com.cn
Blog: http://blog.csdn.net/kittyfish
真诚的期待你提出改良方法或程序BUG
**************************************************/
#include "Core_Common.h"
//Common Function
void MB( TCHAR* strFormat, ... )
{
static bool b = false;
if( b )
return ;
va_list args;
TCHAR str[256];
memset( str, 0, sizeof( str ) );
va_start( args, strFormat );
_vstprintf( str, strFormat, args );
va_end( args );
b = true;
MessageBox( GetActiveWindow(), str, _T("MB"), MB_OK );
}
void DebugMB( TCHAR* strFormat, ... )
{
#ifdef _DEBUG
va_list args;
TCHAR str[256];
memset( str, 0, sizeof( str ) );
va_start( args, strFormat );
_vstprintf( str, strFormat, args );
va_end( args );
MessageBox( GetActiveWindow(), str, _T("MB"), MB_OK );
#endif
}
BOOL IsBetween( int curr, int left, int right )
{
return ( curr >= left && curr <= right );
}
BOOL Execute( LPCTSTR strFileName )
{
return (::ShellExecute( NULL, _T("open"), strFileName, NULL, NULL, SW_SHOWNORMAL ) > (HINSTANCE)32 );
}
float B3spLine( float x )
{
float a, b, c, d;
float xm1 = x - 1.0f;
float xp1 = x + 1.0f;
float xp2 = x + 2.0f;
// Only float, 不能float -> double -> float
if ((xp2) <= 0.0f)
a = 0.0f;
else
a = xp2*xp2*xp2;
if ((xp1) <= 0.0f)
b = 0.0f;
else
b = xp1*xp1*xp1;
if (x <= 0)
c = 0.0f;
else
c = x*x*x;
if ((xm1) <= 0.0f)
d = 0.0f;
else
d = xm1*xm1*xm1;
return (0.16666666666666666667f * (a - (4.0f * b) + (6.0f * c) - (4.0f * d)));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -