From 832b0f02aaf719618d74923de9ae385679116c0c Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Fri, 27 Sep 2013 14:48:54 +0200 Subject: [PATCH] C# style method and class docs. closes 127 --- spine-csharp/src/Animation.cs | 44 +++++++++---------- spine-csharp/src/AnimationState.cs | 8 ++-- spine-csharp/src/Atlas.cs | 8 ++-- .../src/Attachments/AttachmentLoader.cs | 2 +- .../src/Attachments/BoundingBoxAttachment.cs | 4 +- .../src/Attachments/RegionAttachment.cs | 2 +- spine-csharp/src/Bone.cs | 4 +- spine-csharp/src/BoneData.cs | 4 +- spine-csharp/src/Skeleton.cs | 27 ++++++------ spine-csharp/src/SkeletonBounds.cs | 18 ++++---- spine-csharp/src/SkeletonData.cs | 16 +++---- spine-csharp/src/Skin.cs | 6 +-- spine-csharp/src/Slot.cs | 2 +- spine-csharp/src/SlotData.cs | 2 +- 14 files changed, 73 insertions(+), 74 deletions(-) diff --git a/spine-csharp/src/Animation.cs b/spine-csharp/src/Animation.cs index 630dcb098..21195ad9f 100644 --- a/spine-csharp/src/Animation.cs +++ b/spine-csharp/src/Animation.cs @@ -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. */ + /// Poses the skeleton at the specified time for this animation. + /// public void Apply (Skeleton skeleton, float lastTime, float time, bool loop, List 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. */ + /// Poses the skeleton at the specified time for this animation mixed with the current pose. + /// + /// After the first and before the last entry. 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. */ + /// Sets the value(s) for the specified time. void Apply (Skeleton skeleton, float lastTime, float time, List firedEvents, float alpha); } - /** Base class for frames that use an interpolation bezier curve. */ + /// Base class for frames that use an interpolation bezier curve. 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. */ + /// 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. 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. */ + /// Sets the time and value of the specified keyframe. 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. */ + /// Sets the time and value of the specified keyframe. 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. */ + /// Sets the time and value of the specified keyframe. 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. */ + /// Sets the time and value of the specified keyframe. 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. */ + /// Sets the time and value of the specified keyframe. 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. */ + /// Sets the time and value of the specified keyframe. + /// May be null to use bind pose draw order. public void setFrame (int frameIndex, float time, int[] drawOrder) { frames[frameIndex] = time; drawOrders[frameIndex] = drawOrder; diff --git a/spine-csharp/src/AnimationState.cs b/spine-csharp/src/AnimationState.cs index 14cc61135..c2cd50381 100644 --- a/spine-csharp/src/AnimationState.cs +++ b/spine-csharp/src/AnimationState.cs @@ -167,7 +167,7 @@ namespace Spine { return SetAnimation(trackIndex, animation, loop); } - /** Set the current animation. Any queued animations are cleared. */ + /// Set the current animation. Any queued animations are cleared. 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. */ + /// Adds an animation to be played delay seconds after the current or last queued animation. + /// May be <= 0 to use duration of previous animation minus any mix duration plus the negative delay. 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. */ + /// May be null. public TrackEntry GetCurrent (int trackIndex) { if (trackIndex >= tracks.Count) return null; return tracks[trackIndex]; diff --git a/spine-csharp/src/Atlas.cs b/spine-csharp/src/Atlas.cs index 03c55aceb..aa34cb7c1 100644 --- a/spine-csharp/src/Atlas.cs +++ b/spine-csharp/src/Atlas.cs @@ -175,7 +175,7 @@ namespace Spine { return line.Substring(colon + 1).Trim(); } - /** Returns the number of tuple values read (2 or 4). */ + /// Returns the number of tuple values read (2 or 4). 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. */ + /// 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. + /// The region, or null. public AtlasRegion FindRegion (String name) { for (int i = 0, n = regions.Count; i < n; i++) if (regions[i].name == name) return regions[i]; diff --git a/spine-csharp/src/Attachments/AttachmentLoader.cs b/spine-csharp/src/Attachments/AttachmentLoader.cs index c0d9da533..c5120ad64 100644 --- a/spine-csharp/src/Attachments/AttachmentLoader.cs +++ b/spine-csharp/src/Attachments/AttachmentLoader.cs @@ -35,7 +35,7 @@ using System; namespace Spine { public interface AttachmentLoader { - /** @return May be null to not load any attachment. */ + /// May be null to not load any attachment. Attachment NewAttachment (Skin skin, AttachmentType type, String name); } } diff --git a/spine-csharp/src/Attachments/BoundingBoxAttachment.cs b/spine-csharp/src/Attachments/BoundingBoxAttachment.cs index 697ee85c2..c1187ccb5 100644 --- a/spine-csharp/src/Attachments/BoundingBoxAttachment.cs +++ b/spine-csharp/src/Attachments/BoundingBoxAttachment.cs @@ -34,7 +34,7 @@ using System; namespace Spine { - /** Attachment that has a polygon for bounds checking. */ + /// Attachment that has a polygon for bounds checking. 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. */ + /// Must have at least the same length as this attachment's vertices. public void ComputeWorldVertices (float x, float y, Bone bone, float[] worldVertices) { x += bone.worldX; y += bone.worldY; diff --git a/spine-csharp/src/Attachments/RegionAttachment.cs b/spine-csharp/src/Attachments/RegionAttachment.cs index 08cbc667f..8bb87f4a4 100644 --- a/spine-csharp/src/Attachments/RegionAttachment.cs +++ b/spine-csharp/src/Attachments/RegionAttachment.cs @@ -34,7 +34,7 @@ using System; namespace Spine { - /** Attachment that displays a texture region. */ + /// Attachment that displays a texture region. public class RegionAttachment : Attachment { public const int X1 = 0; public const int Y1 = 1; diff --git a/spine-csharp/src/Bone.cs b/spine-csharp/src/Bone.cs index b991c1f49..65709bb23 100644 --- a/spine-csharp/src/Bone.cs +++ b/spine-csharp/src/Bone.cs @@ -61,7 +61,7 @@ namespace Spine { public float WorldScaleX { get { return worldScaleX; } } public float WorldScaleY { get { return worldScaleY; } } - /** @param parent May be null. */ + /// May be null. 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. */ + /// Computes the world SRT using the parent bone and the local SRT. public void UpdateWorldTransform (bool flipX, bool flipY) { Bone parent = this.parent; if (parent != null) { diff --git a/spine-csharp/src/BoneData.cs b/spine-csharp/src/BoneData.cs index 0b1d98307..412a90a58 100644 --- a/spine-csharp/src/BoneData.cs +++ b/spine-csharp/src/BoneData.cs @@ -40,7 +40,7 @@ namespace Spine { internal float length, x, y, rotation, scaleX = 1, scaleY = 1; internal bool inheritScale, inheritRotation; - /** May be null. */ + /// May be null. 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. */ + /// May be null. public BoneData (String name, BoneData parent) { if (name == null) throw new ArgumentNullException("name cannot be null."); this.name = name; diff --git a/spine-csharp/src/Skeleton.cs b/spine-csharp/src/Skeleton.cs index 1ad427c88..e97ad7623 100644 --- a/spine-csharp/src/Skeleton.cs +++ b/spine-csharp/src/Skeleton.cs @@ -87,7 +87,7 @@ namespace Spine { } } - /** Updates the world transform for each bone. */ + /// Updates the world transform for each bone. 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. */ + /// Sets the bones and slots to their setup pose values. public void SetToSetupPose () { SetBonesToSetupPose(); SetSlotsToSetupPose(); @@ -116,7 +116,7 @@ namespace Spine { slots[i].SetToSetupPose(i); } - /** @return May be null. */ + /// May be null. public Bone FindBone (String boneName) { if (boneName == null) throw new ArgumentNullException("boneName cannot be null."); List bones = this.bones; @@ -127,7 +127,7 @@ namespace Spine { return null; } - /** @return -1 if the bone was not found. */ + /// -1 if the bone was not found. public int FindBoneIndex (String boneName) { if (boneName == null) throw new ArgumentNullException("boneName cannot be null."); List bones = this.bones; @@ -136,7 +136,7 @@ namespace Spine { return -1; } - /** @return May be null. */ + /// May be null. public Slot FindSlot (String slotName) { if (slotName == null) throw new ArgumentNullException("slotName cannot be null."); List slots = this.slots; @@ -147,7 +147,7 @@ namespace Spine { return null; } - /** @return -1 if the bone was not found. */ + /// -1 if the bone was not found. public int FindSlotIndex (String slotName) { if (slotName == null) throw new ArgumentNullException("slotName cannot be null."); List slots = this.slots; @@ -156,28 +156,27 @@ namespace Spine { return -1; } - /** Sets a skin by name. - * @see #setSkin(Skin) */ + /// Sets a skin by name (see setSkin). 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. */ + /// 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. + /// May be null. public void SetSkin (Skin newSkin) { if (skin != null && newSkin != null) newSkin.AttachAll(this, skin); skin = newSkin; } - /** @return May be null. */ + /// May be null. public Attachment GetAttachment (String slotName, String attachmentName) { return GetAttachment(data.FindSlotIndex(slotName), attachmentName); } - /** @return May be null. */ + /// May be null. 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. */ + /// May be null. public void SetAttachment (String slotName, String attachmentName) { if (slotName == null) throw new ArgumentNullException("slotName cannot be null."); List slots = this.slots; diff --git a/spine-csharp/src/SkeletonBounds.cs b/spine-csharp/src/SkeletonBounds.cs index 40bde6b95..f3b057ce4 100644 --- a/spine-csharp/src/SkeletonBounds.cs +++ b/spine-csharp/src/SkeletonBounds.cs @@ -111,12 +111,12 @@ namespace Spine { } - /** Returns true if the axis aligned bounding box contains the point. */ + /// Returns true if the axis aligned bounding box contains the point. 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. */ + /// Returns true if the axis aligned bounding box intersects the line segment. 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. */ + /// Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. 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. */ + /// Returns true if the polygon contains the point. 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. */ + /// 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. public BoundingBoxAttachment ContainsPoint (float x, float y) { List 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. */ + /// 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. public BoundingBoxAttachment IntersectsSegment (float x1, float y1, float x2, float y2) { List 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. */ + /// Returns true if the polygon contains the line segment. public bool IntersectsSegment (Polygon polygon, float x1, float y1, float x2, float y2) { float[] vertices = polygon.Vertices; int nn = polygon.Count; diff --git a/spine-csharp/src/SkeletonData.cs b/spine-csharp/src/SkeletonData.cs index 4d41c4058..d41cfd32a 100644 --- a/spine-csharp/src/SkeletonData.cs +++ b/spine-csharp/src/SkeletonData.cs @@ -48,7 +48,7 @@ namespace Spine { public List Bones { get { return bones; } } // Ordered parents first. public List Slots { get { return slots; } } // Setup pose draw order. public List Skins { get { return skins; } set { skins = value; } } - /** May be null. */ + /// May be null. public Skin DefaultSkin { get { return defaultSkin; } set { defaultSkin = value; } } public List Events { get { return events; } set { events = value; } } public List Animations { get { return animations; } set { animations = value; } } @@ -61,7 +61,7 @@ namespace Spine { } - /** @return May be null. */ + /// May be null. public BoneData FindBone (String boneName) { if (boneName == null) throw new ArgumentNullException("boneName cannot be null."); List bones = this.bones; @@ -72,7 +72,7 @@ namespace Spine { return null; } - /** @return -1 if the bone was not found. */ + /// -1 if the bone was not found. public int FindBoneIndex (String boneName) { if (boneName == null) throw new ArgumentNullException("boneName cannot be null."); List bones = this.bones; @@ -88,7 +88,7 @@ namespace Spine { slots.Add(slot); } - /** @return May be null. */ + /// May be null. public SlotData FindSlot (String slotName) { if (slotName == null) throw new ArgumentNullException("slotName cannot be null."); List slots = this.slots; @@ -99,7 +99,7 @@ namespace Spine { return null; } - /** @return -1 if the bone was not found. */ + /// -1 if the bone was not found. public int FindSlotIndex (String slotName) { if (slotName == null) throw new ArgumentNullException("slotName cannot be null."); List slots = this.slots; @@ -115,7 +115,7 @@ namespace Spine { skins.Add(skin); } - /** @return May be null. */ + /// May be null. 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. */ + /// May be null. 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. */ + /// May be null. public Animation FindAnimation (String animationName) { if (animationName == null) throw new ArgumentNullException("animationName cannot be null."); List animations = this.animations; diff --git a/spine-csharp/src/Skin.cs b/spine-csharp/src/Skin.cs index b226b2759..af4847e87 100644 --- a/spine-csharp/src/Skin.cs +++ b/spine-csharp/src/Skin.cs @@ -35,7 +35,7 @@ using System; using System.Collections.Generic; namespace Spine { - /** Stores attachments by slot index and attachment name. */ + /// Stores attachments by slot index and attachment name. public class Skin { internal String name; @@ -52,7 +52,7 @@ namespace Spine { attachments.Add(new KeyValuePair(slotIndex, name), attachment); } - /** @return May be null. */ + /// May be null. public Attachment GetAttachment (int slotIndex, String name) { Attachment attachment; attachments.TryGetValue(new KeyValuePair(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. */ + /// Attach all attachments from this skin if the corresponding attachment from the old skin is currently attached. internal void AttachAll (Skeleton skeleton, Skin oldSkin) { foreach (KeyValuePair, Attachment> entry in oldSkin.attachments) { int slotIndex = entry.Key.Key; diff --git a/spine-csharp/src/Slot.cs b/spine-csharp/src/Slot.cs index fe3132e2b..a4460ed8e 100644 --- a/spine-csharp/src/Slot.cs +++ b/spine-csharp/src/Slot.cs @@ -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. */ + /// May be null. public Attachment Attachment { get { return attachment; diff --git a/spine-csharp/src/SlotData.cs b/spine-csharp/src/SlotData.cs index d48595b0b..1f1a90c06 100644 --- a/spine-csharp/src/SlotData.cs +++ b/spine-csharp/src/SlotData.cs @@ -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. */ + /// May be null. public String AttachmentName { get { return attachmentName; } set { attachmentName = value; } } public bool AdditiveBlending { get { return additiveBlending; } set { additiveBlending = value; } }