Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
RetroNick2020 committed Oct 26, 2024
1 parent b847666 commit cc1fc5d
Show file tree
Hide file tree
Showing 12 changed files with 495 additions and 63 deletions.
49 changes: 46 additions & 3 deletions animate.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ object AnimationForm: TAnimationForm
Color = 15790320
ParentBackground = False
ParentColor = False
TabOrder = 1
TabOrder = 0
object SpriteListView: TListView
AnchorSideLeft.Control = LeftPanel
AnchorSideTop.Control = LeftPanel
Expand Down Expand Up @@ -197,7 +197,7 @@ object AnimationForm: TAnimationForm
Caption = 'MiddlePanel'
ClientHeight = 493
ClientWidth = 768
TabOrder = 2
TabOrder = 1
object CurrentAnimListView: TListView
AnchorSideLeft.Control = MiddlePanel
AnchorSideTop.Control = MiddlePanel
Expand Down Expand Up @@ -244,7 +244,7 @@ object AnimationForm: TAnimationForm
Caption = 'RightPanel'
ClientHeight = 493
ClientWidth = 191
TabOrder = 3
TabOrder = 2
object AllAnimListView: TListView
AnchorSideLeft.Control = RightPanel
AnchorSideTop.Control = RightPanel
Expand Down Expand Up @@ -317,6 +317,10 @@ object AnimationForm: TAnimationForm
Caption = 'Delete'
OnClick = AnimDeleteMenuClick
end
object AnimProperties: TMenuItem
Caption = 'Properties'
OnClick = AnimPropertiesClick
end
end
object Timer1: TTimer
OnTimer = Timer1Timer
Expand Down Expand Up @@ -356,6 +360,44 @@ object AnimationForm: TAnimationForm
Caption = 'Delete All'
OnClick = MenuDeleteAllClick
end
object MenuItem12: TMenuItem
Caption = 'Export'
object FileExportBasicData: TMenuItem
Caption = 'Basic'
object ExportBasicAnimData: TMenuItem
Caption = 'Animation Data Statements'
OnClick = ExportBasicAnimDataClick
end
end
object MenuItem13: TMenuItem
Caption = 'C'
object ExportCAnimArray: TMenuItem
Caption = 'Animation Array'
OnClick = ExportEmscriptenAnimArrayClick
end
end
object MenuItem15: TMenuItem
Caption = 'Emscripten'
object ExportEmscriptenAnimArray: TMenuItem
Caption = 'Animation Array'
OnClick = ExportEmscriptenAnimArrayClick
end
end
object MenuItem17: TMenuItem
Caption = 'gcc'
object ExportgccAnimArray: TMenuItem
Caption = 'Animation Array'
OnClick = ExportEmscriptenAnimArrayClick
end
end
object pascal: TMenuItem
Caption = 'pascal'
object ExportPascalAnimArray: TMenuItem
Caption = 'Animation Array'
OnClick = FileExportPascalArrayClick
end
end
end
object MenuItem7: TMenuItem
Caption = 'Export Anim As PNG''s'
OnClick = AnimExportMenuClick
Expand All @@ -378,6 +420,7 @@ object AnimationForm: TAnimationForm
Top = 328
end
object SaveDialog1: TSaveDialog
Options = [ofOverwritePrompt, ofEnableSizing, ofViewDetail]
Left = 624
Top = 424
end
Expand Down
153 changes: 129 additions & 24 deletions animate.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ interface

uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, Buttons, ExtCtrls,
ComCtrls, Menus, StdCtrls, Arrow,AnimBase,rmthumb,rwpng,fileprops;
ComCtrls, Menus, StdCtrls, Arrow,AnimBase,animationexport,rmthumb,rwpng,
fileprops,rwspriteanim,rmcodegen,rmconfig,rmclipboard;

type

