All pastes #259877 Raw Edit

Anonymous

public text v1 · immutable
#259877 ·published 2006-11-27 20:52 UTC
rendered paste body
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Splat1Unit1.h"
#include "About.h"
#include "Dialouge.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TfrmSplat1 *frmSplat1;
//---------------------------------------------------------------------------
__fastcall TfrmSplat1::TfrmSplat1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmSplat1::tmrMoveShapeTimer(TObject *Sender)
{
TShape* shp;

     int count;
     count = 0;
     while (pnlSplat->ControlCount>count)
     {
     shp =(TShape*)pnlSplat->Controls[count];
     shp->Left = rand()% 600;
     shp->Top = rand()% 290;
     count = count + 1;
     shp->Enabled = true;
     }


}
//---------------------------------------------------------------------------
void __fastcall TfrmSplat1::shpdown(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
int count;
count=0;
while (pnlSplat->ControlCount > count)
{
TShape * shpCurrent;
shpCurrent = (TShape*)pnlSplat->Controls[count];
if (shpCurrent->Brush->Color == shp->Brush->Color)
{
 X > shp->Width/3 && X < shp->Width/3*2 && Y > shp->Height/3 && Y< shp->Height/3*2;
 edtScore->Text=StrToInt(edtScore->Text)+3;
 }
  else
  {edtScore->Text=StrToInt(edtScore->Text)+1;
  }
  tmrMoveShape->Enabled = false;
  shp->Enabled = false;
  shp->Width =(shp->Width + (shp->Width / 3));
  shp->Height = shp->Height / 3;
  lblSplat->Visible = true;
  tmrSplatShape->Enabled = true;
  if (StrToInt(edtMove->Text)<=3)
  { edtScore->Text=StrToInt(edtScore->Text)+3;
  }
  else
  {edtScore->Text=StrToInt(edtScore->Text)+1;;

  }
   int disable;
     disable = 0;
     while (pnlSplat->ControlCount>disable)
     {
     TShape* RandomShape;
     RandomShape =(TShape*)pnlSplat->Controls[disable];
     RandomShape->Enabled= False;
     disable = disable + 1;
     }
     }






}
//---------------------------------------------------------------------------
void __fastcall TfrmSplat1::tmrSplatShapeTimer(TObject *Sender)
{

  shp = new TShape(this);
  shp->Parent = pnlSplat;
  tmrSplatShape->Enabled = false;
  shp->Height = shp->Height * 3;
  shp->Width = shp->Height;
  lblSplat->Visible = false;
  tmrMoveShape->Enabled = true;
  edtMove->Text = 0;
  edtScore->Text = 0;

}
//---------------------------------------------------------------------------
void __fastcall TfrmSplat1::Exit1Click(TObject *Sender)
{
frmSplat1->Close();
}

//---------------------------------------------------------------------------




void __fastcall TfrmSplat1::About1Click(TObject *Sender)
{
AboutBox->ShowModal();
}
//---------------------------------------------------------------------------


void __fastcall TfrmSplat1::Settings1Click(TObject *Sender)
{
   TShape* shp;
  frmSettings->tkbTimer->Position = tmrMoveShape->Interval;
  frmSettings->tkbSize->Position = shp->Width;
  if (frmSettings->ShowModal() == mrOk)
  {
    tmrMoveShape->Interval = frmSettings->tkbTimer->Position;
    shp->Width = frmSettings->tkbSize->Position;
    shp->Height = frmSettings->tkbSize->Position;
  }

}
//---------------------------------------------------------------------------


void __fastcall TfrmSplat1::tmrAddTimer(TObject *Sender)
{
TShape* RandomShape;
 RandomShape = new TShape(this);
  RandomShape->Parent = pnlSplat;

  RandomShape->Shape = stCircle;
  RandomShape->Left = rand()% 600;
  RandomShape->Top = rand()% 290;

  switch(rand() % 4)
   {

   case 0 : RandomShape->Brush->Color= clRed;
   break;
   case 1 : RandomShape->Brush->Color= clYellow;
   break;
   case 2 : RandomShape->Brush->Color= clBlue;
   break;
   case 3 : RandomShape->Brush->Color= clGreen;
   break;
 }

}
//---------------------------------------------------------------------------