NdsForge.NET
1.0.1
Read, validate, edit, compare, and build Nintendo DS and DSi images from .NET
Loading...
Searching...
No Matches
NdsBannerAnimationStep.cs
1
namespace
NdsForge
;
2
13
#if DOXYGEN
14
public
record
NdsBannerAnimationStep
(
15
#
else
16
public
readonly record
struct
NdsBannerAnimationStep
(
17
#endif
18
byte
Duration,
19
byte
TileFrame,
20
byte
PaletteFrame,
21
bool
FlipHorizontal =
false
,
22
bool
FlipVertical =
false
)
23
{
27
public
ushort
Pack
()
28
{
29
Validate();
30
return
(ushort)(
31
Duration |
32
(TileFrame << 8) |
33
(PaletteFrame << 11) |
34
(FlipHorizontal ? 1 << 14 : 0) |
35
(FlipVertical ? 1 << 15 : 0));
36
}
37
42
public
static
NdsBannerAnimationStep
FromPacked
(ushort value)
43
{
44
if
(value == 0)
45
{
46
throw
new
InvalidDataException(
"A zero DSi animation word terminates the sequence and is not a step."
);
47
}
48
49
return
new
(
50
(byte)value,
51
(byte)((value >> 8) & 0x07),
52
(byte)((value >> 11) & 0x07),
53
(value & (1 << 14)) != 0,
54
(value & (1 << 15)) != 0);
55
}
56
58
internal
void
Validate()
59
{
60
if
(Duration == 0)
61
{
62
throw
new
InvalidDataException(
"A DSi animation step must last at least one 60 Hz tick."
);
63
}
64
65
if
(TileFrame > 7 || PaletteFrame > 7)
66
{
67
throw
new
InvalidDataException(
"DSi animation tile and palette frame indices must be between zero and seven."
);
68
}
69
}
70
}
NdsForge.NdsBannerAnimationStep
Describes one timed DSi menu-icon pose. Tile and palette frames are selected independently so an anim...
Definition
NdsBannerAnimationStep.cs:23
NdsForge.NdsBannerAnimationStep.Pack
ushort Pack()
Converts the typed pose to the bit layout stored in a DSi banner sequence entry.
Definition
NdsBannerAnimationStep.cs:27
NdsForge.NdsBannerAnimationStep.FromPacked
static NdsBannerAnimationStep FromPacked(ushort value)
Interprets one nonzero on-disk sequence word without needing a containing banner.
Definition
NdsBannerAnimationStep.cs:42
NdsForge
Definition
NdsBanner.cs:5
src
NdsForge
Banners
NdsBannerAnimationStep.cs
Generated by
1.17.0