Class Animated
java.lang.Object
net.mtrop.doom.texture.Animated
- All Implemented Interfaces:
Iterable<Animated.Entry>, BinaryObject, Sizable
This class represents the contents of a Boom Engine ANIMATED
lump. This lump contains extended information regarding animated
flats and textures.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFlat entry for ANIMATED.static enumEnumeration of Animated Entry Texture types.Nested classes/interfaces inherited from interface BinaryObject
BinaryObject.InlineScanner<BO>, BinaryObject.Reflect, BinaryObject.Scanner<BO>, BinaryObject.Shared, BinaryObject.Transformer<BO> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEntry(Animated.Entry entry) Adds an entry to this Animated lump.static Animated.EntryCreates a flat entry.get(int i) Returns an Animated entry at a specific index.intbooleanisEmpty()Returns if this object contains no objects.iterator()voidreadBytes(InputStream in) Reads from anInputStreamand sets this object's fields.removeEntry(int i) Removes an Animated entry at a specific index.intsize()static Animated.EntryCreates a texture entry.static Animated.EntryCreates a texture entry.voidwriteBytes(OutputStream out) Writes this object to anOutputStream.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
entryList
List of entries.
-
-
Constructor Details
-
Animated
public Animated()Creates a new ANIMATED lump.
-
-
Method Details
-
flat
Creates a flat entry.- Parameters:
lastName- the last name in the sequence.firstName- the first name in the sequence.ticks- the amount of ticks between each frame.- Returns:
- a new entry detailing an animated texture.
- Throws:
IllegalArgumentException- iflastNameorfirstNameis not a valid texture name, or frame ticks is less than 1.
-
texture
Creates a texture entry.- Parameters:
lastName- the last name in the sequence.firstName- the first name in the sequence.ticks- the amount of ticks between each frame.- Returns:
- a new entry detailing an animated texture.
- Throws:
IllegalArgumentException- iflastNameorfirstNameis not a valid texture name, or frame ticks is less than 1.
-
texture
Creates a texture entry.- Parameters:
lastName- the last name in the sequence.firstName- the first name in the sequence.ticks- the amount of ticks between each frame.decals- if true, allows decals to be placed on this texture, false if not.- Returns:
- a new entry detailing an animated texture.
- Throws:
IllegalArgumentException- iflastNameorfirstNameis not a valid texture name, or frame ticks is less than 1.
-
addEntry
Adds an entry to this Animated lump.- Parameters:
entry- the entry to add.- See Also:
-
get
Returns an Animated entry at a specific index.- Parameters:
i- the index of the entry to return.- Returns:
- the corresponding entry, or
nullif no corresponding entry for that index. - Throws:
IndexOutOfBoundsException- if the index is out of range (less than 0 or greater than or equal to getFlatCount()).
-
removeEntry
Removes an Animated entry at a specific index.- Parameters:
i- the index of the entry to remove.- Returns:
- the corresponding removed entry, or
nullif no corresponding entry for that index. - Throws:
IndexOutOfBoundsException- if the index is out of range (less than 0 or greater than or equal to getSwitchCount()).
-
getEntryCount
public int getEntryCount()- Returns:
- the amount of switch entries in this lump.
-
readBytes
Description copied from interface:BinaryObjectReads from anInputStreamand sets this object's fields. Only reads the amount of bytes that it takes to read a single instance of the object. Note that not every object may have a consistent length!- Specified by:
readBytesin interfaceBinaryObject- Parameters:
in- theInputStreamto read from.- Throws:
IOException- if a read error occurs.
-
writeBytes
Description copied from interface:BinaryObjectWrites this object to anOutputStream.- Specified by:
writeBytesin interfaceBinaryObject- Parameters:
out- theOutputStreamto write to.- Throws:
IOException- if a write error occurs.
-
iterator
- Specified by:
iteratorin interfaceIterable<Animated.Entry>
-
size
-
isEmpty
public boolean isEmpty()Description copied from interface:SizableReturns if this object contains no objects. The general policy of this method is that this returns true if and only ifSizable.size()returns 0.
-