Skip to content

Commit

Permalink
v4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
RetroNick2020 committed Oct 7, 2024
1 parent 79a14c0 commit 2bf86f2
Show file tree
Hide file tree
Showing 11 changed files with 336 additions and 190 deletions.
4 changes: 4 additions & 0 deletions animate.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ object AnimationForm: TAnimationForm
Caption = 'Delete'
OnClick = MenuItem11Click
end
object MenuDeleteAll: TMenuItem
Caption = 'Delete All'
OnClick = MenuDeleteAllClick
end
object MenuItem7: TMenuItem
Caption = 'Export Anim As PNG''s'
OnClick = AnimExportMenuClick
Expand Down
42 changes: 30 additions & 12 deletions animate.pas
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ TAnimationForm = class(TForm)
MenuItem1: TMenuItem;
MenuItem10: TMenuItem;
MenuItem11: TMenuItem;
MenuDeleteAll: TMenuItem;
MenuItem2: TMenuItem;
MenuItem3: TMenuItem;
MenuItem4: TMenuItem;
Expand Down Expand Up @@ -70,10 +71,11 @@ TAnimationForm = class(TForm)
procedure DeleteMenuClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);

procedure AnimExportMenuClick(Sender: TObject);
procedure AnimCopyMenuClick(Sender: TObject);
procedure AnimPasteMenuClick(Sender: TObject);
procedure MenuDeleteAllClick(Sender: TObject);
procedure MenuItem10Click(Sender: TObject);
procedure MenuItem11Click(Sender: TObject);
procedure MenuItem2Click(Sender: TObject);
Expand Down Expand Up @@ -108,6 +110,7 @@ TAnimationForm = class(TForm)

procedure AddAnimation;
procedure DeleteAnimation(AnimationIndex : integer);
procedure DeleteAll;
procedure SelectAnimation(AnimationIndex : integer);

end;
Expand All @@ -123,18 +126,10 @@ implementation

procedure TAnimationForm.FormCreate(Sender: TObject);
begin
// SpriteListView.Hint:='hello';
// SpriteListView.ShowHint:=true;

// CurrentAnimListView.Hint:='hello2';
// CurrentAnimListView.ShowHint:=true;
FPSDelay:=1000 Div FPSTrackBar.Position;
end;

procedure TAnimationForm.FormPaint(Sender: TObject);
begin
//CurrentAnimationImageList.Draw(Panel1.Canvas,10,10,AnimFrameCounter,true);
end;


procedure TAnimationForm.AnimExportMenuClick(Sender: TObject);
var
Expand Down Expand Up @@ -199,6 +194,11 @@ procedure TAnimationForm.AnimPasteMenuClick(Sender: TObject);
end;
end;

procedure TAnimationForm.MenuDeleteAllClick(Sender: TObject);
begin
DeleteAll;
end;

procedure TAnimationForm.MenuItem10Click(Sender: TObject);
begin
AddEmptyFrame;
Expand Down Expand Up @@ -267,6 +267,18 @@ procedure TAnimationForm.DeleteAnimation(AnimationIndex : integer);
AllAnimListView.Repaint;
end;

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

LoadCurrentAnimList;
LoadAnimThumbList;

CurrentAnimListView.Repaint;
AllAnimListView.Repaint;
end;

procedure TAnimationForm.SelectAnimation(AnimationIndex : integer);
begin
AnimateBase.SetCurrentAnimation(AnimationIndex);
Expand Down Expand Up @@ -623,7 +635,13 @@ procedure TAnimationForm.CopyMenuClick(Sender: TObject);
index : integer;
begin
index:=CurrentAnimListView.ItemIndex;
if index > -1 then AnimateBase.CopyToClipBoard(AnimateBase.GetImageIndex(index),AnimateBase.GetUID(index));
if index > -1 then
begin
if AnimateBase.GetImageIndex(index) > -1 then //prevent copying empty frame - just use add frame
begin
AnimateBase.CopyToClipBoard(AnimateBase.GetImageIndex(index),AnimateBase.GetUID(index));
end;
end;
// info.Caption:='Copy: '+IntToStr(index)+' '+IntToStr(AnimateBase.GetImageIndex(index));
end;

Expand All @@ -637,7 +655,7 @@ procedure TAnimationForm.DeleteMenuClick(Sender: TObject);
begin
index:=CurrentAnimListView.ItemIndex;
// info.Caption:='Delete: '+IntToStr(index)+' '+IntToStr(AnimateBase.GetImageIndex(index));
DeleteFrame(Index);
if index > -1 then DeleteFrame(Index);
end;

end.
Expand Down
7 changes: 7 additions & 0 deletions animbase.pas
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ interface

procedure AddAnimation;
procedure DeleteAnimation(AnimationIndex : integer);
procedure DeleteAll;


procedure InitAnimation;
function GetAnimationCount : integer;
Expand Down Expand Up @@ -100,6 +102,11 @@ procedure TAnimateBase.InitAnimation;
Animations.AnimationList[Animations.CurrentAnimation].FrameCount:=0;
end;

