From 6175869070c218232e75797cc19b6cbe2e9f0a77 Mon Sep 17 00:00:00 2001 From: jonstoler Date: Fri, 25 Apr 2014 00:10:29 -0700 Subject: [PATCH 1/3] support for subclasses + example (Entity) --- _layouts/default.html | 8 +++++++- net/flashpunk/_posts/2014-04-03-Entity.md | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/_layouts/default.html b/_layouts/default.html index 87aec9b..ee01316 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -188,7 +188,13 @@
{% capture package_name %}{{ page.categories | join: '.' }}{% endcapture %} -

{% unless package_name == '' %}{{ package_name }}.{% endunless %}{{ page.title }}

+ {{ content }}
diff --git a/net/flashpunk/_posts/2014-04-03-Entity.md b/net/flashpunk/_posts/2014-04-03-Entity.md index e66da8b..31f289b 100644 --- a/net/flashpunk/_posts/2014-04-03-Entity.md +++ b/net/flashpunk/_posts/2014-04-03-Entity.md @@ -1,6 +1,7 @@ --- title: Entity layout: default +subclass: net.flashpunk.Tweener --- Main game Entity class updated by World. From 55db82e7ec7b657b1c2c94c8a0cce8a4e7cd547f Mon Sep 17 00:00:00 2001 From: jonstoler Date: Fri, 25 Apr 2014 15:58:44 -0700 Subject: [PATCH 2/3] use yaml frontmatter to generate pages --- _layouts/default.html | 67 +++++++++++++++ .../graphics/_posts/2014-04-24-Image.md | 84 +++++++++++-------- 2 files changed, 115 insertions(+), 36 deletions(-) diff --git a/_layouts/default.html b/_layouts/default.html index ee01316..5b616e6 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -89,6 +89,18 @@ .main .page-header { margin-top: 0; } + + /* + * Property table + */ + + .table .read-only { + color: #888; + } + + .table .return strong { + color: #9c393c; + } @@ -195,6 +207,61 @@

{% unless package_name == '' %}{{ package_name }}.{% endunles {% capture subclassURL %}{{ page.subclass | replace: '.', '/' }}{% endcapture %}

subclass of {{ subclassName }}
{% endif %} +

{{ page.description }}

+ {% if page.properties %} +

Properties

+ + + + + + + + + {% for prop in page.properties %} + + + + + {% endfor %} + +
PropertyDescription
{{ prop.name }} : {{ prop.type }}{% if prop.default %} = {{ prop.default }}{% endif %}{% unless prop.access == 'public' or prop.access == null %}[{{ prop.access }}] {% endunless %}{{ prop.description }}
+ {% endif %} + {% if page.methods %} +

Methods

+ + + + + + + + + {% for method in page.methods %} + + + + + {% if method.arguments %} + {% for arg in method.arguments %} + + + + {% endfor %} + {% endif %} + {% if method.returns %} + + + + {% endif %} + {% endfor %} + +
MethodDescription
{{ method.name }}({% for arg in method.arguments %}{{ arg.name }}:{{ arg.type }}{% if arg.default %} = {{ arg.default }}{% endif %}{% unless forloop.last %}, {% endunless %}{% endfor %}) : {% if method.returns %}{{ method.returns }}{% else %}void{% endif %}{% unless method.access == 'public' or method.access == null %}[{{ method.access }}] {% endunless %}{{ method.description }}
+ {{ arg.name }} : {{ arg.type }}
{{ arg.description }}
+
+ returns {{ method.returns }}{% if method.returnDescription %}
{{ method.returnDescription }}{% endif %}
+
+ {% endif %} {{ content }} diff --git a/net/flashpunk/graphics/_posts/2014-04-24-Image.md b/net/flashpunk/graphics/_posts/2014-04-24-Image.md index 44b2b0a..bfdde83 100644 --- a/net/flashpunk/graphics/_posts/2014-04-24-Image.md +++ b/net/flashpunk/graphics/_posts/2014-04-24-Image.md @@ -1,42 +1,54 @@ --- title: Image layout: default ---- +subclass: net.flashpunk.Graphic +description: Performance-optimized non-animated image. +properties: + - name: alpha + type: Number + description: "Change the opacity of the Image, a value from 0 to 1." + + - name: angle + type: Number + description: "Rotation of the image, in degrees." + + - name: blend + type: String + description: "Optional blend mode to use when drawing this image." -Performance-optimized non-animated image. - -### Public Properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
alpha : NumberChange the opacity of the Image, a value from 0 to 1.
angle : Number = 0Rotation of the image, in degrees.
blend : StringOptional blend mode to use when drawing this image.
clipRect : Rectangle[read-only] Clipping rectangle for the image.
color : uintThe tinted color of the Image.
+ - name: clipRect + type: Rectangle + description: "Clipping rectangle for the image." + access: read-only + + - name: color + type: uint + description: "The tinted color of the Image." +methods: + - name: createRect + arguments: + - name: width + type: uint + description: "Width of the rectangle." + - name: height + type: uint + description: "Height of the rectangle." + - name: color + type: uint + default: "0xffffff" + description: "Color of the rectangle." + - name: alpha + type: Number + default: 1 + description: "Opacity of the rectangle." + returns: Image + returnDescription: A new Image object. + description: "Creates a new rectangle Image." + access: static + + - name: centerOO + description: "Centers the Image's originX/Y to its center." +--- ### Property Detail @@ -50,4 +62,4 @@ var redSquare:Image = new Image(new BitmapData(50, 50, true, 0xffff0000)); // Make the red square 50% transparent. redSquare.alpha = 0.5; -{% endhighlight %} \ No newline at end of file +{% endhighlight %} From b44dae810a113ef1341fe890d3e4c2afeee9bddc Mon Sep 17 00:00:00 2001 From: jonstoler Date: Sat, 26 Apr 2014 10:39:58 -0700 Subject: [PATCH 3/3] use "parent" instead of "subclass" for inheritance --- _layouts/default.html | 8 ++++---- net/flashpunk/_posts/2014-04-03-Entity.md | 2 +- net/flashpunk/graphics/_posts/2014-04-24-Image.md | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/_layouts/default.html b/_layouts/default.html index 5b616e6..3bcc7ae 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -202,10 +202,10 @@ {% capture package_name %}{{ page.categories | join: '.' }}{% endcapture %}

{{ page.description }}

{% if page.properties %} diff --git a/net/flashpunk/_posts/2014-04-03-Entity.md b/net/flashpunk/_posts/2014-04-03-Entity.md index 31f289b..1f602a3 100644 --- a/net/flashpunk/_posts/2014-04-03-Entity.md +++ b/net/flashpunk/_posts/2014-04-03-Entity.md @@ -1,7 +1,7 @@ --- title: Entity layout: default -subclass: net.flashpunk.Tweener +parent: net.flashpunk.Tweener --- Main game Entity class updated by World. diff --git a/net/flashpunk/graphics/_posts/2014-04-24-Image.md b/net/flashpunk/graphics/_posts/2014-04-24-Image.md index bfdde83..65f48f1 100644 --- a/net/flashpunk/graphics/_posts/2014-04-24-Image.md +++ b/net/flashpunk/graphics/_posts/2014-04-24-Image.md @@ -1,7 +1,7 @@ --- title: Image layout: default -subclass: net.flashpunk.Graphic +parent: net.flashpunk.Graphic description: Performance-optimized non-animated image. properties: - name: alpha