Skip to content

Commit

Permalink
Now this tool is opensource
Browse files Browse the repository at this point in the history
  • Loading branch information
fomonster committed Sep 15, 2020
1 parent ad62dd3 commit d58649e
Show file tree
Hide file tree
Showing 149 changed files with 49,570 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lib/
spritepacker.exe
config.cfg
148 changes: 148 additions & 0 deletions AboutFormUnit.lfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
object AboutForm: TAboutForm
Left = 559
Height = 300
Top = 296
Width = 400
BorderIcons = [biSystemMenu]
BorderStyle = bsSingle
Caption = 'About'
ClientHeight = 300
ClientWidth = 400
OnClose = FormClose
OnShow = FormShow
LCLVersion = '1.4.4.0'
object Panel1: TPanel
Left = 0
Height = 300
Top = 0
Width = 400
Align = alClient
BevelOuter = bvNone
ClientHeight = 300
ClientWidth = 400
TabOrder = 0
object Image1: TImage
Left = 0
Height = 300
Top = 0
Width = 400
Align = alClient
end
object Label1: TLabel
Cursor = crHandPoint
Left = 344
Height = 19
Top = 272
Width = 44
Caption = 'Close'
Font.CharSet = RUSSIAN_CHARSET
Font.Color = clWhite
Font.Height = -16
Font.Name = 'Arial'
Font.Pitch = fpVariable
Font.Quality = fqDraft
Font.Style = [fsBold]
ParentColor = False
ParentFont = False
OnMouseDown = Label1MouseDown
end
object Label2: TLabel
Left = 128
Height = 16
Top = 112
Width = 138
Caption = 'Maked by Fomin Sergei'
Font.CharSet = RUSSIAN_CHARSET
Font.Color = clWhite
Font.Height = -13
Font.Name = 'Arial'
Font.Pitch = fpVariable
Font.Quality = fqDraft
ParentColor = False
ParentFont = False
end
object Label3: TLabel
Left = 128
Height = 16
Top = 144
Width = 130
Caption = '[email protected]'
Font.CharSet = RUSSIAN_CHARSET
Font.Color = clWhite
Font.Height = -13
Font.Name = 'Arial'
Font.Pitch = fpVariable
Font.Quality = fqDraft
ParentColor = False
ParentFont = False
end
object Label5: TLabel
Left = 160
Height = 16
Top = 80
Width = 63
Caption = '24.11.2015'
Font.CharSet = RUSSIAN_CHARSET
Font.Color = clWhite
Font.Height = -13
Font.Name = 'Arial'
Font.Pitch = fpVariable
Font.Quality = fqDraft
ParentColor = False
ParentFont = False
end
object Label4: TLabel
Left = 96
Height = 16
Top = 176
Width = 213
Caption = 'Powered by Lazarus and FreePascal'
Font.CharSet = RUSSIAN_CHARSET
Font.Color = clWhite
Font.Height = -13
Font.Name = 'Arial'
Font.Pitch = fpVariable
Font.Quality = fqDraft
ParentColor = False
ParentFont = False
end
object Label6: TLabel
Left = 152
Height = 16
Top = 48
Width = 79
Caption = 'Sprite Packer'
Font.CharSet = RUSSIAN_CHARSET
Font.Color = clYellow
Font.Height = -13
Font.Name = 'Arial'
Font.Pitch = fpVariable
Font.Quality = fqDraft
ParentColor = False
ParentFont = False
end
object Label8: TLabel
Cursor = crHandPoint
Left = 136
Height = 16
Top = 208
Width = 133
Caption = 'http://spritepacker.com'
Font.CharSet = RUSSIAN_CHARSET
Font.Color = clWhite
Font.Height = -13
Font.Name = 'Arial'
Font.Pitch = fpVariable
Font.Quality = fqDraft
ParentColor = False
ParentFont = False
OnClick = Label8Click
end
end
object Timer1: TTimer
Interval = 20
OnTimer = Timer1Timer
left = 360
top = 8
end
end
150 changes: 150 additions & 0 deletions AboutFormUnit.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
unit AboutFormUnit;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls, StdCtrls, SSVector, ConstantsUnit, Windows;

type

{ TAboutForm }

TStar=record
position:TVector;
end;

TAboutForm = class(TForm)
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label8: TLabel;
Panel1: TPanel;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormShow(Sender: TObject);
procedure Label1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Label7Click(Sender: TObject);
procedure Label8Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ private declarations }
public
{ public declarations }

stars:array of TStar;
angle:Single;

procedure InitStars;
procedure RenderStars;
procedure FrameMoveStars(DeltaTime:Single);
procedure DoneStars;

end;

var
AboutForm: TAboutForm;

implementation

{ TAboutForm }

procedure TAboutForm.InitStars;
var
i:Integer;
begin
SetLength(stars,1000);
for i:=0 to High(stars) do begin
stars[i].position.Eqv(frandom(ss_seed)*100,frandom(ss_seed)*100,frandom(ss_seed)*100);
end;
end;

procedure TAboutForm.RenderStars;
var
matProj,matModel,m1,m2:TMatrix;
v:TVector;
i:Integer;
begin
Image1.Canvas.Pen.Color:=0;
Image1.Canvas.Brush.Color:=0;
Image1.Canvas.Rectangle(0,0,Image1.Width,Image1.Height);

Image1.Canvas.Pen.Color:=$FFFFFF;
matProj.SetProjectionMatrix(90, Image1.Width/Image1.Height,0,100000);
m1.LookAt(gV(0,0,-100),gV(0,0,0),gV(0,1,0));
m2.setYRotation(angle);
matModel:=m1.multLeft(m2);

for i:=0 to High(stars) do begin
v:=Project(stars[i].position,matModel,matProj,0,0,Image1.Width,Image1.Height);
Image1.Canvas.Pixels[round(v.x),round(v.y)]:=$FFFFFF;
end;

end;

procedure TAboutForm.FrameMoveStars(DeltaTime:Single);
begin
angle:=angle+0.01;
end;

procedure TAboutForm.DoneStars;
begin

end;

procedure TAboutForm.Button1Click(Sender: TObject);
begin
Close;
end;

procedure TAboutForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
Timer1.Enabled:=false;
DoneStars;
end;

procedure TAboutForm.FormShow(Sender: TObject);
begin
//
InitStars;
Timer1.Enabled:=true;
DoubleBuffered:=true;
Panel1.DoubleBuffered:=true;
end;

procedure TAboutForm.Label1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Close;
end;

procedure TAboutForm.Label7Click(Sender: TObject);
begin
//
end;

procedure TAboutForm.Label8Click(Sender: TObject);
begin
//
end;

procedure TAboutForm.Timer1Timer(Sender: TObject);
begin
//
FrameMoveStars(0.01);
RenderStars;
end;

initialization
{$I AboutFormUnit.lrs}

end.

Loading

0 comments on commit d58649e

Please sign in to comment.