Compare commits
No commits in common. "master" and "tag1" have entirely different histories.
114
veinCur.cpp
114
veinCur.cpp
@ -13,7 +13,6 @@ LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
Gdiplus::Graphics* graphics;
|
||||
ULONG_PTR gdiplusToken;
|
||||
HWND hwnd;
|
||||
HHOOK hook;
|
||||
mutex mtx;
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
@ -42,7 +41,8 @@ int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszA
|
||||
}
|
||||
|
||||
CreateFullScreenTransparentWindow(L"鼠标特效", L"cursor_anim");
|
||||
hook = SetWindowsHookEx(WH_MOUSE_LL, MouseProc, NULL, 0);
|
||||
HHOOK hook = SetWindowsHookEx(WH_MOUSE_LL, MouseProc, NULL, 0);
|
||||
|
||||
|
||||
|
||||
// 创建线程
|
||||
@ -55,7 +55,7 @@ int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszA
|
||||
|
||||
// 设置线程优先级为低
|
||||
SetThreadPriority(hThread, THREAD_PRIORITY_LOWEST);
|
||||
SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -122,7 +122,6 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||
delete graphics;
|
||||
UnregisterHotKey(hwnd, g_hotkeyId);
|
||||
Gdiplus::GdiplusShutdown(gdiplusToken);
|
||||
UnhookWindowsHookEx(hook);
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
}
|
||||
@ -147,22 +146,27 @@ void vine2(int x1, int y1, float anchor, float turn, int speed, int cost, Color
|
||||
penline.SetStartCap(LineCapRound);
|
||||
mtx.lock();
|
||||
graphics->DrawLine(&penline, x1, y1, x2, y2);
|
||||
vines.push(VineDraw{x1,y1,x2,y2,speed,10});
|
||||
|
||||
vines.push(VineDraw{x1,y1,x2,y2,speed,50});
|
||||
mtx.unlock();
|
||||
Sleep(1);
|
||||
if (clone > 0 && rand() % 10 == 0)
|
||||
{
|
||||
thread t(vine2, x1, y1, anchor + rand() % 10 / 20.0, turn * (-1 + rand() % 2 * 2), speed + rand() % 2, cost, Color(rand() % 70, 115 + rand() % 3 * 70, 20 + rand() % 20), 0, --clone);
|
||||
int x_copy = x1;
|
||||
int y_copy = y1;
|
||||
float anchor_copy = anchor + rand() % 10 / 26.0;
|
||||
float turn_copy = turn * (-1 + rand() % 2 * 2);
|
||||
int speed_copy = speed + rand() % 3;
|
||||
int cost_copy = cost + rand() % 3;
|
||||
thread t(vine2, x_copy, y_copy, anchor_copy, turn_copy, speed_copy, cost_copy, Color(rand() % 50, 100 + rand() % 100, 20 + rand() % 50), 0, --clone);
|
||||
t.detach();
|
||||
}
|
||||
if (count % 9 == 0)
|
||||
if (count % 10 == 0)
|
||||
speed -= cost;
|
||||
anchor += turn;
|
||||
if (count % 3 == 0)
|
||||
turn += turn / 2;
|
||||
if (turn > 0.6)
|
||||
speed = 0;
|
||||
mtx.unlock();
|
||||
Sleep(1);
|
||||
vine2(x2, y2, anchor, turn, speed, cost, color, count, clone);
|
||||
}
|
||||
|
||||
@ -187,55 +191,55 @@ DWORD WINAPI eraser(LPVOID lpParam)
|
||||
}
|
||||
else
|
||||
{
|
||||
Sleep(70);
|
||||
Sleep(50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//void vine(int x1, int y1, float anchor, float turn, int speed, int cost, Color color, int count, int clone)
|
||||
//{
|
||||
// if (speed <= 0)
|
||||
// {
|
||||
// Sleep(300);
|
||||
// return;
|
||||
// }
|
||||
// count++;
|
||||
// int x2 = x1 + (speed)*cos(anchor);
|
||||
// int y2 = y1 + (speed)*sin(anchor);
|
||||
// Pen penline(color, speed);
|
||||
// penline.SetEndCap(LineCapRound);
|
||||
// penline.SetStartCap(LineCapRound);
|
||||
// mtx.lock();
|
||||
// graphics->DrawLine(&penline, x1, y1, x2, y2);
|
||||
// mtx.unlock();
|
||||
// Sleep(1);
|
||||
// if (clone > 0 && rand() % 10 == 0)
|
||||
// {
|
||||
// int x_copy = x1;
|
||||
// int y_copy = y1;
|
||||
// float anchor_copy = anchor + rand() % 10 / 26.0;
|
||||
// float turn_copy = turn * (-1 + rand() % 2 * 2);
|
||||
// int speed_copy = speed + rand() % 3;
|
||||
// int cost_copy = cost + rand() % 3;
|
||||
// thread t(vine, x_copy, y_copy, anchor_copy, turn_copy, speed_copy, cost_copy, Color(rand() % 50, 100 + rand() % 100, 20 + rand() % 50), 0, --clone);
|
||||
// t.detach();
|
||||
// }
|
||||
// if (count % 10 == 0)
|
||||
// speed -= cost;
|
||||
// anchor += turn;
|
||||
// if (count % 3 == 0)
|
||||
// turn += turn / 2;
|
||||
// if (turn > 0.6)
|
||||
// speed = 0;
|
||||
// vine(x2, y2, anchor, turn, speed, cost, color, count, clone);
|
||||
// Sleep(count / 3);
|
||||
// Pen erase(Color(255, 0, 0), speed * 2 + 3);
|
||||
// erase.SetEndCap(LineCapRound);
|
||||
// erase.SetStartCap(LineCapRound);
|
||||
// mtx.lock();
|
||||
// graphics->DrawLine(&erase, x1, y1, x2, y2);
|
||||
// mtx.unlock();
|
||||
//}
|
||||
void vine(int x1, int y1, float anchor, float turn, int speed, int cost, Color color, int count, int clone)
|
||||
{
|
||||
if (speed <= 0)
|
||||
{
|
||||
Sleep(300);
|
||||
return;
|
||||
}
|
||||
count++;
|
||||
int x2 = x1 + (speed)*cos(anchor);
|
||||
int y2 = y1 + (speed)*sin(anchor);
|
||||
Pen penline(color, speed);
|
||||
penline.SetEndCap(LineCapRound);
|
||||
penline.SetStartCap(LineCapRound);
|
||||
mtx.lock();
|
||||
graphics->DrawLine(&penline, x1, y1, x2, y2);
|
||||
mtx.unlock();
|
||||
Sleep(1);
|
||||
if (clone > 0 && rand() % 10 == 0)
|
||||
{
|
||||
int x_copy = x1;
|
||||
int y_copy = y1;
|
||||
float anchor_copy = anchor + rand() % 10 / 26.0;
|
||||
float turn_copy = turn * (-1 + rand() % 2 * 2);
|
||||
int speed_copy = speed + rand() % 3;
|
||||
int cost_copy = cost + rand() % 3;
|
||||
thread t(vine, x_copy, y_copy, anchor_copy, turn_copy, speed_copy, cost_copy, Color(rand() % 50, 100 + rand() % 100, 20 + rand() % 50), 0, --clone);
|
||||
t.detach();
|
||||
}
|
||||
if (count % 10 == 0)
|
||||
speed -= cost;
|
||||
anchor += turn;
|
||||
if (count % 3 == 0)
|
||||
turn += turn / 2;
|
||||
if (turn > 0.6)
|
||||
speed = 0;
|
||||
vine(x2, y2, anchor, turn, speed, cost, color, count, clone);
|
||||
Sleep(count / 3);
|
||||
Pen erase(Color(255, 0, 0), speed * 2 + 3);
|
||||
erase.SetEndCap(LineCapRound);
|
||||
erase.SetStartCap(LineCapRound);
|
||||
mtx.lock();
|
||||
graphics->DrawLine(&erase, x1, y1, x2, y2);
|
||||
mtx.unlock();
|
||||
}
|
||||
|
||||
LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam) {
|
||||
if (nCode >= 0) {
|
||||
|
||||
@ -104,8 +104,6 @@
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -122,7 +120,7 @@
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user