 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.model.anim;
22 import java.util.ArrayList;
23 import java.util.List;
26 import org.apache.log4j.Category;
27 import org.apache.log4j.Logger;
28 import org.jetbrains.annotations.NotNull;
52 private final List<String>
frames =
new ArrayList<>();
99 if (line.startsWith(
"facings ")) {
100 tmpFacings = Integer.parseInt(line.substring(8));
104 if (tmpFacings < 1) {
105 LOG.warn(
"Ignoring invalid facings value: " + tmpFacings);
109 boolean first =
true;
111 if (first && line.startsWith(
"facings ")) {
118 LOG.warn(
"Animation " +
animName +
" has no frames");
119 for (
int i = 0; i <
facings; i++) {
172 for (
int facing = 1; facing <
facings; facing++) {
174 if (!frame.startsWith(
"dummy.")) {
195 private String
getFrame(
final int facing,
final int frame)
throws IndexOutOfBoundsException {
196 if (facing < 0 || facing >=
facings) {
197 throw new IndexOutOfBoundsException(
"Invalid facing " + facing +
" (anim only has " +
facings +
" facings)");
200 throw new IndexOutOfBoundsException(
"Invalid frame " + frame +
" (anim only has " +
frameCount +
" frames)");
String toString()
The String representation of an AnimationObject is suitable for writing into the animations file.
Base package of all Gridarta classes.
Abstract base implementation of AnimationObject.
String getFrame(final int facing, final int frame)
Get a specific frame.
String getAnimList()
Returns the animation list of this animation.
String getFirstFrame(final int facing)
Get the first frame.
int getFrameCount()
Get the number of frames per facing.
final int facings
The number of facings, which is different sub animations, for instance for different directions.
DefaultAnimationObject(@NotNull final String animName, @NotNull final String animList, @NotNull final String path)
Creates a new instance.
int getFacings()
Get the facings, which is the number of different sub-animations, for instance for different directio...
final String animName
The name of this animation.
String path
The path of this object.
Classes for handling data that is organized in a tree.
final String animList
The animation list of this animation.
Utility class for string manipulation.
final int frameCount
The number of frames per facing in the animation.
final List< String > frames
The names of the animation frames.
static final Category LOG
The Logger for printing log messages.
static final Pattern PATTERN_NEWLINE
The pattern that matches a single newline ("\n").
static final long serialVersionUID
The serial version UID.
An AnimationObject reflects the animation ("@code anim\n @endcode " ...
String getDisplayIconName()
Returns the face name of the display icon for this AbstractNamedObject.