procedure TAnimateBase.DeleteAll;
begin
InitAnimation;
end;

procedure TAnimateBase.InitClipBoard;
begin
AnimClipBoard.ClipBoardStatus:=False;
Expand Down
38 changes: 23 additions & 15 deletions mapcore.pas
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ interface

CurrentMap : integer;
MapCount : integer;

constructor Create;
procedure Init;


procedure SetListSize(size : integer);
Expand Down Expand Up @@ -190,21 +192,27 @@ implementation

constructor TMapCoreBase.Create;
begin
SetCurrentMap(0);
SetListSize(MaxListSize);
SetZoomSize(0,4);
// SetMapSize(0,DefMaxMapWidth,DefMaxMapHeight);
SetMapSize(0,16,16);
SetMapTileSize(0,64,64);
SetMapCount(1);
SetMapGridStatus(0,1); //grid on
SetMapClipStatus(0,0); //clip off
SetMapDrawTool(0,1); //pencil
SetMapTileMode(0,1); //draw
SetMapScrollVertPos(0,0);
SetMapScrollHorizPos(0,0);
CopyToUndo(0); //copy map 0 to undo - to init it
InitClipBoard;
Init;
end;

procedure TMapCoreBase.Init;
begin
SetCurrentMap(0);
SetListSize(MaxListSize);
SetZoomSize(0,4);
// SetMapSize(0,DefMaxMapWidth,DefMaxMapHeight);
SetMapSize(0,16,16);
SetMapTileSize(0,64,64);
SetMapCount(1);
SetMapGridStatus(0,1); //grid on
SetMapClipStatus(0,0); //clip off
SetMapDrawTool(0,1); //pencil
SetMapTileMode(0,1); //draw
SetMapScrollVertPos(0,0);
SetMapScrollHorizPos(0,0);
CopyToUndo(0); //copy map 0 to undo - to init it
InitClipBoard;

end;

procedure TMapCoreBase.SetListSize(size : integer);
Expand Down
35 changes: 24 additions & 11 deletions mapeditor.lfm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
object MapEdit: TMapEdit
Left = 237
Left = 175
Height = 860
Top = 153
Top = 269
Width = 1491
Caption = 'Map Editor'
ClientHeight = 860
Expand Down Expand Up @@ -38,23 +38,24 @@ object MapEdit: TMapEdit
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = LeftVertSplitter
Left = 1
Height = 221
Height = 287
Top = 1
Width = 287
Anchors = [akTop, akLeft, akRight, akBottom]
ClientHeight = 221
ClientHeight = 287
ClientWidth = 287
ParentFont = False
TabOrder = 0
object SelectedTileImage: TImage
AnchorSideLeft.Control = SelectedTilePanel
AnchorSideTop.Control = SelectedTilePanel
Left = 13
Height = 90
Height = 256
Top = 13
Width = 90
Width = 256
BorderSpacing.Left = 12
BorderSpacing.Top = 12
ImageWidth = 256
end
end
object LeftVertSplitter: TSplitter
Expand All @@ -66,7 +67,7 @@ object MapEdit: TMapEdit
Cursor = crVSplit
Left = 1
Height = 9
Top = 222
Top = 288
Width = 287
Align = alNone
Anchors = [akLeft, akRight]
Expand All @@ -84,19 +85,19 @@ object MapEdit: TMapEdit
AnchorSideBottom.Control = LeftPanel
AnchorSideBottom.Side = asrBottom
Left = 1
Height = 628
Top = 231
Height = 562
Top = 297
Width = 287
Anchors = [akTop, akLeft, akRight, akBottom]
Caption = 'LeftBottomPanel'
ClientHeight = 628
ClientHeight = 562
ClientWidth = 287
ParentColor = False
ParentFont = False
TabOrder = 2
object TileListView: TListView
Left = 1
Height = 626
Height = 560
Top = 1
Width = 285
Align = alClient
Expand Down Expand Up @@ -553,6 +554,10 @@ object MapEdit: TMapEdit
Caption = 'Delete'
OnClick = MenuDeleteClick
end
object MenuDeleteAll: TMenuItem
Caption = 'Delete All'
OnClick = MenuDeleteAllClick
end
object MenuItem3: TMenuItem
Caption = 'Export'
object MenuItem2: TMenuItem
Expand Down Expand Up @@ -776,6 +781,14 @@ object MapEdit: TMapEdit
object ExportMapsPropsMenu: TPopupMenu
Left = 64
Top = 506
object MenuPopupNew: TMenuItem
Caption = 'New'
OnClick = MenuNewClick
end
object MenuPopupDelete: TMenuItem
Caption = 'Delete'
OnClick = MenuDeleteClick
end
object MenuMapProps: TMenuItem
Caption = 'Properties'
OnClick = MenuMapPropsClick
Expand Down
Loading

0 comments on commit 2bf86f2

Please sign in to comment.