Skip to content

Instantly share code, notes, and snippets.

@romasvrd
Created May 18, 2015 09:44
Show Gist options
  • Save romasvrd/a0b8750c85e69c8b5ff2 to your computer and use it in GitHub Desktop.
Save romasvrd/a0b8750c85e69c8b5ff2 to your computer and use it in GitHub Desktop.
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
int x0,y0,x1,y1,midx,midy;
#include "olya.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
DWORD WINAPI thRoll(void*);
HANDLE hRoll;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
hRoll=CreateThread(NULL,0,thRoll,NULL,CREATE_SUSPENDED,NULL);
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
x0=Edit1->Text.ToInt();
y0=Edit2->Text.ToInt();
x1=Edit3->Text.ToInt();
y1=Edit4->Text.ToInt();
Image1->Canvas->MoveTo(x0,y0);
Image1->Canvas->LineTo(x1,y1);
midx=(x1-x0)/2;
midy=(y1-y0)/2;
ResumeThread(hRoll);
}
//---------------------------------------------------------------------------
DWORD WINAPI thRoll(void*)
{
while(1)
{
int i=0;
while(x1<=1024)
{
Form2->Image1->Canvas->AngleArc(midx,midy,midx,0,i);
Sleep(10);
i++;
}
SuspendThread(hRoll);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment