a
This commit is contained in:
parent
89d17ce038
commit
91b2cf3c28
109
veinCur.cpp
109
veinCur.cpp
@ -55,7 +55,7 @@ int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszA
|
|||||||
|
|
||||||
// ÉèÖÃÏß³ÌÓÅÏȼ¶ÎªµÍ
|
// ÉèÖÃÏß³ÌÓÅÏȼ¶ÎªµÍ
|
||||||
SetThreadPriority(hThread, THREAD_PRIORITY_LOWEST);
|
SetThreadPriority(hThread, THREAD_PRIORITY_LOWEST);
|
||||||
|
SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -146,27 +146,22 @@ void vine2(int x1, int y1, float anchor, float turn, int speed, int cost, Color
|
|||||||
penline.SetStartCap(LineCapRound);
|
penline.SetStartCap(LineCapRound);
|
||||||
mtx.lock();
|
mtx.lock();
|
||||||
graphics->DrawLine(&penline, x1, y1, x2, y2);
|
graphics->DrawLine(&penline, x1, y1, x2, y2);
|
||||||
vines.push(VineDraw{x1,y1,x2,y2,speed,50});
|
vines.push(VineDraw{x1,y1,x2,y2,speed,10});
|
||||||
mtx.unlock();
|
|
||||||
Sleep(1);
|
|
||||||
if (clone > 0 && rand() % 10 == 0)
|
if (clone > 0 && rand() % 10 == 0)
|
||||||
{
|
{
|
||||||
int x_copy = x1;
|
thread t(vine2, x1, y1, anchor + rand() % 10 / 23.0, turn * (-1 + rand() % 2 * 2), speed + rand() % 2, cost, Color(rand() % 70, 155 + rand() % 100, 20 + rand() % 70), 0, --clone);
|
||||||
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();
|
t.detach();
|
||||||
}
|
}
|
||||||
if (count % 10 == 0)
|
if (count % 9 == 0)
|
||||||
speed -= cost;
|
speed -= cost;
|
||||||
anchor += turn;
|
anchor += turn;
|
||||||
if (count % 3 == 0)
|
if (count % 3 == 0)
|
||||||
turn += turn / 2;
|
turn += turn / 2;
|
||||||
if (turn > 0.6)
|
if (turn > 0.6)
|
||||||
speed = 0;
|
speed = 0;
|
||||||
|
mtx.unlock();
|
||||||
|
Sleep(1);
|
||||||
vine2(x2, y2, anchor, turn, speed, cost, color, count, clone);
|
vine2(x2, y2, anchor, turn, speed, cost, color, count, clone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,55 +186,55 @@ DWORD WINAPI eraser(LPVOID lpParam)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sleep(50);
|
Sleep(70);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void vine(int x1, int y1, float anchor, float turn, int speed, int cost, Color color, int count, int clone)
|
//void vine(int x1, int y1, float anchor, float turn, int speed, int cost, Color color, int count, int clone)
|
||||||
{
|
//{
|
||||||
if (speed <= 0)
|
// if (speed <= 0)
|
||||||
{
|
// {
|
||||||
Sleep(300);
|
// Sleep(300);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
count++;
|
// count++;
|
||||||
int x2 = x1 + (speed)*cos(anchor);
|
// int x2 = x1 + (speed)*cos(anchor);
|
||||||
int y2 = y1 + (speed)*sin(anchor);
|
// int y2 = y1 + (speed)*sin(anchor);
|
||||||
Pen penline(color, speed);
|
// Pen penline(color, speed);
|
||||||
penline.SetEndCap(LineCapRound);
|
// penline.SetEndCap(LineCapRound);
|
||||||
penline.SetStartCap(LineCapRound);
|
// penline.SetStartCap(LineCapRound);
|
||||||
mtx.lock();
|
// mtx.lock();
|
||||||
graphics->DrawLine(&penline, x1, y1, x2, y2);
|
// graphics->DrawLine(&penline, x1, y1, x2, y2);
|
||||||
mtx.unlock();
|
// mtx.unlock();
|
||||||
Sleep(1);
|
// Sleep(1);
|
||||||
if (clone > 0 && rand() % 10 == 0)
|
// if (clone > 0 && rand() % 10 == 0)
|
||||||
{
|
// {
|
||||||
int x_copy = x1;
|
// int x_copy = x1;
|
||||||
int y_copy = y1;
|
// int y_copy = y1;
|
||||||
float anchor_copy = anchor + rand() % 10 / 26.0;
|
// float anchor_copy = anchor + rand() % 10 / 26.0;
|
||||||
float turn_copy = turn * (-1 + rand() % 2 * 2);
|
// float turn_copy = turn * (-1 + rand() % 2 * 2);
|
||||||
int speed_copy = speed + rand() % 3;
|
// int speed_copy = speed + rand() % 3;
|
||||||
int cost_copy = cost + 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);
|
// 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();
|
// t.detach();
|
||||||
}
|
// }
|
||||||
if (count % 10 == 0)
|
// if (count % 10 == 0)
|
||||||
speed -= cost;
|
// speed -= cost;
|
||||||
anchor += turn;
|
// anchor += turn;
|
||||||
if (count % 3 == 0)
|
// if (count % 3 == 0)
|
||||||
turn += turn / 2;
|
// turn += turn / 2;
|
||||||
if (turn > 0.6)
|
// if (turn > 0.6)
|
||||||
speed = 0;
|
// speed = 0;
|
||||||
vine(x2, y2, anchor, turn, speed, cost, color, count, clone);
|
// vine(x2, y2, anchor, turn, speed, cost, color, count, clone);
|
||||||
Sleep(count / 3);
|
// Sleep(count / 3);
|
||||||
Pen erase(Color(255, 0, 0), speed * 2 + 3);
|
// Pen erase(Color(255, 0, 0), speed * 2 + 3);
|
||||||
erase.SetEndCap(LineCapRound);
|
// erase.SetEndCap(LineCapRound);
|
||||||
erase.SetStartCap(LineCapRound);
|
// erase.SetStartCap(LineCapRound);
|
||||||
mtx.lock();
|
// mtx.lock();
|
||||||
graphics->DrawLine(&erase, x1, y1, x2, y2);
|
// graphics->DrawLine(&erase, x1, y1, x2, y2);
|
||||||
mtx.unlock();
|
// mtx.unlock();
|
||||||
}
|
//}
|
||||||
|
|
||||||
LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam) {
|
LRESULT CALLBACK MouseProc(int nCode, WPARAM wParam, LPARAM lParam) {
|
||||||
if (nCode >= 0) {
|
if (nCode >= 0) {
|
||||||
|
|||||||
@ -104,6 +104,8 @@
|
|||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
@ -120,7 +122,7 @@
|
|||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user