Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Commit

Permalink
Geometry: Quad -> Quads, Triangle -> Triangles
Browse files Browse the repository at this point in the history
  • Loading branch information
Dgame committed May 16, 2015
1 parent 6c28c53 commit 7c3626f
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 11 deletions.
4 changes: 2 additions & 2 deletions source/Dgame/Math/Geometry.d
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public:
* Geometry describes different geometric representations.
*/
enum Geometry {
Quad = GL_QUADS, /// Declare that the stored vertices are Quads.
Quads = GL_QUADS, /// Declare that the stored vertices are Quads.
QuadStrip = GL_QUAD_STRIP, /// Declare that the stored vertices are Quad Strips
Triangle = GL_TRIANGLES, /// Declare that the stored vertices are Triangles.
Triangles = GL_TRIANGLES, /// Declare that the stored vertices are Triangles.
TriangleStrip = GL_TRIANGLE_STRIP, /// Declare that the stored vertices are Triangles Strips
TriangleFan = GL_TRIANGLE_FAN, /// Declare that the stored vertices are Triangles Fans.
Lines = GL_LINES, /// Declare that the stored vertices are Lines.
Expand Down
8 changes: 4 additions & 4 deletions source/Dgame/docs/Geometry.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ <h1>Dgame.Math.Geometry</h1>
</big></dt>
<dd><u>Geometry</u> describes different geometric representations.<br><br>

<dl><dt><big><a name="Geometry.Quad"></a><u>Quad</u></big></dt>
<dd>Declare that the stored vertices are Quads.<br><br>
<dl><dt><big><a name="Geometry.Quads"></a><u>Quads</u></big></dt>
<dd>Declare that the stored vertices are <u>Quads</u>.<br><br>

</dd>
<dt><big><a name="Geometry.QuadStrip"></a><u>QuadStrip</u></big></dt>
<dd>Declare that the stored vertices are Quad Strips<br><br>

</dd>
<dt><big><a name="Geometry.Triangle"></a><u>Triangle</u></big></dt>
<dd>Declare that the stored vertices are Triangles.<br><br>
<dt><big><a name="Geometry.Triangles"></a><u>Triangles</u></big></dt>
<dd>Declare that the stored vertices are <u>Triangles</u>.<br><br>

</dd>
<dt><big><a name="Geometry.TriangleStrip"></a><u>TriangleStrip</u></big></dt>
Expand Down
129 changes: 129 additions & 0 deletions source/Dgame/docs/Music.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<html><head>
<META http-equiv="content-type" content="text/html; charset=utf-8">
<title>Dgame.Audio.Music</title>
</head><body>
<h1>Dgame.Audio.Music</h1>
<!-- Generated by Ddoc from ..\Audio\Music.d -->
<br><br>
<dl><dt><big><a name="Music"></a>struct <u>Music</u>;
</big></dt>
<dd><u>Music</u> represents the functionality to load and play music files.
<br><br>
<b>Note:</b><br>
<u>Music</u> is designed to load and play <b>larger</b> music files, e.g. background music
If you just want to play short sounds, use Sound.
<br><br>

Supported formats are .wav, .mp3, .vorbis, .ogg, .midi

<br><br>
<b>Author:</b><br>
Randy Schuett (rswhite4@googlemail.com)<br><br>

<dl><dt><big><a name="Music.this"></a>nothrow @nogc this(string <i>filename</i>, ubyte <i>volume</i> = 128);
</big></dt>
<dd>CTor<br><br>

</dd>
<dt><big><a name="Music.loadFromFile"></a>nothrow @nogc bool <u>loadFromFile</u>(string <i>filename</i>);
</big></dt>
<dd>Load the music file (<i>filename</i>).
Returns if the loading was successful.
If not, an error message is showed which describes what the problem is.<br><br>

</dd>
<dt><big><a name="Music.setVolume"></a>const nothrow @nogc ubyte <u>setVolume</u>(ubyte <i>volume</i>);
</big></dt>
<dd>Set the <i>volume</i>, max. is 128, min. is 0
If the value is above 128, the max. will be assumed.
Returns the previous <i>volume</i>.<br><br>

</dd>
<dt><big><a name="Music.getVolume"></a>const nothrow @nogc ubyte <u>getVolume</u>();
</big></dt>
<dd>Returns the current volume<br><br>

</dd>
<dt><big><a name="Music.play"></a>nothrow @nogc void <u>play</u>(byte <i>loops</i> = 1, short <i>delay</i> = -1);
</big></dt>
<dd>Plays the music.
<i>loops</i> describe how often the music shall be played.
A value of -1 indicated, that the music plays forever,
a value of 0 means, that the music plays zero times.
<i>delay</i> is the time in ms to fade in.
Any previous music will be halted.<br><br>

</dd>
<dt><big><a name="Music.resume"></a>const nothrow @nogc void <u>resume</u>();
</big></dt>
<dd>Resume the music playback
<br><br>
<b>See:</b><br>
pause
<br><br>
<b>See:</b><br>
stop<br><br>

</dd>
<dt><big><a name="Music.stop"></a>const nothrow @nogc void <u>stop</u>();
</big></dt>
<dd>Stop/Halt the music playback
<br><br>
<b>See:</b><br>
resume<br><br>

</dd>
<dt><big><a name="Music.pause"></a>const nothrow @nogc void <u>pause</u>();
</big></dt>
<dd>Pause the music playback
<br><br>
<b>See:</b><br>
resume<br><br>

</dd>
<dt><big><a name="Music.rewind"></a>const nothrow @nogc void <u>rewind</u>();
</big></dt>
<dd>Rewind the music to the start
<br><br>
<b>Note:</b><br>
This function only works for .ogg, .vorbis, .mp3, .midi<br><br>

</dd>
<dt><big><a name="Music.fadeOut"></a>nothrow @nogc void <u>fadeOut</u>(ushort <i>ms</i>);
</big></dt>
<dd>Fade out the music. The music will be stopped in <i>ms</i> milliseconds.<br><br>

</dd>
<dt><big><a name="Music.setPosition"></a>const nothrow @nogc void <u>setPosition</u>(float <i>seconds</i>);
</big></dt>
<dd>Set the position of the currently playing music.
The position takes different meanings for different music sources.
<br><br>
<b>.ogg / .vorbis:</b>
Jumps to position <i>seconds</i> from the beginning of the song.
<b>mp3:</b>
Jumps to position <i>seconds</i> from the current position in the stream.
So you may want to call rewind before.
<b>Does not go in reverse: negative values do nothing.</b>

<br><br>
<b>Note:</b><br>
This only works for.ogg, .vorbis and .mp3<br><br>

</dd>
<dt><big><a name="Music.isPlaying"></a>const nothrow @nogc bool <u>isPlaying</u>();
</big></dt>
<dd>Returns if the music is currently playing<br><br>

</dd>
<dt><big><a name="Music.isPaused"></a>const nothrow @nogc bool <u>isPaused</u>();
</big></dt>
<dd>Returns if the music is currently paused<br><br>

</dd>
</dl>
</dd>
</dl>

<hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small>
</body></html>
10 changes: 5 additions & 5 deletions source/Dgame/test/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void main() {
ship.setRotationCenter(32, 32);

Shape qs = new Shape(
Geometry.Quad,
Geometry.Quads,
[
Vertex( 75, 75),
Vertex(175, 75),
Expand All @@ -148,7 +148,7 @@ void main() {
Shape circle = new Shape(25, Vector2f(180, 380));
circle.setColor(Color4b.Green);

Shape many = new Shape(Geometry.Quad,
Shape many = new Shape(Geometry.Quads,
[
Vertex(55, 55),
Vertex(60, 55),
Expand All @@ -172,7 +172,7 @@ void main() {
many.setColor(Color4b.Red);

Shape texQuad = new Shape(
Geometry.Quad,
Geometry.Quads,
[
Vertex( 0, 0),
Vertex(140, 0),
Expand All @@ -195,14 +195,14 @@ void main() {
]
);

Shape s1 = new Shape(Geometry.Quad, [Vertex(0, 0), Vertex(100, 0), Vertex(100, 100), Vertex(0, 100)]);
Shape s1 = new Shape(Geometry.Quads, [Vertex(0, 0), Vertex(100, 0), Vertex(100, 100), Vertex(0, 100)]);
s1.setColor(Color4b.Green);
//s1.setRotationCenter(50, 50);
s1.setOrigin(50, 50);
s1.setRotation(45);
s1.setPosition(240, 320);

Shape s2 = new Shape(Geometry.Quad, [Vertex(0, 0), Vertex(50, 0), Vertex(50, 50), Vertex(0, 50)]);
Shape s2 = new Shape(Geometry.Quads, [Vertex(0, 0), Vertex(50, 0), Vertex(50, 50), Vertex(0, 50)]);
s2.setColor(Color4b.Blue);
//s2.setRotationCenter(25, 25);
s2.setOrigin(25, 25);
Expand Down

0 comments on commit 7c3626f

Please sign in to comment.