diff --git a/animationexport.lfm b/animationexport.lfm new file mode 100644 index 0000000..dcd1554 --- /dev/null +++ b/animationexport.lfm @@ -0,0 +1,77 @@ +object AnimationExportForm: TAnimationExportForm + Left = 1398 + Height = 222 + Top = 243 + Width = 388 + Caption = 'Animation Export Properties' + ClientHeight = 222 + ClientWidth = 388 + LCLVersion = '3.4.0.0' + object EditName: TEdit + Left = 120 + Height = 23 + Top = 24 + Width = 211 + MaxLength = 20 + ParentFont = False + TabOrder = 0 + end + object AnimationName: TLabel + Left = 75 + Height = 15 + Top = 32 + Width = 32 + Caption = 'Name' + ParentColor = False + ParentFont = False + end + object AnimationType: TLabel + Left = 24 + Height = 15 + Top = 102 + Width = 83 + Caption = 'Animation Type' + ParentColor = False + ParentFont = False + end + object ComboMap: TComboBox + Left = 120 + Height = 23 + Top = 102 + Width = 211 + ItemHeight = 15 + ParentFont = False + Style = csDropDownList + TabOrder = 1 + end + object CompilerType: TLabel + Left = 58 + Height = 15 + Top = 64 + Width = 49 + Caption = 'Compiler' + ParentColor = False + ParentFont = False + end + object ComboCompiler: TComboBox + Left = 120 + Height = 23 + Top = 64 + Width = 211 + ItemHeight = 15 + ParentFont = False + Style = csDropDownList + TabOrder = 2 + OnChange = ComboCompilerChange + end + object OKButton: TButton + Left = 280 + Height = 25 + Top = 176 + Width = 75 + Caption = 'OK' + ParentFont = False + TabOrder = 3 + OnClick = OKButtonClick + end +end diff --git a/animationexport.pas b/animationexport.pas new file mode 100644 index 0000000..1e7aba4 --- /dev/null +++ b/animationexport.pas @@ -0,0 +1,150 @@ +unit animationexport; + +{$mode ObjFPC}{$H+} + +interface + +uses + Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,AnimBase,rwxgf,rmcodegen; + +type + + { TAnimationExportForm } + + TAnimationExportForm = class(TForm) + ComboCompiler: TComboBox; + ComboMap: TComboBox; + CompilerType: TLabel; + EditName: TEdit; + AnimationName: TLabel; + AnimationType: TLabel; + OKButton: TButton; + procedure ComboCompilerChange(Sender: TObject); + procedure OKButtonClick(Sender: TObject); + private + + public + EO : AnimExportFormatRec; + procedure SetExportProps(props : AnimExportFormatRec); + procedure GetExportProps(var props : AnimExportFormatRec); + procedure InitComboBoxes; + procedure UpdateComboBoxes(compiler : integer); + + end; + +var + AnimationExportForm: TAnimationExportForm; + +implementation + +{$R *.lfm} + +procedure TAnimationExportForm.ComboCompilerChange(Sender: TObject); +begin + UpdateComboBoxes(ComboCompiler.ItemIndex); +end; + +procedure TAnimationExportForm.OKButtonClick(Sender: TObject); +begin + modalresult:= mrOk; +end; + +procedure TAnimationExportForm.SetExportProps(props : AnimExportFormatRec); +begin + EO:=props; + EditName.caption:=EO.Name; + ComboCompiler.ItemIndex:=EO.Lan; + ComboMap.ItemIndex:=EO.AnimateFormat; + UpdateComboBoxes(ComboCompiler.ItemIndex); +end; + +procedure TAnimationExportForm.GetExportProps(var props : AnimExportFormatRec); +begin + props.Name:=EditName.caption; + props.Lan:=ComboCompiler.ItemIndex; + props.AnimateFormat:=ComboMap.ItemIndex; +end; + +procedure TAnimationExportForm.InitComboBoxes; +begin + EditName.caption:=''; + Combocompiler.Items.Clear; + ComboCompiler.Items.Add('None'); + ComboCompiler.Items.Add('Basic'); + ComboCompiler.Items.Add('Basic (Line#)'); + ComboCompiler.Items.Add('C'); + ComboCompiler.Items.Add('Pascal'); + ComboCompiler.Items.Add('FreeBASIC'); + ComboCompiler.Items.Add('QB64'); + ComboCompiler.Items.Add('Amiga QuickBasic AQB'); + ComboCompiler.Items.Add('BAM Basic'); + ComboCompiler.ItemIndex:=0; + + ComboMap.Items.Clear; + ComboMap.Items.Add('None'); + ComboMap.ItemIndex:=0; + +end; + +procedure TAnimationExportForm.UpdateComboBoxes(compiler : integer); +begin + case compiler of NoLan:begin + ComboMap.Items.Clear; + ComboMap.Items.Add('None'); + ComboMap.ItemIndex:=0; + end; + BasicLan:begin + ComboMap.Items.Clear; + ComboMap.Items.Add('None'); + ComboMap.Items.Add('Simple'); + ComboMap.ItemIndex:=EO.AnimateFormat; + end; + BasicLNLan:begin + ComboMap.Items.Clear; + ComboMap.Items.Add('None'); + ComboMap.Items.Add('Simple'); + ComboMap.ItemIndex:=EO.AnimateFormat; + end; + PascalLan:begin + ComboMap.Items.Clear; + ComboMap.Items.Add('None'); + ComboMap.Items.Add('Simple'); + ComboMap.ItemIndex:=EO.AnimateFormat; + end; + CLan:begin + ComboMap.Items.Clear; + ComboMap.Items.Add('None'); + ComboMap.Items.Add('Simple'); + ComboMap.ItemIndex:=EO.AnimateFormat; + end; + FBBasicLan:begin + ComboMap.Items.Clear; + ComboMap.Items.Add('None'); + ComboMap.Items.Add('Simple'); + ComboMap.ItemIndex:=EO.AnimateFormat; + end; + QB64BasicLan:begin + ComboMap.Items.Clear; + ComboMap.Items.Add('None'); + ComboMap.Items.Add('Simple'); + ComboMap.ItemIndex:=EO.AnimateFormat; + end; + AQBBasicLan:begin + ComboMap.Items.Clear; + ComboMap.Items.Add('None'); + ComboMap.Items.Add('Simple'); + ComboMap.ItemIndex:=EO.AnimateFormat; + end; + BAMBasicLan:begin + ComboMap.Items.Clear; + ComboMap.Items.Add('None'); + ComboMap.Items.Add('Simple'); + ComboMap.ItemIndex:=EO.AnimateFormat; + end; + + end; +end; + + +end. + diff --git a/mapcore.pas b/mapcore.pas index 5933bf0..74a0e99 100644 --- a/mapcore.pas +++ b/mapcore.pas @@ -621,11 +621,16 @@ procedure TMapCoreBase.ClearMap(index, value : integer); procedure TMapCoreBase.SetMapTileSize(index, twidth,theight : integer); var zsize : integer; + nzwidth,nzheight : integer; begin Map[index].Props.TileWidth:=twidth; Map[index].Props.TileHeight:=theight; - zsize:=GetZoomTileSize(Map[index].Props.ZoomSize); - SetZoomMapTileSize(index,zsize,zsize); + + zsize:=GetZoomSize(index); + nzwidth:=5*zsize+twidth; + nzheight:=5*zsize+theight; + + SetZoomMapTileSize(index,nzwidth,nzheight); end; procedure TMapCoreBase.SetZoomMapTileSize(index, twidth,theight : integer); @@ -635,6 +640,8 @@ procedure TMapCoreBase.SetZoomMapTileSize(index, twidth,theight : integer); end; + +//not using this function - will remove in future versions //returns how big the tile will be when zoom is applied function TMapCoreBase.GetZoomTileSize(ZoomSize : integer) : integer; var diff --git a/mapeditor.lfm b/mapeditor.lfm index 5cae470..0c48d96 100644 --- a/mapeditor.lfm +++ b/mapeditor.lfm @@ -1,7 +1,7 @@ object MapEdit: TMapEdit - Left = 97 + Left = 105 Height = 860 - Top = 366 + Top = 217 Width = 1491 Caption = 'Map Editor' ClientHeight = 860 @@ -240,7 +240,6 @@ object MapEdit: TMapEdit Hint = 'Zoom Level' Top = 13 Width = 25 - Max = 6 Min = 1 OnChange = TileZoomChange Orientation = trVertical @@ -534,7 +533,7 @@ object MapEdit: TMapEdit end end object MainMenu1: TMainMenu - Left = 72 + Left = 80 Top = 304 object FileMenuItem: TMenuItem Caption = 'File' @@ -590,7 +589,7 @@ object MapEdit: TMapEdit end end end - object MenuItem4: TMenuItem + object MenuItem17: TMenuItem Caption = 'Edit' object Clear: TMenuItem Caption = 'Clear' @@ -598,6 +597,7 @@ object MapEdit: TMapEdit end object Undo: TMenuItem Caption = 'Undo' + OnClick = ToolUndoIconClick end object CloneMap: TMenuItem Caption = 'Clone' @@ -611,6 +611,13 @@ object MapEdit: TMapEdit Caption = 'Paste' OnClick = PasteFromClipBoardClick end + object Properties: TMenuItem + Caption = 'Properties' + OnClick = MenuMapPropsClick + end + end + object MenuItem4: TMenuItem + Caption = 'View' object MenuItem5: TMenuItem Caption = 'Resize Map To' object ReSizeMap8x8: TMenuItem @@ -641,9 +648,9 @@ object MapEdit: TMapEdit Enabled = False OnClick = ReSizeMapClick end - object SetCustomSize: TMenuItem + object SetMapCustomSize: TMenuItem Caption = 'Set Custom Size' - OnClick = SetCustomSizeClick + OnClick = SetMapCustomSizeClick end end object MenuItem9: TMenuItem @@ -672,16 +679,13 @@ object MapEdit: TMapEdit Caption = '256 X 256' OnClick = ReSizeTiles end - end - object Properties: TMenuItem - Caption = 'Properties' - OnClick = MenuMapPropsClick - end - end - object MenuItem17: TMenuItem - Caption = 'View' - object MenuItem18: TMenuItem - Caption = 'Refresh' + object ShowTileCustomSize: TMenuItem + Enabled = False + end + object SetTileCustomSize: TMenuItem + Caption = 'Set Custom Size' + OnClick = SetTileCustomSizeClick + end end end object MenuItem19: TMenuItem diff --git a/mapeditor.pas b/mapeditor.pas index 48e8c20..92a4d77 100644 --- a/mapeditor.pas +++ b/mapeditor.pas @@ -7,7 +7,7 @@ interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,Types, ComCtrls, Menus,rmthumb,mapcore,rwmap,mapexiportprops,rmcodegen,drawprocs,rmtools,rmclipboard, - rmconfig, LCLType,setcustommapsize; + rmconfig, LCLType,setcustommapsize,setcustomtilesize; const AddImage = 1; @@ -18,17 +18,22 @@ interface { TMapEdit } TMapEdit = class(TForm) - CopyToClipBoard: TMenuItem; GroupBox1: TGroupBox; MapImageList: TImageList; - MenuItem15: TMenuItem; + Clear: TMenuItem; CloneMap: TMenuItem; + CopyToClipBoard: TMenuItem; + Properties: TMenuItem; + PasteFromClipBoard: TMenuItem; + Undo: TMenuItem; + SetTileCustomSize: TMenuItem; + MenuItem15: TMenuItem; MenuDeleteAll: TMenuItem; + ShowTileCustomSize: TMenuItem; ShowCustomSize: TMenuItem; - SetCustomSize: TMenuItem; + SetMapCustomSize: TMenuItem; MenuPopupNew: TMenuItem; MenuPopupDelete: TMenuItem; - Properties: TMenuItem; Panel1: TPanel; RadioDraw: TRadioButton; RadioErase: TRadioButton; @@ -57,11 +62,8 @@ TMapEdit = class(TForm) ScrollLeftMenu: TMenuItem; ScrollUpMenu: TMenuItem; ScrollDownMenu: TMenuItem; - Undo: TMenuItem; - PasteFromClipBoard: TMenuItem; Panel2: TPanel; MenuItem10: TMenuItem; - Clear: TMenuItem; ExportCArray: TMenuItem; ExportPascalArray: TMenuItem; MenuItem13: TMenuItem; @@ -90,7 +92,6 @@ TMapEdit = class(TForm) ReSize256x256: TMenuItem; ReSizeMap64x64: TMenuItem; MenuItem17: TMenuItem; - MenuItem18: TMenuItem; MenuItem19: TMenuItem; TileModeDraw: TMenuItem; TileModeErase: TMenuItem; @@ -136,9 +137,9 @@ TMapEdit = class(TForm) procedure Button1Click(Sender: TObject); procedure CheckBoxDisplayGridChange(Sender: TObject); procedure CloneMapClick(Sender: TObject); + procedure CopyToClipBoardClick(Sender: TObject); - procedure CustomSizeMapDrawItem(Sender: TObject; ACanvas: TCanvas; - ARect: TRect; AState: TOwnerDrawState); + procedure FormActivate(Sender: TObject); procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); procedure FormCreate(Sender: TObject); @@ -168,7 +169,8 @@ TMapEdit = class(TForm) procedure MenuSaveClick(Sender: TObject); procedure PasteFromClipBoardClick(Sender: TObject); procedure ReSizeMapClick(Sender: TObject); - procedure SetCustomSizeClick(Sender: TObject); + procedure SetMapCustomSizeClick(Sender: TObject); + procedure SetTileCustomSizeClick(Sender: TObject); procedure TileModeDrawClick(Sender: TObject); procedure TileModeEraseClick(Sender: TObject); procedure RadioDrawClick(Sender: TObject); @@ -204,6 +206,7 @@ TMapEdit = class(TForm) procedure ToolUndoIconClick(Sender: TObject); procedure ToolVFLIPButtonClick(Sender: TObject); + private public @@ -323,7 +326,9 @@ procedure TMapEdit.Init; SetMapTileMode(1); //draw SetDrawTool(DrawShapePencil); CurrentMap:=MapCoreBase.GetCurrentMap; - MapCoreBase.SetZoomSize(CurrentMap,4); + MapCoreBase.SetZoomSize(CurrentMap,1); + TileZoom.Position:=MapCoreBase.GetZoomSize(CurrentMap); + MapCoreBase.SetMapTileSize(CurrentMap,32,32); TileWidth:=MapCoreBase.GetZoomMapTileWidth(CurrentMap); @@ -479,6 +484,9 @@ procedure TMapEdit.CloneMapClick(Sender: TObject); ShowMessage('Map Cloned!'); end; + + + procedure TMapEdit.CopyToClipBoardClick(Sender: TObject); var ca : MapClipAreaRec; @@ -487,11 +495,7 @@ procedure TMapEdit.CopyToClipBoardClick(Sender: TObject); MapCoreBase.CopyToClipBoard(MapCoreBase.GetCurrentMap,ca.x,ca.y,ca.x2,ca.y2); end; -procedure TMapEdit.CustomSizeMapDrawItem(Sender: TObject; ACanvas: TCanvas; - ARect: TRect; AState: TOwnerDrawState); -begin -end; procedure TMapEdit.PasteFromClipBoardClick(Sender: TObject); var @@ -647,6 +651,8 @@ procedure TMapEdit.ClearMapClick(Sender: TObject); MapCoreBase.ClearMap(CurrentMap,TileClear); VerifyTileImageList; MapPaintBox.Invalidate; + UpdateMapPreviewImageIcons(CurrentMap,UpdateImage); + MapListView.Repaint; end; @@ -882,12 +888,6 @@ procedure TMapEdit.MenuNewClick(Sender: TObject); MapPaintBox.Invalidate; end; - - - - - - procedure TMapEdit.MenuOpenClick(Sender: TObject); begin OpenDialog1.Filter := 'RM MAP Files|*.map|All Files|*.*'; @@ -914,6 +914,7 @@ procedure TMapEdit.MenuSaveClick(Sender: TObject); procedure TMapEdit.UpdateEditMenus; var mwidth,mheight : integer; + twidth,theight : integer; begin ReSizeMap8x8.Checked:=false; ReSizeMap16x16.Checked:=false; @@ -941,24 +942,30 @@ procedure TMapEdit.UpdateEditMenus; ShowCustomSize.Caption:=IntToStr(mwidth)+'x'+IntToStr(mheight); end; - - ReSize8x8.Checked:=false; ReSize16x16.Checked:=false; ReSize32x32.Checked:=false; ReSize64x64.Checked:=false; ReSize128x128.Checked:=false; ReSize256x256.Checked:=false; - - case MapCoreBase.GetMapTileWidth(MapCoreBase.GetCurrentMap) of 8: ReSize8x8.Checked:=true; - 16: ReSize16x16.Checked:=true; - 32: ReSize32x32.Checked:=true; - 64: ReSize64x64.Checked:=true; - 128: ReSize128x128.Checked:=true; - 256: ReSize256x256.Checked:=true; - + ShowTileCustomSize.Checked:=false; + ShowTileCustomSize.Caption:=''; + + twidth:=MapCoreBase.GetMapTileWidth(MapCoreBase.GetCurrentMap); + theight:=MapCoreBase.GetMapTileHeight(MapCoreBase.GetCurrentMap); + + if (twidth=8) and (theight=8) then ReSize8x8.Checked:=true + else if (twidth=16) and (theight=16) then ReSize16x16.Checked:=true + else if (twidth=32) and (theight=32) then ReSize32x32.Checked:=true + else if (twidth=64) and (theight=64) then ReSize64x64.Checked:=true + else if (twidth=128) and (theight=128) then ReSize128x128.Checked:=true + else if (twidth=256) and (theight=256) then ReSize256x256.Checked:=true + else + begin + ShowTileCustomSize.Checked:=true; + ShowTileCustomSize.Caption:=IntToStr(twidth)+'x'+IntToStr(theight); + MapCoreBase.SetMapTileSize(MapCoreBase.GetCurrentMap,twidth,theight); end; - end; procedure TMapEdit.ReSizeMapClick(Sender: TObject); @@ -989,6 +996,10 @@ procedure TMapEdit.ReSizeMapClick(Sender: TObject); mwidth:=256; mheight:=256; end; + 'SetMapCustomSize' :begin + mwidth:=setcustommapsizeform.SpinEditCustomWidth.Value; + mheight:=setcustommapsizeform.SpinEditCustomHeight.Value; + end; end; MapCoreBase.ResizeMapSize(CurrentMap,mwidth,mheight); @@ -1002,21 +1013,22 @@ procedure TMapEdit.ReSizeMapClick(Sender: TObject); MapListView.Repaint; end; -procedure TMapEdit.SetCustomSizeClick(Sender: TObject); +procedure TMapEdit.SetMapCustomSizeClick(Sender: TObject); begin if SetCustomMapSizeForm.ShowModal = mrOK then begin - MapCoreBase.ResizeMapSize(CurrentMap,SetCustomMapSizeForm.SpinEditCustomWidth.Value, - SetCustomMapSizeForm.SpinEditCustomHeight.Value); - - UpdateEditMenus; - UpdatePageSize; - MapPaintBox.Invalidate; - UpdateMapPreviewImageIcons(CurrentMap,UpdateImage); - MapListView.Repaint; + ReSizeMapClick(Sender); end; end; +procedure TMapEdit.SetTileCustomSizeClick(Sender: TObject); +begin + if SetCustomTileSizeForm.ShowModal = mrOK then + begin + ReSizeTiles(Sender); + end; +end; + procedure TMapEdit.TileModeDrawClick(Sender: TObject); begin TileMode:=1; @@ -1059,28 +1071,33 @@ procedure TMapEdit.ReSizeTiles(Sender: TObject); 'ReSize16x16' :begin tw:=16; th:=16; - zs:=2; + zs:=1; end; 'ReSize32x32' :begin tw:=32; th:=32; - zs:=3; + zs:=1; end; 'ReSize64x64' :begin tw:=64; th:=64; - zs:=4; + zs:=1; end; 'ReSize128x128' :begin tw:=128; th:=128; - zs:=5; + zs:=1; end; 'ReSize256x256' :begin tw:=256; th:=256; - zs:=6; + zs:=1; end; + 'SetTileCustomSize':begin + tw:=SetCustomTileSizeForm.SpinEditTileWidth.Value; + th:=SetCustomTileSizeForm.SpinEditTileHeight.Value; + zs:=1; + end; End; MapCoreBase.SetZoomSize(CurrentMap,zs); diff --git a/rm.lpi b/rm.lpi index 0d795ac..ca438b0 100644 --- a/rm.lpi +++ b/rm.lpi @@ -146,7 +146,7 @@ - + @@ -360,6 +360,26 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/rm.lpr b/rm.lpr index 60e1315..707996d 100644 --- a/rm.lpr +++ b/rm.lpr @@ -13,7 +13,7 @@ gwbasic, spriteimport, wraylib, rmcodegen, rwaqb, rmapi, rmcolorxga, fileprops, drawprocs, rmconfig, rmclipboard, soundgen, usfxr, SpriteSheetExport, animate, AnimBase, setcustommapsize, animationexport, -rwspriteanim +rwspriteanim, setcustomspritesize, setcustomtilesize, SetCustomCellSize { you can add units after this }; {$R *.res} @@ -38,6 +38,9 @@ Application.CreateForm(TAnimationForm, AnimationForm); Application.CreateForm(TSetCustomMapSizeForm, SetCustomMapSizeForm); Application.CreateForm(TAnimationExportForm, AnimationExportForm); + Application.CreateForm(Tsetcustomspritesizeform, setcustomspritesizeform); + Application.CreateForm(TSetCustomTileSizeForm, SetCustomTileSizeForm); + Application.CreateForm(TSetCustomCellSizeForm, SetCustomCellSizeForm); Application.Run; end. diff --git a/rmabout.pas b/rmabout.pas index ad56feb..e5c3cce 100644 --- a/rmabout.pas +++ b/rmabout.pas @@ -8,8 +8,8 @@ interface Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,lclintf; Const - ProgramName ='Raster Master v4.8 R115'; - ProgramLicense = 'Released October 22 - 2024 under MIT License'; + ProgramName ='Raster Master v5.1 R118 Halloween Edition'; + ProgramLicense = 'Released October 31 - 2024 under MIT License'; type diff --git a/rmmain.lfm b/rmmain.lfm index ea1abc6..eb8b7c9 100644 --- a/rmmain.lfm +++ b/rmmain.lfm @@ -1,7 +1,7 @@ object RMMainForm: TRMMainForm - Left = 383 + Left = 261 Height = 854 - Top = 155 + Top = 190 Width = 1491 Align = alClient Caption = 'Raster Master' @@ -486,6 +486,7 @@ object RMMainForm: TRMMainForm Hint = 'Zoom Level' Top = 1 Width = 30 + Max = 20 Min = 1 OnChange = ZoomTrackBarChange Orientation = trVertical @@ -1056,8 +1057,35 @@ object RMMainForm: TRMMainForm end object MenuEdit: TMenuItem Caption = 'Edit' - object EditResizeTo: TMenuItem - Caption = 'Resize To' + object EditClear: TMenuItem + Caption = 'Clear' + OnClick = EditClearClick + end + object EditClone: TMenuItem + Caption = 'Clone' + OnClick = EditCloneClick + end + object EditUndo: TMenuItem + Caption = 'Undo' + OnClick = ToolUndoIconClick + end + object EditCopy: TMenuItem + Caption = 'Copy' + OnClick = EditCopyClick + end + object EditPaste: TMenuItem + Caption = 'Paste' + OnClick = EditPasteClick + end + object EditProperties: TMenuItem + Caption = 'Properties' + OnClick = PropertiesClick + end + end + object MenuItem17: TMenuItem + Caption = 'View' + object MenuItem18: TMenuItem + Caption = 'Sprite Size' object EditResizeTo8: TMenuItem Caption = '8 X 8' OnClick = EditResizeToNewSize @@ -1082,30 +1110,35 @@ object RMMainForm: TRMMainForm Caption = '256 X 256' OnClick = EditResizeToNewSize end + object ShowCustomSize: TMenuItem + Enabled = False + end + object EditResizeCustom: TMenuItem + Caption = 'Set Custom Size' + OnClick = EditResizeCustomClick + end end - object EditClear: TMenuItem - Caption = 'Clear' - OnClick = EditClearClick - end - object EditClone: TMenuItem - Caption = 'Clone' - OnClick = EditCloneClick - end - object EditUndo: TMenuItem - Caption = 'Undo' - OnClick = ToolUndoIconClick - end - object EditCopy: TMenuItem - Caption = 'Copy' - OnClick = EditCopyClick - end - object EditPaste: TMenuItem - Caption = 'Paste' - OnClick = EditPasteClick - end - object EditProperties: TMenuItem - Caption = 'Properties' - OnClick = PropertiesClick + object MenuItem27: TMenuItem + Caption = 'Grid Cell Size' + object gcNormal: TMenuItem + Caption = 'Normal (10 X 9)' + OnClick = SetGridCellClick + end + object gcWide: TMenuItem + Caption = 'Wide (16 X 8)' + OnClick = SetGridCellClick + end + object gcTall: TMenuItem + Caption = 'Tall (10 X 18)' + OnClick = SetGridCellClick + end + object gcCustomShow: TMenuItem + Enabled = False + end + object gcCustom: TMenuItem + Caption = 'Set Custom Size' + OnClick = SetCustomGridCellClick + end end end object MenuItem4: TMenuItem diff --git a/rmmain.pas b/rmmain.pas index 2973d2f..c717c9d 100644 --- a/rmmain.pas +++ b/rmmain.pas @@ -11,7 +11,7 @@ interface rmcolor, rmcolorvga, rmcolorxga, rmamigaColor, rmabout, rwpal, rwraw, rwpcx, rwbmp, rmamigarwxgf, wjavascriptarray, rmthumb, wmodex, rwgif, rwxgf, rmexportprops, rres, rwpng, wmouse, mapeditor, spriteimport,spritesheetexport, wraylib, rwilbm, rwaqb, rmapi,rmxgfcore, - fileprops,rmconfig,rmclipboard,soundgen,animate; + fileprops,rmconfig,rmclipboard,soundgen,animate,setcustomspritesize,SetCustomCellSize; type @@ -35,14 +35,7 @@ TRMMainForm = class(TForm) EditCopy: TMenuItem; EditPaste: TMenuItem; EditColor: TMenuItem; - EditResizeTo128: TMenuItem; - EditResizeTo256: TMenuItem; EditUndo: TMenuItem; - EditResizeTo: TMenuItem; - EditResizeTo8: TMenuItem; - EditResizeTo16: TMenuItem; - EditResizeTo32: TMenuItem; - EditResizeTo64: TMenuItem; EditClear: TMenuItem; JavaScript: TMenuItem; ACVSpriteColorArray: TMenuItem; @@ -76,6 +69,22 @@ TRMMainForm = class(TForm) EditProperties: TMenuItem; BAMRGBPutData: TMenuItem; DeleteImage: TMenuItem; + MenuItem17: TMenuItem; + MenuItem18: TMenuItem; + EditResizeTo8: TMenuItem; + EditResizeTo16: TMenuItem; + EditResizeTo32: TMenuItem; + EditResizeTo64: TMenuItem; + EditResizeTo128: TMenuItem; + EditResizeTo256: TMenuItem; + ShowCustomSize: TMenuItem; + EditResizeCustom: TMenuItem; + MenuItem27: TMenuItem; + gcNormal: TMenuItem; + gcWide: TMenuItem; + gcTall: TMenuItem; + gcCustomShow: TMenuItem; + gcCustom: TMenuItem; SpriteAnimationMenu: TMenuItem; SpriteExportMenu: TMenuItem; SoundGenerator: TMenuItem; @@ -358,6 +367,8 @@ TRMMainForm = class(TForm) procedure FormDestroy(Sender: TObject); procedure FreeBASICClick(Sender: TObject); procedure FreePascalClick(Sender: TObject); + procedure SetCustomGridCellClick(Sender: TObject); + procedure SetGridCellClick(Sender: TObject); procedure GWBASICClick(Sender: TObject); procedure EditResizeToNewSize(Sender: TObject); procedure javaScriptArrayClick(Sender: TObject); @@ -365,6 +376,7 @@ TRMMainForm = class(TForm) procedure ListView1Click(Sender: TObject); procedure DeleteAllClick(Sender: TObject); procedure MapEditMenuClick(Sender: TObject); + procedure EditResizeCustomClick(Sender: TObject); procedure SoundGeneratorClick(Sender: TObject); procedure SpriteAnimationMenuClick(Sender: TObject); procedure SpriteExportMenuClick(Sender: TObject); @@ -2203,6 +2215,52 @@ procedure TRMMainForm.FreePascalClick(Sender: TObject); end; end; +procedure TRMMainForm.SetCustomGridCellClick(Sender: TObject); +begin + if SetCustomCellSizeForm.ShowModal = mrOK then + begin + SetGridCellClick(Sender); + end; +end; + +procedure TRMMainForm.SetGridCellClick(Sender: TObject); +begin + if (Sender As TMenuItem).Name = 'gcNormal' then + begin + RMDrawTools.SetCellWidthMin(10); + RMDrawTools.SetCellHeightMin(9); + end + else if (Sender As TMenuItem).Name = 'gcWide' then + begin + RMDrawTools.SetCellWidthMin(16); + RMDrawTools.SetCellHeightMin(8); + end + else if (Sender As TMenuItem).Name = 'gcTall' then + begin + RMDrawTools.SetCellWidthMin(8); + RMDrawTools.SetCellHeightMin(16); + end + else if (Sender As TMenuItem).Name = 'gcCustom' then + begin + RMDrawTools.SetCellWidthMin(setcustomcellsizeform.SpinEditCellWidth.Value); + RMDrawTools.SetCellHeightMin(setcustomcellsizeform.SpinEditCellHeight.Value); + end; + + RMDrawTools.SetZoomSize(ZoomSize); + ZoomPaintBox.Width:=RMDrawTools.GetZoomPageWidth; + ZoomPaintBox.Height:=RMDrawTools.GetZoomPageHeight; + + RMDrawTools.SetZoomMaxX(RMDrawTools.GetZoomPageWidth); + RMDrawTools.SetZoomMaxY(RMDrawTools.GetZoomPageHeight); + RMDrawTools.SetClipStatus(0); // turn off in case clip area is bigger than work area + + ZoomTrackBar.Position:=RMDrawTools.GetZoomSize;; + UpdateActualArea; + UpdateZoomArea; + UpdateThumbView; + UpdateEditMenu; +end; + procedure TRMMainForm.GWBASICClick(Sender: TObject); @@ -2234,6 +2292,9 @@ procedure TRMMainForm.GWBASICClick(Sender: TObject); end; Procedure TRMMainForm.UpdateEditMenu; +var + swidth,sheight : integer; + gcWidth,gcHeight : integer; begin EditResizeTo8.Checked:=false; EditResizeTo16.Checked:=false; @@ -2241,30 +2302,50 @@ procedure TRMMainForm.GWBASICClick(Sender: TObject); EditResizeTo64.Checked:=false; EditResizeTo128.Checked:=false; EditResizeTo256.Checked:=false; - case RMCoreBase.GetWidth of 8: EditResizeTo8.Checked:=true; - 16: EditResizeTo16.Checked:=true; - 32: EditResizeTo32.Checked:=true; - 64: EditResizeTo64.Checked:=true; - 128: EditResizeTo128.Checked:=true; - 256: EditResizeTo256.Checked:=true; - + ShowCustomSize.Checked:=false; + ShowCustomSize.Caption:=''; + + swidth:=RMCoreBase.GetWidth; + sheight:=RMCoreBase.GetHeight; + if (swidth=8) and (sheight=8) then EditResizeTo8.Checked:=true + else if (swidth=16) and (sheight=16) then EditResizeTo16.Checked:=true + else if (swidth=32) and (sheight=32) then EditResizeTo32.Checked:=true + else if (swidth=64) and (sheight=64) then EditResizeTo64.Checked:=true + else if (swidth=128) and (sheight=128) then EditResizeTo128.Checked:=true + else if (swidth=256) and (sheight=256) then EditResizeTo256.Checked:=true + else + begin + ShowCustomSize.Caption:=IntToStr(swidth)+'x'+IntToStr(sheight); + ShowCustomSize.Checked:=true; + RMCoreBase.SetWidth(swidth); + RMCoreBase.SetHeight(sheight); end; + + gcNormal.Checked:=false; + gcWide.Checked:=false; + gcTall.Checked:=false; + gcCustomShow.Checked:=false; + gcWidth:=RMDrawTools.GetCellWidth; + gcHeight:=RMDrawTools.GetCellHeight; + end; procedure TRMMainForm.EditResizeToNewSize(Sender: TObject); var - ImgWidth,ImgHeight : integer; + ImgWidth,ImgHeight,zsize : integer; begin - + zsize:=2; if (Sender As TMenuItem).Name = 'EditResizeTo8' then begin ImgWidth:=8; ImgHeight:=8; + zsize:=9; end else if (Sender As TMenuItem).Name = 'EditResizeTo16' then begin ImgWidth:=16; ImgHeight:=16; + zsize:=4; end else if (Sender As TMenuItem).Name = 'EditResizeTo32' then begin @@ -2285,12 +2366,20 @@ procedure TRMMainForm.EditResizeToNewSize(Sender: TObject); begin ImgWidth:=256; ImgHeight:=256; + end + else if (Sender As TMenuItem).Name = 'EditResizeCustom' then + begin + ImgWidth:=setcustomspritesizeform.SpinEditWidth.Value; + ImgHeight:=setcustomspritesizeform.SpinEditHeight.Value; end; - // ActualBox.Width:=ImgWidth; + + + + // ActualBox.Width:=ImgWidth; // ActualBox.Height:=ImgHeight; RMCoreBase.SetWidth(ImgWidth); RMCoreBase.SetHeight(ImgHeight); - RMDrawTools.SetZoomSize(1); + RMDrawTools.SetZoomSize(zsize); ZoomPaintBox.Width:=RMDrawTools.GetZoomPageWidth; ZoomPaintBox.Height:=RMDrawTools.GetZoomPageHeight; @@ -2299,7 +2388,7 @@ procedure TRMMainForm.EditResizeToNewSize(Sender: TObject); RMDrawTools.SetZoomMaxY(RMDrawTools.GetZoomPageHeight); RMDrawTools.SetClipStatus(0); // turn off in case clip area is bigger than work area ZoomSize:=RMDrawTools.GetZoomSize; - + ZoomTrackBar.Position:=ZoomSize; UpdateActualArea; UpdateZoomArea; UpdateThumbView; @@ -3739,6 +3828,14 @@ procedure TRMMainForm.MapEditMenuClick(Sender: TObject); MapEdit.WindowState:=wsNormal; end; +procedure TRMMainForm.EditResizeCustomClick(Sender: TObject); +begin + if SetCustomSpriteSizeForm.ShowModal = mrOK then + begin + EditResizeToNewSize(Sender); + end; +end; + procedure TRMMainForm.SoundGeneratorClick(Sender: TObject); begin SoundGeneratorForm.Show; diff --git a/rmthumb.pas b/rmthumb.pas index ea45957..40250d6 100644 --- a/rmthumb.pas +++ b/rmthumb.pas @@ -656,7 +656,7 @@ procedure TImageThumb.OpenProject(filename : string;insertmode : boolean); if IORESULT <>0 then exit; if (head.sig=RMProjectSig) and (head.version=RMProjectVersion) then begin - //delete all current images - use should be warn when oopening files + //delete all current images - user should be warn when oopening files count:=head.ImageCount; IndexOffset:=0; @@ -674,7 +674,7 @@ procedure TImageThumb.OpenProject(filename : string;insertmode : boolean); ReadImageFromProject(F,i+indexoffset); end; - ReadAllMapsF(F,head.MapCount,insertmode); + ReadAllMapsF(F,head.MapCount,insertmode); //there is always atleast one map - even if it blank if head.AnimCount > 0 then AnimateBase.ReadAnimations(F,head.AnimCount,InsertMode); end; diff --git a/rmtools.pas b/rmtools.pas index d462871..4d8f287 100644 --- a/rmtools.pas +++ b/rmtools.pas @@ -42,7 +42,10 @@ interface end; TGridAreaRec = Record - CellWidth : integer; + CellWidthMin : integer; //the starting cell width and height + CellHeightMin : integer; + + CellWidth : integer; //cell width is the result of zoomsize*CellWidthMin CellHeight : integer; GridThickX : integer; GridThickY : integer; @@ -94,8 +97,18 @@ TRMDrawTools = class(TObject) procedure Rect(Image : TCanvas;x,y,x2,y2 : integer;color : TColor; mode,full : integer); procedure SetGridThickX(amount : integer); procedure SetGridThickY(amount : integer); + procedure SetCellWidth(cWidth : integer); procedure SetCellHeight(cHeight : integer); + function GetCellWidth : integer; + function GetCellHeight : integer; + + procedure SetCellWidthMin(cWidthMin : integer); + procedure SetCellHeightMin(cHeightMin : integer); + function GetCellWidthMin : integer; + function GetCellHeightMin : integer; + + function GetCellsPerRow(ImageWidth : integer) : integer; function GetCellsPerCol(ImageHeight : integer) : integer; function GetMaxXOffset(ActualImageWidth,ZoomImageWidth : integer) : integer; @@ -170,9 +183,12 @@ implementation procedure TRMDrawTools.Init; begin + SetCellWidthMin(10); + SetCellHeightMin(9); SetZoomMode(1); SetZoomSize(2); SetGridMode(1); + SetDrawTool(DrawShapePencil); SetClipStatus(0); //off SetClipSizedStatus(0); @@ -920,6 +936,39 @@ procedure TRMDrawTools.SetCellHeight(cHeight : integer); GridArea.CellHeight:=cHeight; end; +procedure TRMDrawTools.SetCellWidthMin(cWidthMin : integer); +begin + GridArea.CellWidthMin:=cWidthMin; +end; + +procedure TRMDrawTools.SetCellHeightMin(cHeightMin : integer); +begin + GridArea.CellHeightMin:=cHeightMin; +end; + + +function TRMDrawTools.GetCellWidth : integer; +begin + result:=GridArea.CellWidth; +end; + +function TRMDrawTools.GetCellHeight : integer; +begin + result:=GridArea.CellHeight; +end; + +function TRMDrawTools.GetCellWidthMin : integer; +begin + result:=GridArea.CellWidthMin; +end; + +function TRMDrawTools.GetCellHeightMin : integer; +begin + result:=GridArea.CellHeightMin; +end; + + + function TRMDrawTools.GetCellsPerRow(ImageWidth : integer) : integer; begin GetCellsPerRow:=(ImageWidth div GridArea.CellWidth); @@ -1004,19 +1053,13 @@ procedure TRMDrawTools.SetZoomMode(mode : integer); end; procedure TRMDrawTools.SetZoomSize(size : integer); -var - XMulti : integer; - YMulti : integer; - begin - if size > 10 then size:=10; + if size > 20 then size:=20; if size < 1 then size:=1; GridArea.ZoomSize:=size; - XMulti:=10; - YMulti:=9; - + (* if RMCoreBase.GetWidth = 8 then begin If GridArea.ZoomSize < 4 then GridArea.ZoomSize:=4; @@ -1029,8 +1072,9 @@ procedure TRMDrawTools.SetZoomSize(size : integer); begin If GridArea.ZoomSize < 2 then GridArea.ZoomSize:=2; end; - SetCellWidth(GridArea.ZoomSize*XMulti); - SetCellHeight(GridArea.ZoomSize*YMulti); + *) + SetCellWidth(GridArea.ZoomSize*GetCellWidthMin); + SetCellHeight(GridArea.ZoomSize*GetCellHeightMin); end; function TRMDrawTools.GetZoomSize : integer; diff --git a/setcustomcellsize.lfm b/setcustomcellsize.lfm new file mode 100644 index 0000000..43a19a0 --- /dev/null +++ b/setcustomcellsize.lfm @@ -0,0 +1,60 @@ +object SetCustomCellSizeForm: TSetCustomCellSizeForm + Left = 755 + Height = 179 + Top = 476 + Width = 320 + BorderStyle = bsDialog + Caption = 'Set Custom Cell Size' + ClientHeight = 179 + ClientWidth = 320 + LCLVersion = '3.4.0.0' + object SpinEditCellWidth: TSpinEditEx + Left = 80 + Height = 23 + Top = 32 + Width = 103 + MaxLength = 0 + NumbersOnly = True + TabOrder = 0 + MaxValue = 16 + MinValue = 8 + NullValue = 0 + Value = 14 + end + object SpinEditCellHeight: TSpinEditEx + Left = 80 + Height = 23 + Top = 64 + Width = 103 + MaxLength = 0 + NumbersOnly = True + TabOrder = 1 + MaxValue = 16 + MinValue = 8 + NullValue = 0 + Value = 16 + end + object Label1: TLabel + Left = 40 + Height = 15 + Top = 32 + Width = 32 + Caption = 'Width' + end + object Label2: TLabel + Left = 40 + Height = 15 + Top = 64 + Width = 36 + Caption = 'Height' + end + object OKButton: TButton + Left = 216 + Height = 25 + Top = 128 + Width = 75 + Caption = 'OK' + TabOrder = 2 + OnClick = OKButtonClick + end +end diff --git a/setcustomcellsize.pas b/setcustomcellsize.pas new file mode 100644 index 0000000..8b3e9cf --- /dev/null +++ b/setcustomcellsize.pas @@ -0,0 +1,42 @@ +unit setcustomcellsize; + +{$mode ObjFPC}{$H+} + +interface + +uses + Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, SpinEx; + +type + + { TSetCustomCellSizeForm } + + TSetCustomCellSizeForm = class(TForm) + OKButton: TButton; + Label1: TLabel; + Label2: TLabel; + SpinEditCellWidth: TSpinEditEx; + SpinEditCellHeight: TSpinEditEx; + procedure OKButtonClick(Sender: TObject); + private + + public + + end; + +var + SetCustomCellSizeForm: TSetCustomCellSizeForm; + +implementation + +{$R *.lfm} + +{ TSetCustomCellSizeForm } + +procedure TSetCustomCellSizeForm.OKButtonClick(Sender: TObject); +begin + modalresult:= mrOk; +end; + +end. + diff --git a/setcustomspritesize.lfm b/setcustomspritesize.lfm new file mode 100644 index 0000000..c0cea5e --- /dev/null +++ b/setcustomspritesize.lfm @@ -0,0 +1,60 @@ +object setcustomspritesizeform: Tsetcustomspritesizeform + Left = 811 + Height = 211 + Top = 499 + Width = 320 + BorderStyle = bsDialog + Caption = 'Set Custom Sprite Size' + ClientHeight = 211 + ClientWidth = 320 + LCLVersion = '3.4.0.0' + object SpinEditWidth: TSpinEditEx + Left = 128 + Height = 23 + Top = 35 + Width = 103 + MaxLength = 0 + NumbersOnly = True + TabOrder = 0 + MaxValue = 256 + MinValue = 8 + NullValue = 0 + Value = 48 + end + object SpinEditHeight: TSpinEditEx + Left = 128 + Height = 23 + Top = 72 + Width = 103 + MaxLength = 0 + NumbersOnly = True + TabOrder = 1 + MaxValue = 256 + MinValue = 8 + NullValue = 0 + Value = 48 + end + object OKButton: TButton + Left = 208 + Height = 25 + Top = 152 + Width = 75 + Caption = 'OK' + TabOrder = 2 + OnClick = OKButtonClick + end + object SpriteWidth: TLabel + Left = 32 + Height = 15 + Top = 40 + Width = 65 + Caption = 'Sprite Width' + end + object SpriteHeight: TLabel + Left = 32 + Height = 15 + Top = 72 + Width = 69 + Caption = 'Sprite Height' + end +end diff --git a/setcustomspritesize.pas b/setcustomspritesize.pas new file mode 100644 index 0000000..04be737 --- /dev/null +++ b/setcustomspritesize.pas @@ -0,0 +1,42 @@ +unit setcustomspritesize; + +{$mode ObjFPC}{$H+} + +interface + +uses + Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, SpinEx; + +type + + { Tsetcustomspritesizeform } + + Tsetcustomspritesizeform = class(TForm) + SpriteHeight: TLabel; + SpriteWidth: TLabel; + OKButton: TButton; + SpinEditWidth: TSpinEditEx; + SpinEditHeight: TSpinEditEx; + procedure OKButtonClick(Sender: TObject); + private + + public + + end; + +var + setcustomspritesizeform: Tsetcustomspritesizeform; + +implementation + +{$R *.lfm} + +{ Tsetcustomspritesizeform } + +procedure Tsetcustomspritesizeform.OKButtonClick(Sender: TObject); +begin + modalresult:= mrOk; +end; + +end. + diff --git a/setcustomtilesize.lfm b/setcustomtilesize.lfm new file mode 100644 index 0000000..2584dae --- /dev/null +++ b/setcustomtilesize.lfm @@ -0,0 +1,60 @@ +object SetCustomTileSizeForm: TSetCustomTileSizeForm + Left = 755 + Height = 180 + Top = 461 + Width = 309 + BorderStyle = bsDialog + Caption = 'Set Custom Tile Size' + ClientHeight = 180 + ClientWidth = 309 + LCLVersion = '3.4.0.0' + object Button1: TButton + Left = 216 + Height = 25 + Top = 136 + Width = 75 + Caption = 'OK' + TabOrder = 0 + OnClick = Button1Click + end + object SpinEditTileWidth: TSpinEditEx + Left = 96 + Height = 23 + Top = 39 + Width = 103 + MaxLength = 0 + NumbersOnly = True + TabOrder = 1 + MaxValue = 256 + MinValue = 8 + NullValue = 0 + Value = 48 + end + object SpinEditTileHeight: TSpinEditEx + Left = 96 + Height = 23 + Top = 72 + Width = 103 + MaxLength = 0 + NumbersOnly = True + TabOrder = 2 + MaxValue = 256 + MinValue = 8 + NullValue = 0 + Value = 48 + end + object Label1: TLabel + Left = 52 + Height = 15 + Top = 39 + Width = 32 + Caption = 'Width' + end + object Label2: TLabel + Left = 48 + Height = 15 + Top = 72 + Width = 36 + Caption = 'Height' + end +end diff --git a/setcustomtilesize.pas b/setcustomtilesize.pas new file mode 100644 index 0000000..a2a0232 --- /dev/null +++ b/setcustomtilesize.pas @@ -0,0 +1,42 @@ +unit setcustomtilesize; + +{$mode ObjFPC}{$H+} + +interface + +uses + Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, SpinEx; + +type + + { TSetCustomTileSizeForm } + + TSetCustomTileSizeForm = class(TForm) + Button1: TButton; + Label1: TLabel; + Label2: TLabel; + SpinEditTileWidth: TSpinEditEx; + SpinEditTileHeight: TSpinEditEx; + procedure Button1Click(Sender: TObject); + private + + public + + end; + +var + SetCustomTileSizeForm: TSetCustomTileSizeForm; + +implementation + +{$R *.lfm} + +{ TSetCustomTileSizeForm } + +procedure TSetCustomTileSizeForm.Button1Click(Sender: TObject); +begin + modalresult:= mrOk; +end; + +end. + diff --git a/spriteimport.lfm b/spriteimport.lfm index fee7c50..7b9dd1c 100644 --- a/spriteimport.lfm +++ b/spriteimport.lfm @@ -1,7 +1,7 @@ object SpriteImportForm: TSpriteImportForm - Left = 414 + Left = 391 Height = 620 - Top = 374 + Top = 393 Width = 1165 Caption = 'Sprite Sheet Import' ClientHeight = 620 @@ -36,7 +36,7 @@ object SpriteImportForm: TSpriteImportForm OnClick = OpenSpriteSheetClick end object SpriteSizeLabel: TLabel - Left = 339 + Left = 401 Height = 15 Top = 19 Width = 53 @@ -45,7 +45,7 @@ object SpriteImportForm: TSpriteImportForm ParentFont = False end object SpriteSizeComboBox: TComboBox - Left = 416 + Left = 463 Height = 23 Top = 13 Width = 100 @@ -58,6 +58,7 @@ object SpriteImportForm: TSpriteImportForm '64 X 64' '128 X 128' '256 X 256' + 'Custom' ) ParentFont = False Style = csDropDownList @@ -66,7 +67,7 @@ object SpriteImportForm: TSpriteImportForm OnChange = SpriteSizeComboBoxChange end object NewPaletteComboBox: TComboBox - Left = 728 + Left = 776 Height = 23 Top = 13 Width = 237 @@ -84,7 +85,7 @@ object SpriteImportForm: TSpriteImportForm OnChange = NewPaletteComboBoxChange end object PaletteComboBox: TComboBox - Left = 552 + Left = 616 Height = 23 Top = 13 Width = 134 @@ -122,9 +123,9 @@ object SpriteImportForm: TSpriteImportForm OnClick = ImportFromClipboardClick end object CheckBoxDisplayGrid: TCheckBox - Left = 416 + Left = 616 Height = 19 - Top = 54 + Top = 48 Width = 81 Caption = 'Display Grid' Checked = True @@ -133,9 +134,9 @@ object SpriteImportForm: TSpriteImportForm OnChange = CheckBoxDisplayGridChange end object CheckBoxSnapToGrid: TCheckBox - Left = 416 + Left = 616 Height = 19 - Top = 88 + Top = 80 Width = 83 Caption = 'Snap to Grid' Checked = True @@ -156,6 +157,48 @@ object SpriteImportForm: TSpriteImportForm BorderSpacing.Around = 10 Panels = <> end + object SpinEditWidth: TSpinEditEx + Left = 464 + Height = 23 + Top = 48 + Width = 100 + MaxLength = 0 + NumbersOnly = True + TabOrder = 8 + OnChange = SpinEditWidthHeightChange + MaxValue = 256 + MinValue = 8 + NullValue = 0 + Value = 48 + end + object SpinEditHeight: TSpinEditEx + Left = 464 + Height = 23 + Top = 80 + Width = 99 + MaxLength = 0 + NumbersOnly = True + TabOrder = 9 + OnChange = SpinEditWidthHeightChange + MaxValue = 256 + MinValue = 8 + NullValue = 0 + Value = 48 + end + object Label1: TLabel + Left = 344 + Height = 15 + Top = 56 + Width = 110 + Caption = 'Custom Sprite Width' + end + object Label2: TLabel + Left = 340 + Height = 15 + Top = 80 + Width = 114 + Caption = 'Custom Sprite Height' + end end object SpriteSheetScrollBox: TScrollBox AnchorSideLeft.Control = Owner diff --git a/spriteimport.pas b/spriteimport.pas index c2d054c..7a86019 100644 --- a/spriteimport.pas +++ b/spriteimport.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, ComCtrls, - StdCtrls, ExtDlgs,Clipbrd,LCLIntf,LCLType,rwpng,rmcore,rmthumb; + StdCtrls, ExtDlgs,Clipbrd,LCLIntf,LCLType, SpinEx,rwpng,rmcore,rmthumb; type @@ -15,8 +15,12 @@ interface TSpriteImportForm = class(TForm) CheckBoxDisplayGrid: TCheckBox; CheckBoxSnapToGrid: TCheckBox; + Label1: TLabel; + Label2: TLabel; OpenDialog1: TOpenDialog; ImportFromClipboard: TButton; + SpinEditWidth: TSpinEditEx; + SpinEditHeight: TSpinEditEx; SpriteSheetPaintBox: TPaintBox; SpriteSizeComboBox: TComboBox; NewPaletteComboBox: TComboBox; @@ -33,6 +37,7 @@ TSpriteImportForm = class(TForm) procedure ImportFromClipboardClick(Sender: TObject); procedure NewPaletteComboBoxChange(Sender: TObject); procedure OpenSpriteSheetClick(Sender: TObject); + procedure SpinEditWidthHeightChange(Sender: TObject); procedure SpriteSheetPaintBoxMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure SpriteSheetPaintBoxPaint(Sender: TObject); @@ -108,6 +113,11 @@ procedure TSpriteImportForm.OpenSpriteSheetClick(Sender: TObject); end; end; +procedure TSpriteImportForm.SpinEditWidthHeightChange(Sender: TObject); +begin + if SpriteSize = 6 then SpriteSizeComboBoxChange(Sender); +end; + procedure TSpriteImportForm.SpriteSheetPaintBoxMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin @@ -389,6 +399,10 @@ procedure TSpriteImportForm.UpdateSpriteValues; SpriteWidth:=256; SpriteHeight:=256; end; + 6:begin + SpriteWidth:=SpinEditWidth.Value; + SpriteHeight:=SpinEditHeight.Value; + end; end; ClipWidth:=ZoomSize*SpriteWidth; @@ -442,8 +456,10 @@ procedure TSpriteImportForm.FormCreate(Sender: TObject); ClipWidth:=ZoomSize*SpriteWidth; ClipHeight:=ZoomSize*SpriteHeight; - NewPaletteFrom:=1; //new palette from entire image - NewPaletteMode:=4; //vga + NewPaletteFrom:=0; //new palette from clip area + NewPaletteMode:=7; //xga 256 + PaletteComboBox.ItemIndex:=NewPaletteMode; + NewPaletteComboBox.ItemIndex:=NewPaletteFrom; end; procedure TSpriteImportForm.CheckBoxDisplayGridChange(Sender: TObject); diff --git a/spritesheetexport.lfm b/spritesheetexport.lfm index e742508..982e752 100644 --- a/spritesheetexport.lfm +++ b/spritesheetexport.lfm @@ -1,7 +1,7 @@ object SpriteSheetExportForm: TSpriteSheetExportForm - Left = 606 + Left = 451 Height = 703 - Top = 230 + Top = 254 Width = 1233 Caption = 'Sprite Sheet Export' ClientHeight = 703 @@ -92,7 +92,6 @@ object SpriteSheetExportForm: TSpriteSheetExportForm '800X600' '1024X768' 'Custom' - '' ) Style = csDropDownList TabOrder = 1 @@ -121,6 +120,7 @@ object SpriteSheetExportForm: TSpriteSheetExportForm '64X64' '128X128' '256X256' + 'Custom' ) Style = csDropDownList TabOrder = 3 @@ -179,7 +179,7 @@ object SpriteSheetExportForm: TSpriteSheetExportForm OnClick = ApplyClick end object ExportToClipBoard: TButton - Left = 280 + Left = 433 Height = 25 Top = 75 Width = 131 @@ -188,7 +188,7 @@ object SpriteSheetExportForm: TSpriteSheetExportForm OnClick = ExportToClipBoardClick end object ExportToFile: TButton - Left = 280 + Left = 433 Height = 25 Top = 104 Width = 131 @@ -197,7 +197,7 @@ object SpriteSheetExportForm: TSpriteSheetExportForm OnClick = ExportToFileClick end object DescExportToClipboard: TButton - Left = 568 + Left = 688 Height = 25 Top = 75 Width = 131 @@ -206,7 +206,7 @@ object SpriteSheetExportForm: TSpriteSheetExportForm OnClick = DescExportToFileClick end object StaticText5: TStaticText - Left = 464 + Left = 584 Height = 17 Top = 56 Width = 129 @@ -214,7 +214,7 @@ object SpriteSheetExportForm: TSpriteSheetExportForm TabOrder = 12 end object DescriptionFile: TComboBox - Left = 464 + Left = 584 Height = 23 Top = 75 Width = 100 @@ -241,7 +241,7 @@ object SpriteSheetExportForm: TSpriteSheetExportForm OnChange = SpriteSheetChange end object StaticText6: TStaticText - Left = 280 + Left = 408 Height = 17 Top = 56 Width = 105 @@ -251,34 +251,34 @@ object SpriteSheetExportForm: TSpriteSheetExportForm object StaticText7: TStaticText Left = 16 Height = 17 - Top = 64 - Width = 120 - Caption = 'Custom Sprite Sheet' + Top = 56 + Width = 136 + Caption = 'Custom Sprite Sheet Size' ParentBidiMode = False TabOrder = 15 end object StaticText8: TStaticText - Left = 16 + Left = 8 Height = 17 - Top = 88 + Top = 77 Width = 65 Alignment = taRightJustify Caption = 'Width' TabOrder = 16 end object StaticText9: TStaticText - Left = 16 + Left = 8 Height = 17 - Top = 120 + Top = 112 Width = 65 Alignment = taRightJustify Caption = 'Height' TabOrder = 17 end object CSWidth: TSpinEdit - Left = 88 + Left = 80 Height = 23 - Top = 88 + Top = 80 Width = 64 MaxValue = 4000 MinValue = 256 @@ -287,9 +287,9 @@ object SpriteSheetExportForm: TSpriteSheetExportForm Value = 2000 end object CSHeight: TSpinEdit - Left = 88 + Left = 80 Height = 23 - Top = 120 + Top = 112 Width = 64 MaxValue = 4000 MinValue = 256 @@ -298,7 +298,7 @@ object SpriteSheetExportForm: TSpriteSheetExportForm Value = 2000 end object DescExportToFile: TButton - Left = 568 + Left = 688 Height = 25 Top = 104 Width = 131 @@ -306,6 +306,53 @@ object SpriteSheetExportForm: TSpriteSheetExportForm TabOrder = 20 OnClick = DescExportToFileClick end + object Label1: TLabel + Left = 232 + Height = 15 + Top = 80 + Width = 32 + Caption = 'Width' + end + object Label2: TLabel + Left = 232 + Height = 15 + Top = 112 + Width = 36 + Caption = 'Height' + end + object SpinEditCustomSpriteWidth: TSpinEditEx + Left = 277 + Height = 23 + Top = 80 + Width = 67 + MaxLength = 0 + NumbersOnly = True + TabOrder = 21 + MaxValue = 256 + MinValue = 8 + NullValue = 0 + Value = 48 + end + object SpinEditCustomSpriteHeight: TSpinEditEx + Left = 277 + Height = 23 + Top = 112 + Width = 67 + MaxLength = 0 + NumbersOnly = True + TabOrder = 22 + MaxValue = 256 + MinValue = 8 + NullValue = 0 + Value = 48 + end + object Label3: TLabel + Left = 208 + Height = 15 + Top = 56 + Width = 98 + Caption = 'Custom Sprite Size' + end end object ZoomTrackBar: TTrackBar AnchorSideRight.Control = Owner diff --git a/spritesheetexport.pas b/spritesheetexport.pas index b8f021a..9ee6e92 100644 --- a/spritesheetexport.pas +++ b/spritesheetexport.pas @@ -6,7 +6,8 @@ interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, - Spin, ComCtrls,Clipbrd,rmcodegen,rwxgf,rmclipboard,rmthumb,rmconfig,rwpng,LazFileUtils; + Spin, ComCtrls, Clipbrd, rmcodegen, rwxgf, rmclipboard, rmthumb, rmconfig, + rwpng, LazFileUtils, SpinEx; type @@ -20,8 +21,13 @@ TSpriteSheetExportForm = class(TForm) CSWidth: TSpinEdit; CSHeight: TSpinEdit; DescExportToFile: TButton; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; SaveDialog1: TSaveDialog; SaveDialog2: TSaveDialog; + SpinEditCustomSpriteWidth: TSpinEditEx; + SpinEditCustomSpriteHeight: TSpinEditEx; SpriteSheet: TComboBox; SpriteSize: TComboBox; Direction: TComboBox; @@ -427,6 +433,10 @@ procedure TSpriteSheetExportForm.UpdateSpriteValues; SpriteWidth:=256; SpriteHeight:=256; end; + 6:begin + SpriteWidth:=SpinEditCustomSpriteWidth.Value; + SpriteHeight:=SpinEditCustomSpriteHeight.Value; + end; end; end;