#include〈windows.h〉
#include〈time.h〉
#include〈stdlib.h〉
#include〈iostream.h〉
const int SnowNumber=500; //雪点数量
struct SnowNode
{
POINT postion; //雪点位置
int iColor; //先前的颜色
int iSpeed; //下落速度
int iMove; //下落距离
int iStick; //粘贴度
};
SnowNode SnowNodes[SnowNumber]; //雪点数组
int hTimer=0;
int CrWind=0;
int CrStep=0; //当前循环步数(用于限速)
int ScreenWidth=0; //屏幕宽度
int ScreenHeight=0; //屏幕高度
void GetScreenSize();
void CALLBACK TimerProc(HANDLE hWnd,UINT uMsg,UINT idEvent,DWORD dwTime);
void InitSnowNodes();
void MoveSnowNodes();
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
MSG msg; //标准windows消息
LARGE_INTEGER Frequency; //高性能定时器频率
LARGE_INTEGER StartCt,EndCt;//高性能定时器计数
float ElapsedTime; //时间间隔
srand((unsigned)time(NULL));
GetScreenSize();
InitSnowNodes();
QueryPerformanceFrequency(&Frequency);
hTimer=SetTimer(0,0,rand()%5*500,(TIMERPROC)TimerProc);
if(hTimer==0)
{
MessageBox(0,TEXT(“创建定时器失败“),TEXT(“提示“),MB_OK|MB_ICONINFORMATION);
return -1;
}
RegisterHotKe