jjANIMSET class JJ2+
A set of related sprite animations
One entry of the global set table jjAnimSets, indexed by ANIM::Set, holding the index of its first animation in jjAnimations. The sets of the original game are always available; a custom set (ANIM::CUSTOM[n]) exists once a script loads or allocates it. Converts implicitly to firstAnim.
Functions
- jjANIMSET@ allocate(const array<uint>&in frameCounts)
- Creates empty animations for this set and returns the set
- jjANIMSET@ load(uint fileSetID = 2048, const string&in filename = '', int firstAnimToOverwrite = -1, int firstFrameToOverwrite = -1)
- Loads animations into this set and returns the set
- jjANIMSET@ load(const jjPIXELMAP&in sheet, uint frameWidth, uint frameHeight, uint frameSpacingX = 0, uint frameSpacingY = 0, uint startX = 0, uint startY = 0, const array<int>&in coldSpotYOffsets = array<int>(), int firstAnimToOverwrite = -1, int firstFrameToOverwrite = -1)
- Loads animations into this set from a sprite sheet and returns the set
Operators
- uint opImplConv() const implicit conversion C++
- Converts the set to the index of its first animation, firstAnim
Properties
- uint firstAnim C++
- Index of the set's first animation in jjAnimations, 0 if the set isn't loaded
Function documentation
jjANIMSET@ jjANIMSET:: load(uint fileSetID = 2048,
const string&in filename = '',
int firstAnimToOverwrite = -1,
int firstFrameToOverwrite = -1)
Loads animations into this set and returns the set
Without a file name, copies the animations of the original game's set fileSetID (2048 means this set itself, which is already loaded). With a file name, reads set fileSetID from that .j2a file. New animations and frames are added at the end of jjAnimations and jjAnimFrames, unless firstAnimToOverwrite or firstFrameToOverwrite give the entries to overwrite.
jjANIMSET@ jjANIMSET:: load(const jjPIXELMAP&in sheet,
uint frameWidth,
uint frameHeight,
uint frameSpacingX = 0,
uint frameSpacingY = 0,
uint startX = 0,
uint startY = 0,
const array<int>&in coldSpotYOffsets = array<int>(),
int firstAnimToOverwrite = -1,
int firstFrameToOverwrite = -1)
Loads animations into this set from a sprite sheet and returns the set
The sheet is a grid of frameWidth by frameHeight cells starting at startX, startY, separated by frameSpacingX and frameSpacingY pixels. Each row is an animation whose frames are its cells up to the first empty one; the first row without any frame ends the set. Each frame's hotspot and coldspot X are at the middle of its cell, and its coldspot Y is moved by the row's entry of coldSpotYOffsets. Frames keep the full size of the cell. New animations and frames are added unless firstAnimToOverwrite and firstFrameToOverwrite give the entries to overwrite.