Create spritesheet and view its animations. Flip and resize images. Built with "Lazarus" ( https://www.lazarus-ide.org/ ) and "Castle Game Engine" ( https://castle-engine.io/ ). Tested on Windows 10 64bit, Lazarus Ver. 1.8.4, FPC Ver. 3.0.4.
With this application you can create spritesheets for Castle Game Engine (or other programs that use this format) directly from Lazarus without using the command line.
It works with all major types of images but the most suitable is png. Spritesheet will always be created as png.
Castle Game Engine is required to compile because some of its features are used.
Program has two sections, Create spritesheet and Preview spritesheet.
The first one includes a small utility that allows you to flip and resize individual images and then save them.
To create a spritesheet prepare a folder with the images required (can be anywhere on the disk c:, does not need to be in the application folder).
As described in the CGE Guide ( https://castle-engine.io/manual_intro.php ), image names must end with an underscore followed by a numerical index (e.g. image_1.png, image_2.png). It is good practice to use zeros to complete the number if the images are more than 9 (... image_09, image_10 ...).
Open any image in the series then define Padding and Columns.
- Padding, will be the number of numbers after the underscore (image_09.png will have Padding = 2). This value is automatically proposed when the file is opened.
- Columns, will be the number of columns you want to get in the spritesheet (number of frames in a row in the image).
If all settings are correct a folder called "SpriteSheet" will be created in the source folder with the generated spritesheet.
As mentioned you can edit each image individually (select the desired image in the ShellView) and then save it, useful if you have drawn sprites in one direction and you want to create a spritesheet with the turned sprites (using FlipHorizontal, FlipVertical ( https://castle-engine.io/apidoc/html/CastleImages.TCastleImage.html ). Also in this case a folder called "EditedImages" will be created automatically in the source folder.
The resize function allows you to change the interpolation mode using values included in the Castle Game Engine (https://castle-engine.io/apidoc/html/CastleImages.html#TResizeInterpolation ). If you select Constrain the image will maintain its proportions.
With Preview spritesheet you can view the sprite animation ( https://castle-engine.io/apidoc/html/CastleGLImages.TSprite.html#CreateFrameSize ).
Open the spritesheet (then select it in the ShellView).
Set the required values:
- Frame count, number of images
- Columns, number of frames in a row in the image
- Horz size frame, width size of the single frame
- Vert size frame, height size of the single frame
- Frame per sec, number of frames per second
Click Start to see the animation.
You can change frames per sec even while the animation is active.
Hint: to view the whole spritesheet you can leave the default values and click on Start.
Let me know of any bugs.