SRL Archive - Other Scripts

Spinning Squares


canadarules

2006-06-15 18:51:02

program New;
var
Canvas:TCanvas;
intCurrentStage:integer;

procedure ResetDebug;
begin
DisplayDebugImgWindow(100,100);
Canvas:=GetDebugCanvas;
Canvas.Brush.COLOR:= clblack;
Canvas.Pen.COLOR:= clwhite;
Canvas.Font.Color:= clwhite;
Canvas.Font.Name:= 'Verdana Bold';
Canvas.Font.Size:= 7;
Canvas.Rectangle(0,0,100,100);
Canvas.Brush.COLOR := clwhite;
end;

procedure DrawBox1;
begin
Canvas.MoveTo(5,5);
Canvas.LineTo(95,5);
Canvas.LineTo(95,95);
Canvas.LineTo(5,95);
Canvas.LineTo(5,5);
end;

procedure DrawBox2(intStage:integer);
begin
Canvas.MoveTo(5+intStage,5);
Canvas.LineTo(5,95-intStage);
Canvas.LineTo(95-intStage,95);
Canvas.LineTo(95,5+intStage);
Canvas.LineTo(5+intStage,5);
end;

begin
repeat
intCurrentStage := 0;
repeat
ResetDebug;
DrawBox1;
DrawBox2(intCurrentStage);
DrawBox2(90-intCurrentStage);
intCurrentStage := intCurrentStage + 1;
wait(15);
until(intCurrentStage=91);
until(false);
end.

I'm bored. I have a fancier version, but I have to fix some bugs first. Stare at this as I fix bugs.

shaunthasheep

2006-06-15 19:08:14

its pretty cool :) im going to make something using canvas, never tried it yet before tho…

EDIT: heres my first try!

program New;
const
Invert = False;//Set To True To Invert;
var
Canvas:TCanvas;
ihold : integer;


procedure ResetDebug1;
begin
Canvas:=GetDebugCanvas;
Canvas.Brush.COLOR:= clblack;
Canvas.Pen.COLOR:= clwhite;
Canvas.Font.Color:= clwhite;
Canvas.Font.Name:= 'Verdana Bold';
Canvas.Font.Size:= 7;
Canvas.Rectangle(0,0,200,200);
Canvas.Brush.COLOR := clwhite;
end;

procedure ResetDebug2;
begin
Canvas:=GetDebugCanvas;
Canvas.Brush.COLOR:= clwhite;
Canvas.Pen.COLOR:= clblack;
Canvas.Font.Color:= clwhite;
Canvas.Font.Name:= 'Verdana Bold';
Canvas.Font.Size:= 7;
Canvas.Rectangle(5,5,195,195);
Canvas.Brush.COLOR := clwhite;
end;

procedure DrawBox(inwords : integer);
begin
Canvas.MoveTo(5+inwords,5+inwords);
Canvas.LineTo(195-inwords,5+inwords);
Canvas.LineTo(195-inwords,195-inwords);
Canvas.LineTo(5+inwords,195-inwords);
Canvas.LineTo(5+inwords,5+inwords);
ClearDebug;
Writeln('Inwords ' + inttostr(inwords));
end;

begin
DisplayDebugImgWindow(200,200);
repeat
ihold := 0
ResetDebug1;
repeat
if Invert = True then ResetDebug1;
DrawBox(ihold);
ihold := ihold + 1;
Sleep(1);
until(ihold = 98)
ResetDebug2;
repeat
if Invert = True then ResetDebug2;
DrawBox(ihold);
ihold := ihold - 1;
Sleep(1);
until(ihold = 0)
until(false)
end.


PAINT HELPED ME PICTURE THE BOX ROFL, AND THE ADDING AND SUBTRACTING OF THE INWORDS THINGY LOL