Permalink
Browse files

New overload for Shape.append, pass Vertex by ref

  • Loading branch information...
Dgame committed May 31, 2015
1 parent 3cf20ec commit 571ba828c91d553447157eb267599f6b8b880e24
Showing with 20 additions and 5 deletions.
  1. +9 −2 source/Dgame/Graphic/Shape.d
  2. +7 −2 source/Dgame/docs/Shape.html
  3. +4 −1 source/Dgame/test/main.d
@@ -149,7 +149,7 @@ final:
immutable float x = center.x + cos(degInRad) * radius;
immutable float y = center.y + sin(degInRad) * radius;
this.append(Vertex(x, y));
this.append(Vector2f(x, y));
}
}
@@ -164,10 +164,17 @@ final:
/**
* Stores a Vertex
*/
void append(const Vertex vertex) pure nothrow {
void append(ref const Vertex vertex) pure nothrow {
_vertices ~= vertex;
}
/**
* Stores a Vertex
*/
void append(const Vector2f vec) pure nothrow {
_vertices ~= Vertex(vec);
}
/**
* Stores multiple Vertices
*/
@@ -76,12 +76,17 @@ <h1>Dgame.Graphic.Shape</h1>
<dd>Clear all Vertices but preserve the storage and capacity<br><br>
</dd>
<dt><big><a name="Shape.append"></a>final pure nothrow void <u>append</u>(const Vertex <i>vertex</i>);
<dt><big><a name="Shape.append"></a>final pure nothrow void <u>append</u>(ref const Vertex <i>vertex</i>);
</big></dt>
<dd>Stores a Vertex<br><br>
</dd>
<dt><big><a name="Shape.append.2"></a>final pure nothrow void <u>append</u>(Vertex[] <i>vertices</i>);
<dt><big><a name="Shape.append.2"></a>final pure nothrow void <u>append</u>(const Vector2f <i>vec</i>);
</big></dt>
<dd>Stores a Vertex<br><br>
</dd>
<dt><big><a name="Shape.append.3"></a>final pure nothrow void <u>append</u>(Vertex[] <i>vertices</i>);
</big></dt>
<dd>Stores multiple Vertices<br><br>
View
@@ -13,10 +13,13 @@ debug {
pragma(msg, Window.sizeof);
pragma(msg, Surface.sizeof);
pragma(msg, Texture.sizeof);
pragma(msg, Font.sizeof);
pragma(msg, Vector2i.sizeof);
pragma(msg, Vector2f.sizeof);
pragma(msg, Vector3i.sizeof);
pragma(msg, Vertex.sizeof);
pragma(msg, GLContextSettings.sizeof);
pragma(msg, Shader.sizeof);
pragma(msg, ShaderProgram.sizeof);
}
void main() {

0 comments on commit 571ba82

Please sign in to comment.