代码拉取完成,页面将自动刷新
同步操作将从 XsJIONG/DesktopArt 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include <windows.h>
#include <commctrl.h>
#include <cmath>
#include <iostream>
#include <pthread.h>
#include <time.h>
#include <conio.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
const double g=9.8;
const double JUMP=2.0/3.0;
const int UP=10;
const int size=50;
const int BIG=9000;
int abs(int a, int b) {
return a>b?a-b:b-a;
}
struct Item {
double x,y,v;
bool touch(Item a) {
return abs(this->x,a.x)<=size&&abs(this->y,a.y)<=size;
}
}a[1000];
unsigned long long AL=0;
int GX=1,GY=0;
int Mx[]={0,1,0,-1},My[]={-1,0,1,0};
int Nm;
void *read(void* args) {
int i;
while (true) {
i=getch();
if (i==224) {
i=getch();
switch (i) {
case 72:i=0;break;
case 77:i=1;break;
case 80:i=2;break;
case 75:i=3;break;
}
GX=Mx[i],GY=My[i];
for (int i=0;i<Nm;i++) a[i].v=0;
}
}
}
int random(int s, int t) {
return rand()%(s+t-1)+s;
}
int main() {
pthread_t th;
int ret=pthread_create(&th,NULL,read,NULL);
pthread_detach(th);
HWND hwndParent=::FindWindow("Progman", "Program Manager");
HWND hwndSHELLDLL_DefView=::FindWindowEx(hwndParent, NULL, "SHELLDLL_DefView", NULL);
HWND hwndSysListView32=::FindWindowEx(hwndSHELLDLL_DefView, NULL, "SysListView32", "FolderView");
Nm = ListView_GetItemCount(hwndSysListView32);
int ox=0;
int W=GetSystemMetrics(SM_CXFULLSCREEN);
int H=GetSystemMetrics(SM_CYFULLSCREEN);
srand(time(NULL));
bool ts;
for(int i=0;i<Nm;i++) {
a[i].v=0;
a[i].x=random(0,W-size),a[i].y=random(0,H-size);
ts=false;
for (int j=0;j<i;j++) if (a[j].touch(a[i])) {ts=true;break;}
while (ts) {
a[i].x=random(0,W-size),a[i].y=random(0,H-size);
ts=false;
for (int j=0;j<i;j++) if (a[j].touch(a[i])) {ts=true;break;}
}
}
Item *cur,*che;
double s;
while (true) {
s=W/Nm;
for(int i=0;i<Nm;i++) {
cur=&a[i];
cur->x+=BIG*cur->v/2000*GX;
cur->y+=BIG*cur->v/2000*GY;
for (int j=0;j<Nm;j++) {
if (i==j) continue;
cur=&a[i];
che=&a[j];
if (cur->touch(*che)) {
cur->x-=BIG*cur->v/2000*GX,cur->y-=BIG*cur->v/2000*GY;
if (cur->v>che->v) cur->v=-cur->v*JUMP; else cur->v=cur->v*JUMP;
}
}
cur->v+=UP*g/1000;
if (cur->x+size>W||cur->y+size>H||cur->x<0||cur->y<0) cur->x-=BIG*cur->v/2000*GX,cur->y-=BIG*cur->v/2000*GY,cur->v=-cur->v*JUMP;
::SendMessage(hwndSysListView32, LVM_SETITEMPOSITION, i, MAKELPARAM(cur->x,cur->y));
}
ListView_RedrawItems(hwndSysListView32, 0, Nm - 1);
::UpdateWindow(hwndSysListView32);
Sleep(UP);
AL+=UP;
}
return 0;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。