c
//... WAVEHDR WaveHdr = {(LPSTR)&Buffer, sizeof(Buffer), 0, NULL, WHDR_BEGINLOOP | WHDR_ENDLOOP, INFINITE}; int w2, h2, Start; HWAVEOUT hSound; double max; bool Last; char *Elapsed() { static char Time[12] = "00:00:00.00"; asm { call GetTickCount; sub eax, [Start]; push ebx; mov ecx, 183C3C64h; lea ebx, Time[12]; or ax, '00'; sub ebx, 3; mov [ebx], ax; xchg edx, eax; pop ecx; shr ecx, 8; jnz @loop; pop ebx } return Time; } #define pitagoras(a, b) sqrt(pow(a, 2) + pow(b, 2)) __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { Bitmap->Width = ClientWidth; Bitmap->Height = ClientHeight; Bitmap->Canvas->Pen->Color = clGray; Timer1->Interval = 33; randomize(); fly[0] = Image1->Picture->Bitmap; fly[1] = Image2->Picture->Bitmap; hand[true] = Image4->Picture->Graphic; hand[false] = Image3->Picture->Graphic; w2 = ClientWidth / 2; h2 = ClientHeight / 2; max = pitagoras(w2, h2); waveOutOpen(&hSound, WAVE_MAPPER, (PWAVEFORMATEX)"\1\0\1\0\x70\x17\0\0\x70\x17\0\0\1\0\x8\0\x10\0", 0, 0, 0); waveOutPrepareHeader(hSound, &WaveHdr, sizeof(WaveHdr)); waveOutWrite(hSound, &WaveHdr, sizeof(WaveHdr)); b1Click(NULL); SetProcessWorkingSetSize((HANDLE)-1, INFINITE, INFINITE); } void __fastcall TForm1::Timer1Timer(TObject *Sender) { Bitmap->Canvas->Rectangle(ClientRect); for (int Index = 0; Index <= HIGH_VECTOR; Index++) { TPoint Value = Index ? Vector[Index - 1] : Point(random(ClientWidth * 2) - w2, random(ClientHeight * 2) - h2); Vector[Index].x += (Value.x - Vector[Index].x) * 0.666; Vector[Index].y += (Value.y - Vector[Index].y) * 0.666; } Tag = (Tag + 1) % 2; POINT Points[3] = {{-fly[Tag]->Width, fly[Tag]->Height}, {fly[Tag]->Width, fly[Tag]->Height}, {-fly[Tag]->Width, -fly[Tag]->Height}}; double Direction = atan2(Vector[HIGH_VECTOR].y - Vector[HIGH_VECTOR - 2].y, Vector[HIGH_VECTOR].x - Vector[HIGH_VECTOR - 2].x + 0.000666) - M_PI_2, Radio = pitagoras(fly[Tag]->Width / 2, fly[Tag]->Height / 2); for (int Index = 0; Index < 3; Index++) { if (Points[Index].x < 0) Angle += M_PI; } PlgBlt(Bitmap->Canvas->Handle, Points, fly[Tag]->Canvas->Handle, 0, 0, fly[Tag]->Width, fly[Tag]->Height, 0, 0, 0); Center = Point(Vector[HIGH_VECTOR].x + Radio, Vector[HIGH_VECTOR].y + Radio); double Angle = pitagoras(Center.x - w2, Center.y - h2); int Volume = (Angle > max)? 0 : (((max - Angle) / max) * 0xFFFF); waveOutSetVolume(hSound, Volume | (Volume << 16)); bool Down = GetKeyState(VK_LBUTTON) & 0x80; TPoint Value = ScreenToClient(Mouse->CursorPos); Bitmap->Canvas->Draw(Value.x - 20, Value.y - 20, hand[Down]); if ((pitagoras(Center.x - Value.x, Center.y - Value.y) < 15) && Down && (Last != Down)) { b1->Visible++; b2->Visible++; Timer1->Enabled--; Bitmap->Canvas->Rectangle(ClientRect); Bitmap->Canvas->Font->Color = clBlack; Bitmap->Canvas->Draw(Value.x - (Image5->Width / 2), Value.y - (Image5->Height / 2), Image5->Picture->Graphic); waveOutPause(hSound); ShowCursor(True); } Last = Down; SetBkMode(Bitmap->Canvas->Handle, TRANSPARENT); TextOut(Bitmap->Canvas->Handle, 4, 1, Elapsed(), 11); Bitmap->Canvas->TextOut(ClientWidth - 60, ClientHeight - 18, "by cHackAll"); FormPaint(NULL); } //...
Edito; olvide el adjunto
Salud!