summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2023-07-10 21:10:49 +0200
committerErich Eckner <git@eckner.net>2023-07-10 21:10:49 +0200
commitfb3f9ff8b3e34d4084230b72a21595599c250f07 (patch)
tree772d2cb2b29d3cb54f7d4611f88145acbef0c868
downloadspectre-fb3f9ff8b3e34d4084230b72a21595599c250f07.tar.xz
initial commit
-rw-r--r--.gitignore3
-rw-r--r--spectre.icobin0 -> 133345 bytes
-rw-r--r--spectre.lpi80
-rw-r--r--spectre.lpr25
-rw-r--r--spectre.lps209
-rw-r--r--spectre.resbin0 -> 135460 bytes
-rw-r--r--spectreunit.pas52
-rw-r--r--unit1.lfm19
-rw-r--r--unit1.pas66
9 files changed, 454 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..791cd61
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+lib
+spectre
+*.bak
diff --git a/spectre.ico b/spectre.ico
new file mode 100644
index 0000000..10c5fc1
--- /dev/null
+++ b/spectre.ico
Binary files differ
diff --git a/spectre.lpi b/spectre.lpi
new file mode 100644
index 0000000..665e33d
--- /dev/null
+++ b/spectre.lpi
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+ <ProjectOptions>
+ <Version Value="12"/>
+ <General>
+ <SessionStorage Value="InProjectDir"/>
+ <Title Value="spectre"/>
+ <Scaled Value="True"/>
+ <ResourceType Value="res"/>
+ <UseXPManifest Value="True"/>
+ <XPManifest>
+ <DpiAware Value="True"/>
+ </XPManifest>
+ <Icon Value="0"/>
+ </General>
+ <BuildModes>
+ <Item Name="Default" Default="True"/>
+ </BuildModes>
+ <PublishOptions>
+ <Version Value="2"/>
+ <UseFileFilters Value="True"/>
+ </PublishOptions>
+ <RunParams>
+ <FormatVersion Value="2"/>
+ </RunParams>
+ <RequiredPackages>
+ <Item>
+ <PackageName Value="LCL"/>
+ </Item>
+ </RequiredPackages>
+ <Units>
+ <Unit>
+ <Filename Value="spectre.lpr"/>
+ <IsPartOfProject Value="True"/>
+ </Unit>
+ <Unit>
+ <Filename Value="unit1.pas"/>
+ <IsPartOfProject Value="True"/>
+ <ComponentName Value="Form1"/>
+ <HasResources Value="True"/>
+ <ResourceBaseClass Value="Form"/>
+ <UnitName Value="Unit1"/>
+ </Unit>
+ <Unit>
+ <Filename Value="spectreunit.pas"/>
+ <IsPartOfProject Value="True"/>
+ </Unit>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="11"/>
+ <Target>
+ <Filename Value="spectre"/>
+ </Target>
+ <SearchPaths>
+ <IncludeFiles Value="$(ProjOutDir)"/>
+ <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
+ </SearchPaths>
+ <Linking>
+ <Options>
+ <Win32>
+ <GraphicApplication Value="True"/>
+ </Win32>
+ </Options>
+ </Linking>
+ </CompilerOptions>
+ <Debugging>
+ <Exceptions>
+ <Item>
+ <Name Value="EAbort"/>
+ </Item>
+ <Item>
+ <Name Value="ECodetoolError"/>
+ </Item>
+ <Item>
+ <Name Value="EFOpenError"/>
+ </Item>
+ </Exceptions>
+ </Debugging>
+</CONFIG>
diff --git a/spectre.lpr b/spectre.lpr
new file mode 100644
index 0000000..6bc3b97
--- /dev/null
+++ b/spectre.lpr
@@ -0,0 +1,25 @@
+program spectre;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}
+ cthreads,
+ {$ENDIF}
+ {$IFDEF HASAMIGA}
+ athreads,
+ {$ENDIF}
+ Interfaces, // this includes the LCL widgetset
+ Forms, Unit1, spectreunit
+ { you can add units after this };
+
+{$R *.res}
+
+begin
+ RequireDerivedFormResource:=True;
+ Application.Scaled:=True;
+ Application.Initialize;
+ Application.CreateForm(TForm1, Form1);
+ Application.Run;
+end.
+
diff --git a/spectre.lps b/spectre.lps
new file mode 100644
index 0000000..975dbf5
--- /dev/null
+++ b/spectre.lps
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+ <ProjectSession>
+ <Version Value="12"/>
+ <BuildModes Active="Default"/>
+ <Units>
+ <Unit>
+ <Filename Value="spectre.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <EditorIndex Value="-1"/>
+ <WindowIndex Value="-1"/>
+ <TopLine Value="-1"/>
+ <CursorPos X="-1" Y="-1"/>
+ <UsageCount Value="20"/>
+ </Unit>
+ <Unit>
+ <Filename Value="unit1.pas"/>
+ <IsPartOfProject Value="True"/>
+ <ComponentName Value="Form1"/>
+ <HasResources Value="True"/>
+ <ResourceBaseClass Value="Form"/>
+ <UnitName Value="Unit1"/>
+ <IsVisibleTab Value="True"/>
+ <TopLine Value="32"/>
+ <CursorPos X="40" Y="62"/>
+ <UsageCount Value="20"/>
+ <Loaded Value="True"/>
+ <LoadedDesigner Value="True"/>
+ </Unit>
+ <Unit>
+ <Filename Value="spectreunit.pas"/>
+ <IsPartOfProject Value="True"/>
+ <EditorIndex Value="1"/>
+ <TopLine Value="19"/>
+ <CursorPos Y="49"/>
+ <UsageCount Value="20"/>
+ <Loaded Value="True"/>
+ </Unit>
+ <Unit>
+ <Filename Value="/usr/lib/lazarus/lcl/controls.pp"/>
+ <UnitName Value="Controls"/>
+ <EditorIndex Value="-1"/>
+ <TopLine Value="2400"/>
+ <CursorPos X="14" Y="2417"/>
+ <UsageCount Value="10"/>
+ </Unit>
+ <Unit>
+ <Filename Value="/usr/lib/lazarus/lcl/graphics.pp"/>
+ <UnitName Value="Graphics"/>
+ <EditorIndex Value="-1"/>
+ <TopLine Value="952"/>
+ <CursorPos X="3" Y="969"/>
+ <UsageCount Value="10"/>
+ </Unit>
+ <Unit>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <EditorIndex Value="3"/>
+ <TopLine Value="1036"/>
+ <CursorPos Y="1063"/>
+ <UsageCount Value="10"/>
+ <Loaded Value="True"/>
+ </Unit>
+ <Unit>
+ <Filename Value="/usr/lib/fpc/src/packages/fcl-image/src/fpcanvas.pp"/>
+ <UnitName Value="FPCanvas"/>
+ <EditorIndex Value="-1"/>
+ <TopLine Value="352"/>
+ <CursorPos X="15" Y="367"/>
+ <UsageCount Value="10"/>
+ </Unit>
+ <Unit>
+ <Filename Value="/usr/lib/fpc/src/rtl/inc/typshrdh.inc"/>
+ <EditorIndex Value="-1"/>
+ <TopLine Value="55"/>
+ <CursorPos X="3" Y="62"/>
+ <UsageCount Value="10"/>
+ </Unit>
+ <Unit>
+ <Filename Value="../units/matheunit.pas"/>
+ <EditorIndex Value="2"/>
+ <TopLine Value="1235"/>
+ <CursorPos X="5" Y="1268"/>
+ <UsageCount Value="10"/>
+ <Loaded Value="True"/>
+ </Unit>
+ </Units>
+ <JumpHistory HistoryIndex="28">
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="29" Column="12"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="35" Column="19" TopLine="7"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="37" Column="47" TopLine="9"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="69" Column="29" TopLine="41"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="74" Column="41" TopLine="46"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="78" Column="41" TopLine="50"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="82" Column="52" TopLine="54"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="84" Column="50" TopLine="56"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="85" Column="50" TopLine="57"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="89" Column="29" TopLine="61"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="91" Column="54" TopLine="63"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="93" Column="28" TopLine="65"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="95" Column="68" TopLine="67"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="97" Column="83" TopLine="69"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="140" Column="37" TopLine="112"/>
+ </Position>
+ <Position>
+ <Filename Value="spectreunit.pas"/>
+ <Caret Line="28" Column="8"/>
+ </Position>
+ <Position>
+ <Filename Value="spectreunit.pas"/>
+ <Caret Line="38" Column="9" TopLine="10"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="147" Column="44" TopLine="119"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="150" Column="18" TopLine="130"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="423" Column="19" TopLine="395"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="486" Column="16" TopLine="458"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="1065" Column="18" TopLine="1037"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="1053" Column="16" TopLine="1037"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="147" TopLine="127"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/lowlevelunit.pas"/>
+ <Caret Line="1063" TopLine="1036"/>
+ </Position>
+ <Position>
+ <Filename Value="spectreunit.pas"/>
+ <Caret Line="23" Column="8" TopLine="10"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/matheunit.pas"/>
+ <Caret Line="74" TopLine="41"/>
+ </Position>
+ <Position>
+ <Filename Value="../units/matheunit.pas"/>
+ <Caret Line="1268" Column="5" TopLine="1235"/>
+ </Position>
+ </JumpHistory>
+ <RunParams>
+ <FormatVersion Value="2"/>
+ <Modes ActiveMode=""/>
+ </RunParams>
+ </ProjectSession>
+</CONFIG>
diff --git a/spectre.res b/spectre.res
new file mode 100644
index 0000000..bb86af9
--- /dev/null
+++ b/spectre.res
Binary files differ
diff --git a/spectreunit.pas b/spectreunit.pas
new file mode 100644
index 0000000..f84fb98
--- /dev/null
+++ b/spectreunit.pas
@@ -0,0 +1,52 @@
+unit spectreunit;
+
+{$mode ObjFPC}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils, Graphics, lowlevelunit;
+
+type
+ tSpectre = class
+ private
+ _o: tExtPoint;
+ _alpha,_size: extended;
+ public
+ constructor create(x,y,alpha,size: extended);
+ procedure draw(c: tCanvas);
+ end;
+
+implementation
+
+uses
+ matheunit;
+
+constructor tSpectre.create(x,y,alpha,size: extended);
+begin
+ inherited create;
+ _o:=extPoint(x,y);
+ _alpha:=alpha;
+ _size:=size;
+end;
+
+procedure tSpectre.draw(c: tCanvas);
+var
+ r: tExtPoint;
+ a: extended;
+ i: longint;
+const
+ winkel: array of extended = (90,-60,90,-60,90,60,-90,60,90,60,-90,60,0,60);
+begin
+ r:=_o;
+ a:=_alpha;
+ c.moveTo(point(round(r)));
+ for i:=0 to length(winkel)-1 do begin
+ r:=r + _size * einheitsVektor(a);
+ c.lineTo(point(round(r)));
+ a:=a - winkel[i]/180*pi;
+ end;
+end;
+
+end.
+
diff --git a/unit1.lfm b/unit1.lfm
new file mode 100644
index 0000000..44df8e9
--- /dev/null
+++ b/unit1.lfm
@@ -0,0 +1,19 @@
+object Form1: TForm1
+ Left = 1690
+ Height = 236
+ Top = 180
+ Width = 323
+ Caption = 'Form1'
+ ClientHeight = 236
+ ClientWidth = 323
+ OnCreate = FormCreate
+ OnDestroy = FormDestroy
+ OnResize = FormResize
+ LCLVersion = '2.2.6.0'
+ object Image1: TImage
+ Left = 0
+ Height = 234
+ Top = 0
+ Width = 314
+ end
+end
diff --git a/unit1.pas b/unit1.pas
new file mode 100644
index 0000000..ed06ce3
--- /dev/null
+++ b/unit1.pas
@@ -0,0 +1,66 @@
+unit Unit1;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, spectreUnit;
+
+type
+
+ { TForm1 }
+
+ TForm1 = class(TForm)
+ Image1: TImage;
+ procedure FormCreate(Sender: TObject);
+ procedure FormDestroy(Sender: TObject);
+ procedure FormResize(Sender: TObject);
+ private
+
+ public
+ spectres: array of tSpectre;
+ end;
+
+var
+ Form1: TForm1;
+
+implementation
+
+{$R *.lfm}
+
+{ TForm1 }
+
+procedure TForm1.FormResize(Sender: TObject);
+var
+ i: longint;
+begin
+ image1.free;
+ image1:=tImage.create(self);
+ image1.parent:=self;
+ image1.left:=0;
+ image1.top:=0;
+ image1.width:=form1.clientWidth;
+ image1.height:=form1.clientHeight;
+ image1.canvas.rectangle(-1,-1,image1.width+2,image1.height+2);
+ for i:=0 to length(spectres)-1 do
+ spectres[i].draw(image1.canvas);
+end;
+
+procedure TForm1.FormDestroy(Sender: TObject);
+var
+ i: longint;
+begin
+ for i:=0 to length(spectres)-1 do
+ spectres[i].free;
+ setLength(spectres,0);
+end;
+
+procedure TForm1.FormCreate(Sender: TObject);
+begin
+ setLength(spectres,1);
+ spectres[0]:=tSpectre.create(100,100,pi/4,30);
+end;
+
+end.
+