C# style method and class docs.

closes 127
This commit is contained in:
NathanSweet 2013-09-27 14:48:54 +02:00
parent 325babbb3b
commit 832b0f02aa
14 changed files with 73 additions and 74 deletions

View File

@ -52,14 +52,14 @@ namespace Spine {
this.duration = duration;
}
/** @deprecated */
[Obsolete]
public void Apply (Skeleton skeleton, float time, bool loop) {
Apply(skeleton, time, time, loop, null);
}
/** Poses the skeleton at the specified time for this animation.
* @param lastTime The last time the animation was applied. Can be equal to time if events shouldn't be fired.
* @param events Any triggered events are added. May be null if lastTime is known to not cause any events to trigger. */
/// <summary>Poses the skeleton at the specified time for this animation.</summary>
/// <param name="lastTime The last time the animation was applied. Can be equal to time if events shouldn't be fired.</param>
/// <param name="events Any triggered events are added. May be null if lastTime is known to not cause any events to trigger.</param>
public void Apply (Skeleton skeleton, float lastTime, float time, bool loop, List<Event> events) {
if (skeleton == null) throw new ArgumentNullException("skeleton cannot be null.");
@ -73,15 +73,15 @@ namespace Spine {
timelines[i].Apply(skeleton, lastTime, time, events, 1);
}
/** @deprecated */
[Obsolete]
public void Mix (Skeleton skeleton, float time, bool loop, float alpha) {
Mix(skeleton, time, time, loop, null, alpha);
}
/** Poses the skeleton at the specified time for this animation mixed with the current pose.
* @param lastTime The last time the animation was applied. Can be equal to time if events shouldn't be fired.
* @param events Any triggered events are added. May be null if lastTime is known to not cause any events to trigger.
* @param alpha The amount of this animation that affects the current pose. */
/// <summary>Poses the skeleton at the specified time for this animation mixed with the current pose.</summary>
/// <param name="lastTime The last time the animation was applied. Can be equal to time if events shouldn't be fired.</param>
/// <param name="events Any triggered events are added. May be null if lastTime is known to not cause any events to trigger.</param>
/// <param name="alpha The amount of this animation that affects the current pose.</param>
public void Mix (Skeleton skeleton, float lastTime, float time, bool loop, List<Event> events, float alpha) {
if (skeleton == null) throw new ArgumentNullException("skeleton cannot be null.");
@ -95,7 +95,7 @@ namespace Spine {
timelines[i].Apply(skeleton, lastTime, time, events, alpha);
}
/** @param target After the first and before the last entry. */
/// <param name="target">After the first and before the last entry.</param>
internal static int binarySearch (float[] values, float target, int step) {
int low = 0;
int high = values.Length / step - 2;
@ -119,11 +119,11 @@ namespace Spine {
}
public interface Timeline {
/** Sets the value(s) for the specified time. */
/// <summary>Sets the value(s) for the specified time.</summary>
void Apply (Skeleton skeleton, float lastTime, float time, List<Event> firedEvents, float alpha);
}
/** Base class for frames that use an interpolation bezier curve. */
/// <summary>Base class for frames that use an interpolation bezier curve.</summary>
abstract public class CurveTimeline : Timeline {
static protected float LINEAR = 0;
static protected float STEPPED = -1;
@ -146,9 +146,9 @@ namespace Spine {
curves[frameIndex * 6] = STEPPED;
}
/** Sets the control handle positions for an interpolation bezier curve used to transition from this keyframe to the next.
* cx1 and cx2 are from 0 to 1, representing the percent of time between the two keyframes. cy1 and cy2 are the percent of
* the difference between the keyframe's values. */
/// <summary>Sets the control handle positions for an interpolation bezier curve used to transition from this keyframe to the next.
/// cx1 and cx2 are from 0 to 1, representing the percent of time between the two keyframes. cy1 and cy2 are the percent of
/// the difference between the keyframe's values.</summary>
public void SetCurve (int frameIndex, float cx1, float cy1, float cx2, float cy2) {
float subdiv_step = 1f / BEZIER_SEGMENTS;
float subdiv_step2 = subdiv_step * subdiv_step;
@ -218,7 +218,7 @@ namespace Spine {
frames = new float[frameCount * 2];
}
/** Sets the time and value of the specified keyframe. */
/// <summary>Sets the time and value of the specified keyframe.</summary>
public void SetFrame (int frameIndex, float time, float angle) {
frameIndex *= 2;
frames[frameIndex] = time;
@ -280,7 +280,7 @@ namespace Spine {
frames = new float[frameCount * 3];
}
/** Sets the time and value of the specified keyframe. */
/// <summary>Sets the time and value of the specified keyframe.</summary>
public void SetFrame (int frameIndex, float time, float x, float y) {
frameIndex *= 3;
frames[frameIndex] = time;
@ -360,7 +360,7 @@ namespace Spine {
frames = new float[frameCount * 5];
}
/** Sets the time and value of the specified keyframe. */
/// <summary>Sets the time and value of the specified keyframe.</summary>
public void setFrame (int frameIndex, float time, float r, float g, float b, float a) {
frameIndex *= 5;
frames[frameIndex] = time;
@ -428,7 +428,7 @@ namespace Spine {
attachmentNames = new String[frameCount];
}
/** Sets the time and value of the specified keyframe. */
/// <summary>Sets the time and value of the specified keyframe.</summary>
public void setFrame (int frameIndex, float time, String attachmentName) {
frames[frameIndex] = time;
attachmentNames[frameIndex] = attachmentName;
@ -463,7 +463,7 @@ namespace Spine {
events = new Event[frameCount];
}
/** Sets the time and value of the specified keyframe. */
/// <summary>Sets the time and value of the specified keyframe.</summary>
public void setFrame (int frameIndex, float time, Event e) {
frames[frameIndex] = time;
events[frameIndex] = e;
@ -513,8 +513,8 @@ namespace Spine {
drawOrders = new int[frameCount][];
}
/** Sets the time and value of the specified keyframe.
* @param drawOrder May be null to use bind pose draw order. */
/// <summary>Sets the time and value of the specified keyframe.</summary>
/// <param name="drawOrder">May be null to use bind pose draw order.</param>
public void setFrame (int frameIndex, float time, int[] drawOrder) {
frames[frameIndex] = time;
drawOrders[frameIndex] = drawOrder;

View File

@ -167,7 +167,7 @@ namespace Spine {
return SetAnimation(trackIndex, animation, loop);
}
/** Set the current animation. Any queued animations are cleared. */
/// <summary>Set the current animation. Any queued animations are cleared.</summary>
public TrackEntry SetAnimation (int trackIndex, Animation animation, bool loop) {
TrackEntry entry = new TrackEntry();
entry.animation = animation;
@ -184,8 +184,8 @@ namespace Spine {
return AddAnimation(trackIndex, animation, loop, delay);
}
/** Adds an animation to be played delay seconds after the current or last queued animation.
* @param delay May be <= 0 to use duration of previous animation minus any mix duration plus the negative delay. */
/// <summary>Adds an animation to be played delay seconds after the current or last queued animation.</summary>
/// <param name="delay">May be <= 0 to use duration of previous animation minus any mix duration plus the negative delay.</param>
public TrackEntry AddAnimation (int trackIndex, Animation animation, bool loop, float delay) {
TrackEntry entry = new TrackEntry();
entry.animation = animation;
@ -213,7 +213,7 @@ namespace Spine {
return entry;
}
/** @return May be null. */
/// <returns>May be null.</returns>
public TrackEntry GetCurrent (int trackIndex) {
if (trackIndex >= tracks.Count) return null;
return tracks[trackIndex];

View File

@ -175,7 +175,7 @@ namespace Spine {
return line.Substring(colon + 1).Trim();
}
/** Returns the number of tuple values read (2 or 4). */
/// <summary>Returns the number of tuple values read (2 or 4).</summary>
static int readTuple (TextReader reader, String[] tuple) {
String line = reader.ReadLine();
int colon = line.IndexOf(':');
@ -194,9 +194,9 @@ namespace Spine {
return i + 1;
}
/** Returns the first region found with the specified name. This method uses string comparison to find the region, so the result
* should be cached rather than calling this method multiple times.
* @return The region, or null. */
/// <summary>Returns the first region found with the specified name. This method uses string comparison to find the region, so the result
/// should be cached rather than calling this method multiple times.</summary>
/// <returns>The region, or null.</returns>
public AtlasRegion FindRegion (String name) {
for (int i = 0, n = regions.Count; i < n; i++)
if (regions[i].name == name) return regions[i];

View File

@ -35,7 +35,7 @@ using System;
namespace Spine {
public interface AttachmentLoader {
/** @return May be null to not load any attachment. */
/// <return>May be null to not load any attachment.</return>
Attachment NewAttachment (Skin skin, AttachmentType type, String name);
}
}

View File

@ -34,7 +34,7 @@
using System;
namespace Spine {
/** Attachment that has a polygon for bounds checking. */
/// <summary>Attachment that has a polygon for bounds checking.</summary>
public class BoundingBoxAttachment : Attachment {
public float[] Vertices { get; set; }
@ -42,7 +42,7 @@ namespace Spine {
: base(name) {
}
/** @param worldVertices Must have at least the same length as this attachment's vertices. */
/// <param name="worldVertices">Must have at least the same length as this attachment's vertices.</param>
public void ComputeWorldVertices (float x, float y, Bone bone, float[] worldVertices) {
x += bone.worldX;
y += bone.worldY;

View File

@ -34,7 +34,7 @@
using System;
namespace Spine {
/** Attachment that displays a texture region. */
/// <summary>Attachment that displays a texture region.</summary>
public class RegionAttachment : Attachment {
public const int X1 = 0;
public const int Y1 = 1;

View File

@ -61,7 +61,7 @@ namespace Spine {
public float WorldScaleX { get { return worldScaleX; } }
public float WorldScaleY { get { return worldScaleY; } }
/** @param parent May be null. */
/// <param name="parent">May be null.</param>
public Bone (BoneData data, Bone parent) {
if (data == null) throw new ArgumentNullException("data cannot be null.");
this.data = data;
@ -69,7 +69,7 @@ namespace Spine {
SetToSetupPose();
}
/** Computes the world SRT using the parent bone and the local SRT. */
/// <summary>Computes the world SRT using the parent bone and the local SRT.</summary>
public void UpdateWorldTransform (bool flipX, bool flipY) {
Bone parent = this.parent;
if (parent != null) {

View File

@ -40,7 +40,7 @@ namespace Spine {
internal float length, x, y, rotation, scaleX = 1, scaleY = 1;
internal bool inheritScale, inheritRotation;
/** May be null. */
/// <summary>May be null.</summary>
public BoneData Parent { get { return parent; } }
public String Name { get { return name; } }
public float Length { get { return length; } set { length = value; } }
@ -52,7 +52,7 @@ namespace Spine {
public bool InheritScale { get { return inheritScale; } set { inheritScale = value; } }
public bool InheritRotation { get { return inheritRotation; } set { inheritRotation = value; } }
/** @param parent May be null. */
/// <param name="parent">May be null.</param>
public BoneData (String name, BoneData parent) {
if (name == null) throw new ArgumentNullException("name cannot be null.");
this.name = name;

View File

@ -87,7 +87,7 @@ namespace Spine {
}
}
/** Updates the world transform for each bone. */
/// <summary>Updates the world transform for each bone.</summary>
public void UpdateWorldTransform () {
bool flipX = this.flipX;
bool flipY = this.flipY;
@ -96,7 +96,7 @@ namespace Spine {
bones[i].UpdateWorldTransform(flipX, flipY);
}
/** Sets the bones and slots to their setup pose values. */
/// <summary>Sets the bones and slots to their setup pose values.</summary>
public void SetToSetupPose () {
SetBonesToSetupPose();
SetSlotsToSetupPose();
@ -116,7 +116,7 @@ namespace Spine {
slots[i].SetToSetupPose(i);
}
/** @return May be null. */
/// <returns>May be null.</returns>
public Bone FindBone (String boneName) {
if (boneName == null) throw new ArgumentNullException("boneName cannot be null.");
List<Bone> bones = this.bones;
@ -127,7 +127,7 @@ namespace Spine {
return null;
}
/** @return -1 if the bone was not found. */
/// <returns>-1 if the bone was not found.</returns>
public int FindBoneIndex (String boneName) {
if (boneName == null) throw new ArgumentNullException("boneName cannot be null.");
List<Bone> bones = this.bones;
@ -136,7 +136,7 @@ namespace Spine {
return -1;
}
/** @return May be null. */
/// <returns>May be null.</returns>
public Slot FindSlot (String slotName) {
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
List<Slot> slots = this.slots;
@ -147,7 +147,7 @@ namespace Spine {
return null;
}
/** @return -1 if the bone was not found. */
/// <returns>-1 if the bone was not found.</returns>
public int FindSlotIndex (String slotName) {
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
List<Slot> slots = this.slots;
@ -156,28 +156,27 @@ namespace Spine {
return -1;
}
/** Sets a skin by name.
* @see #setSkin(Skin) */
/// <summary>Sets a skin by name (see setSkin).</summary>
public void SetSkin (String skinName) {
Skin skin = data.FindSkin(skinName);
if (skin == null) throw new ArgumentException("Skin not found: " + skinName);
SetSkin(skin);
}
/** Sets the skin used to look up attachments not found in the {@link SkeletonData#getDefaultSkin() default skin}. Attachments
* from the new skin are attached if the corresponding attachment from the old skin was attached.
* @param newSkin May be null. */
/// <summary>Sets the skin used to look up attachments not found in the {@link SkeletonData#getDefaultSkin() default skin}. Attachments
/// from the new skin are attached if the corresponding attachment from the old skin was attached.</summary>
/// <param name="newSkin">May be null.</param>
public void SetSkin (Skin newSkin) {
if (skin != null && newSkin != null) newSkin.AttachAll(this, skin);
skin = newSkin;
}
/** @return May be null. */
/// <returns>May be null.</returns>
public Attachment GetAttachment (String slotName, String attachmentName) {
return GetAttachment(data.FindSlotIndex(slotName), attachmentName);
}
/** @return May be null. */
/// <returns>May be null.</returns>
public Attachment GetAttachment (int slotIndex, String attachmentName) {
if (attachmentName == null) throw new ArgumentNullException("attachmentName cannot be null.");
if (skin != null) {
@ -188,7 +187,7 @@ namespace Spine {
return null;
}
/** @param attachmentName May be null. */
/// <param name="attachmentName">May be null.</param>
public void SetAttachment (String slotName, String attachmentName) {
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
List<Slot> slots = this.slots;

View File

@ -111,12 +111,12 @@ namespace Spine {
}
/** Returns true if the axis aligned bounding box contains the point. */
/// <summary>Returns true if the axis aligned bounding box contains the point.</summary>
public bool AabbContainsPoint (float x, float y) {
return x >= minX && x <= maxX && y >= minY && y <= maxY;
}
/** Returns true if the axis aligned bounding box intersects the line segment. */
/// <summary>Returns true if the axis aligned bounding box intersects the line segment.</summary>
public bool AabbIntersectsSegment (float x1, float y1, float x2, float y2) {
float minX = this.minX;
float minY = this.minY;
@ -136,12 +136,12 @@ namespace Spine {
return false;
}
/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
/// <summary>Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds.</summary>
public bool AabbIntersectsSkeleton (SkeletonBounds bounds) {
return minX < bounds.maxX && maxX > bounds.minX && minY < bounds.maxY && maxY > bounds.minY;
}
/** Returns true if the polygon contains the point. */
/// <summary>Returns true if the polygon contains the point.</summary>
public bool ContainsPoint (Polygon polygon, float x, float y) {
float[] vertices = polygon.Vertices;
int nn = polygon.Count;
@ -160,8 +160,8 @@ namespace Spine {
return inside;
}
/** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
* efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */
/// <summary>Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
/// efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true.</summary>
public BoundingBoxAttachment ContainsPoint (float x, float y) {
List<Polygon> polygons = Polygons;
for (int i = 0, n = polygons.Count; i < n; i++)
@ -169,8 +169,8 @@ namespace Spine {
return null;
}
/** Returns the first bounding box attachment that contains the line segment, or null. When doing many checks, it is usually
* more efficient to only call this method if {@link #aabbIntersectsSegment(float, float, float, float)} returns true. */
/// <summary>Returns the first bounding box attachment that contains the line segment, or null. When doing many checks, it is usually
/// more efficient to only call this method if {@link #aabbIntersectsSegment(float, float, float, float)} returns true.</summary>
public BoundingBoxAttachment IntersectsSegment (float x1, float y1, float x2, float y2) {
List<Polygon> polygons = Polygons;
for (int i = 0, n = polygons.Count; i < n; i++)
@ -178,7 +178,7 @@ namespace Spine {
return null;
}
/** Returns true if the polygon contains the line segment. */
/// <summary>Returns true if the polygon contains the line segment.</summary>
public bool IntersectsSegment (Polygon polygon, float x1, float y1, float x2, float y2) {
float[] vertices = polygon.Vertices;
int nn = polygon.Count;

View File

@ -48,7 +48,7 @@ namespace Spine {
public List<BoneData> Bones { get { return bones; } } // Ordered parents first.
public List<SlotData> Slots { get { return slots; } } // Setup pose draw order.
public List<Skin> Skins { get { return skins; } set { skins = value; } }
/** May be null. */
/// <summary>May be null.</summary>
public Skin DefaultSkin { get { return defaultSkin; } set { defaultSkin = value; } }
public List<EventData> Events { get { return events; } set { events = value; } }
public List<Animation> Animations { get { return animations; } set { animations = value; } }
@ -61,7 +61,7 @@ namespace Spine {
}
/** @return May be null. */
/// <returns>May be null.</returns>
public BoneData FindBone (String boneName) {
if (boneName == null) throw new ArgumentNullException("boneName cannot be null.");
List<BoneData> bones = this.bones;
@ -72,7 +72,7 @@ namespace Spine {
return null;
}
/** @return -1 if the bone was not found. */
/// <returns>-1 if the bone was not found.</returns>
public int FindBoneIndex (String boneName) {
if (boneName == null) throw new ArgumentNullException("boneName cannot be null.");
List<BoneData> bones = this.bones;
@ -88,7 +88,7 @@ namespace Spine {
slots.Add(slot);
}
/** @return May be null. */
/// <returns>May be null.</returns>
public SlotData FindSlot (String slotName) {
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
List<SlotData> slots = this.slots;
@ -99,7 +99,7 @@ namespace Spine {
return null;
}
/** @return -1 if the bone was not found. */
/// <returns>-1 if the bone was not found.</returns>
public int FindSlotIndex (String slotName) {
if (slotName == null) throw new ArgumentNullException("slotName cannot be null.");
List<SlotData> slots = this.slots;
@ -115,7 +115,7 @@ namespace Spine {
skins.Add(skin);
}
/** @return May be null. */
/// <returns>May be null.</returns>
public Skin FindSkin (String skinName) {
if (skinName == null) throw new ArgumentNullException("skinName cannot be null.");
foreach (Skin skin in skins)
@ -130,7 +130,7 @@ namespace Spine {
events.Add(eventData);
}
/** @return May be null. */
/// <returns>May be null.</returns>
public EventData findEvent (String eventDataName) {
if (eventDataName == null) throw new ArgumentNullException("eventDataName cannot be null.");
foreach (EventData eventData in events)
@ -145,7 +145,7 @@ namespace Spine {
animations.Add(animation);
}
/** @return May be null. */
/// <returns>May be null.</returns>
public Animation FindAnimation (String animationName) {
if (animationName == null) throw new ArgumentNullException("animationName cannot be null.");
List<Animation> animations = this.animations;

View File

@ -35,7 +35,7 @@ using System;
using System.Collections.Generic;
namespace Spine {
/** Stores attachments by slot index and attachment name. */
/// <summary>Stores attachments by slot index and attachment name.</summary>
public class Skin {
internal String name;
@ -52,7 +52,7 @@ namespace Spine {
attachments.Add(new KeyValuePair<int, String>(slotIndex, name), attachment);
}
/** @return May be null. */
/// <returns>May be null.</returns>
public Attachment GetAttachment (int slotIndex, String name) {
Attachment attachment;
attachments.TryGetValue(new KeyValuePair<int, String>(slotIndex, name), out attachment);
@ -75,7 +75,7 @@ namespace Spine {
return name;
}
/** Attach all attachments from this skin if the corresponding attachment from the old skin is currently attached. */
/// <summary>Attach all attachments from this skin if the corresponding attachment from the old skin is currently attached.</summary>
internal void AttachAll (Skeleton skeleton, Skin oldSkin) {
foreach (KeyValuePair<KeyValuePair<int, String>, Attachment> entry in oldSkin.attachments) {
int slotIndex = entry.Key.Key;

View File

@ -50,7 +50,7 @@ namespace Spine {
public float B { get { return b; } set { b = value; } }
public float A { get { return a; } set { a = value; } }
/** May be null. */
/// <summary>May be null.</summary>
public Attachment Attachment {
get {
return attachment;

View File

@ -47,7 +47,7 @@ namespace Spine {
public float G { get { return g; } set { g = value; } }
public float B { get { return b; } set { b = value; } }
public float A { get { return a; } set { a = value; } }
/** @param attachmentName May be null. */
/// <summary>May be null.</summary>
public String AttachmentName { get { return attachmentName; } set { attachmentName = value; } }
public bool AdditiveBlending { get { return additiveBlending; } set { additiveBlending = value; } }