Expand All @@ -27,6 +28,18 @@ TAnimationForm = class(TForm)
MenuItem10: TMenuItem;
MenuItem11: TMenuItem;
MenuDeleteAll: TMenuItem;
AnimProperties: TMenuItem;
MenuItem12: TMenuItem;
MenuItem13: TMenuItem;
ExportCAnimArray: TMenuItem;
MenuItem15: TMenuItem;
ExportEmscriptenAnimArray: TMenuItem;
ExportPascalAnimArray: TMenuItem;
FileExportBasicData: TMenuItem;
ExportBasicAnimData: TMenuItem;
pascal: TMenuItem;
MenuItem17: TMenuItem;
ExportgccAnimArray: TMenuItem;
MenuItem2: TMenuItem;
MenuItem3: TMenuItem;
MenuItem4: TMenuItem;
Expand Down Expand Up @@ -59,7 +72,8 @@ TAnimationForm = class(TForm)
procedure AllAnimListViewClick(Sender: TObject);
procedure AllAnimListViewShowHint(Sender: TObject; HintInfo: PHintInfo);
procedure AnimDeleteMenuClick(Sender: TObject);
procedure Arrow1Click(Sender: TObject);
procedure AnimPropertiesClick(Sender: TObject);

procedure Button1Click(Sender: TObject);
procedure CopyFromThumbViewClick(Sender: TObject);
procedure CopyMenuClick(Sender: TObject);
Expand All @@ -69,6 +83,7 @@ TAnimationForm = class(TForm)
procedure CurrentAnimListViewDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
procedure DeleteMenuClick(Sender: TObject);
procedure ExportBasicAnimDataClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);

Expand All @@ -78,10 +93,13 @@ TAnimationForm = class(TForm)
procedure MenuDeleteAllClick(Sender: TObject);
procedure MenuItem10Click(Sender: TObject);
procedure MenuItem11Click(Sender: TObject);
procedure ExportEmscriptenAnimArrayClick(Sender: TObject);
procedure FileExportPascalArrayClick(Sender: TObject);
procedure MenuItem2Click(Sender: TObject);
procedure MenuItem3Click(Sender: TObject);
procedure MenuItem9Click(Sender: TObject);
procedure NewAnimationMenuClick(Sender: TObject);

procedure PasteMenuClick(Sender: TObject);
procedure PlayButtonClick(Sender: TObject);
procedure SpriteListViewDblClick(Sender: TObject);
Expand Down Expand Up @@ -113,6 +131,7 @@ TAnimationForm = class(TForm)
procedure DeleteAll;
procedure SelectAnimation(AnimationIndex : integer);

function ExportTextFileToClipboard(Sender: TObject) : boolean;
end;

var
Expand Down Expand Up @@ -204,17 +223,6 @@ procedure TAnimationForm.MenuItem10Click(Sender: TObject);
AddEmptyFrame;
end;

procedure TAnimationForm.MenuItem11Click(Sender: TObject);
var
index : integer;
begin
index:=CurrentAnimListView.ItemIndex;
if index > -1 then DeleteFrame(Index);

index:=AllAnimListView.ItemIndex;
if index > -1 then DeleteAnimation(Index);

end;

procedure TAnimationForm.MenuItem2Click(Sender: TObject);
begin
Expand Down Expand Up @@ -247,6 +255,7 @@ procedure TAnimationForm.MenuItem9Click(Sender: TObject);
procedure TAnimationForm.AddAnimation;
begin
AnimateBase.AddAnimation;
AnimateBase.SetCurrentAnimation(AnimateBase.GetAnimationCount-1); //animation will be added to end of list - switch to that

LoadCurrentAnimList;
LoadAnimThumbList;
Expand All @@ -267,10 +276,94 @@ procedure TAnimationForm.DeleteAnimation(AnimationIndex : integer);
AllAnimListView.Repaint;
end;

procedure TAnimationForm.MenuItem11Click(Sender: TObject);
var
index : integer;
begin
index:=CurrentAnimListView.ItemIndex;
if index > -1 then DeleteFrame(Index);

index:=AllAnimListView.ItemIndex;
if index > -1 then DeleteAnimation(Index);
end;

procedure TAnimationForm.ExportEmscriptenAnimArrayClick(Sender: TObject);
begin
if ExportTextFileToClipboard(Sender) then exit;

SaveDialog1.Filter := 'C Source Files|*.c|C Header Files|*.h|All Files|*.*';
if SaveDialog1.Execute then
begin
ExportAnimation(SaveDialog1.FileName,cLan);
end;
end;

procedure TAnimationForm.FileExportPascalArrayClick(Sender: TObject);
begin
if ExportTextFileToClipboard(Sender) then exit;

SaveDialog1.Filter := 'Pascal Source Files|*.pas|Pascal Include Files|*.inc|All Files|*.*';
if SaveDialog1.Execute then
begin
ExportAnimation(SaveDialog1.FileName,PascalLan);
end;
end;

procedure TAnimationForm.ExportBasicAnimDataClick(Sender: TObject);
begin
if ExportTextFileToClipboard(Sender) then exit;

SaveDialog1.Filter := 'Basic Source Files|*.bas|Basic Include Files|*.bi|All Files|*.*';
if SaveDialog1.Execute then
begin
ExportAnimation(SaveDialog1.FileName,PascalLan);
end;

end;

function TAnimationForm.ExportTextFileToClipboard(Sender: TObject) : boolean;
var
filename : string;
begin
if rmconfigbase.GetExportTextFileToClipStatus = false then
begin
result:=false;
exit;
end;

filename:=GetTemporaryPathAndFileName;
Case (Sender As TMenuItem).Name of 'ExportBasicAnimData':ExportAnimation(FileName,BasicLan);
'ExportBasicLNAnimData':ExportAnimation(FileName,BasicLNLan);
'ExportCAnimArray','ExportEmscriptenAnimArray','ExportgccAnimArray': ExportAnimation(FileName,CLan);
'ExportPascalAnimArray':ExportAnimation(FileName,PascalLan);

else
result:=false; //did not find a supported format return false
exit;
End;

result:=true; //found supported format - return true

ReadFileAndCopyToClipboard(filename);
EraseFile(filename);
ShowMessage('Exported to Clipboard!');
end;


procedure TAnimationForm.AnimDeleteMenuClick(Sender: TObject);
var
index : integer;
begin
index:=AllAnimListView.ItemIndex;
if index > -1 then DeleteAnimation(index);
end;



procedure TAnimationForm.DeleteAll;
begin
AnimateBase.DeleteAll;
AnimateBase.AddAnimation; //we need atleast one animation
// AnimateBase.DeleteAll;
AnimateBase.InitAnimation;

LoadCurrentAnimList;
LoadAnimThumbList;
Expand All @@ -295,6 +388,8 @@ procedure TAnimationForm.NewAnimationMenuClick(Sender: TObject);
AddAnimation;
end;



procedure TAnimationForm.PasteMenuClick(Sender: TObject);
var
index,ImageIndex : integer;
Expand Down Expand Up @@ -587,19 +682,27 @@ procedure TAnimationForm.AllAnimListViewShowHint(Sender: TObject;

end;

procedure TAnimationForm.AnimDeleteMenuClick(Sender: TObject);
var
index : integer;
begin
index:=AllAnimListView.ItemIndex;
if index > -1 then DeleteAnimation(index);
end;

procedure TAnimationForm.Arrow1Click(Sender: TObject);
begin

procedure TAnimationForm.AnimPropertiesClick(Sender: TObject);
var
EO : AnimExportFormatRec;
index : integer;
begin
index:=AllAnimListView.ItemIndex;
if index = -1 then exit;
AnimateBase.GetAnimExportProps(index,EO);
AnimationExportForm.InitComboBoxes;
AnimationExportForm.SetExportProps(EO);
if AnimationExportForm.ShowModal = mrOK then
begin
AnimationExportForm.GetExportProps(EO);
AnimateBase.SetAnimExportProps(index,EO);
end;
end;



procedure TAnimationForm.Button1Click(Sender: TObject);
begin
// Panel1.Canvas.Draw(10,10,AnimThumbImageList.
Expand Down Expand Up @@ -658,5 +761,7 @@ procedure TAnimationForm.DeleteMenuClick(Sender: TObject);
if index > -1 then DeleteFrame(Index);
end;



end.

Loading

0 comments on commit cc1fc5d

Please sign in to comment.