This commit is contained in:
Adam D. Ruppe 2015-09-19 17:07:53 -04:00
parent 5fa51b6574
commit 5a9106c6a0
3 changed files with 1747 additions and 1118 deletions

91
arsd.ddoc Normal file
View File

@ -0,0 +1,91 @@
DDOC_SECTION=<div>$0</div>
DDOC_SECTION_H=<b>$0</b>
DDOC_BLANKLINE=<p>
DDOC_ANCHOR=<a id="$1" href="#$1" style="color: inherit; text-decoration: none;">&#9875;</a>&nbsp;
D_INLINECODE=<tt>$0</tt>
DDOC_DECL= $(DT $0)
DDOC_DECL_DD= $(DD $0)
DDOC_PARAMS=<table class="params"><caption>Parameters</caption>$0</table>
DDOC_PARAM_ROW=<tr>$0</tr>
DDOC_PARAM_ID=<th>$0</th>
DDOC_PARAM=<span class="param-name">$0</span>
DDOC_PSYMBOL=<span class="psymbol">$0</span>
DDOC=<!DOCTYPE html><html><head>
<meta charset="UTF-8" />
<style>
#body-container {
max-width: 800px;
}
h3 {
background-color: #e0e0e0;
padding: 1em;
}
dt {
background-color: #383838;
padding: 0.5em;
margin-bottom: 0.5em;
color: white;
}
.tip, .note, .warning, .pitfall, .important {
margin: 1em 3em;
padding: 1em;
border: solid 1px #ccc;
}
.tip {
background-color: #eeffee;
}
.note {
background-color: #eeeeee;
}
.warning {
background-color: #ffffee;
}
.pitfall {
background-color: #eeeeff;
}
.important {
background-color: #ffeeff;
}
dt .psymbol {
font-weight: bold;
}
dt .psymbol ~ .psymbol {
/* I'm not happy with it being bolded when a param name matches it too */
font-weight: normal;
}
.params th, .params td {
padding-bottom: 0.5em;
}
.params th {
vertical-align: top;
text-align: left;
font-weight: normal;
}
.params caption {
text-align: left;
font-weight: bold;
border-bottom: solid 1px #ccc;
}
.param-name {
font-style: italic;
}
.params th .param-name {
font-style: normal;
font-weight: bold;
}
.params td .param-name {
font-style: normal;
}
</style>
<title>$(TITLE)</title>
<meta name=viewport content="width=device-width, initial-scale=1" />
</head><body>
<div id="body-container">
<h1>$(TITLE)</h1>
$(BODY)
</div>
</body></html>

View File

@ -1,6 +1,6 @@
// WORK IN PROGRESS // WORK IN PROGRESS
/** /++
An add-on for simpledisplay.d, joystick.d, and simpleaudio.d An add-on for simpledisplay.d, joystick.d, and simpleaudio.d
that includes helper functions for writing games (and perhaps that includes helper functions for writing games (and perhaps
other multimedia programs). other multimedia programs).
@ -57,9 +57,9 @@
The MyGame handler is actually a template, so you don't have virtual The MyGame handler is actually a template, so you don't have virtual
function indirection and not all functions are required. The interfaces function indirection and not all functions are required. The interfaces
are just to help you get the signatures right, they don't work at are just to help you get the signatures right, they don't force virtual
runtime. dispatch at runtime.
*/ +/
module arsd.gamehelpers; module arsd.gamehelpers;
public import arsd.color; public import arsd.color;
@ -154,9 +154,11 @@ void runGame(T : GameHelperBase)(T game, int maxUpdateRate = 20, int maxRedrawRa
); );
} }
/// Simple class for putting a TrueColorImage in as an OpenGL texture. /++
/// Simple class for putting a TrueColorImage in as an OpenGL texture.
/// Doesn't do mipmapping btw.
Doesn't do mipmapping btw.
+/
final class OpenGlTexture { final class OpenGlTexture {
private uint _tex; private uint _tex;
private int _width; private int _width;
@ -164,15 +166,17 @@ final class OpenGlTexture {
private float _texCoordWidth; private float _texCoordWidth;
private float _texCoordHeight; private float _texCoordHeight;
/// Calls glBindTexture
void bind() { void bind() {
glBindTexture(GL_TEXTURE_2D, _tex); glBindTexture(GL_TEXTURE_2D, _tex);
} }
// For easy 2d drawing of it /// For easy 2d drawing of it
void draw(Point where, int width = 0, int height = 0, float rotation = 0.0, Color bg = Color.white) { void draw(Point where, int width = 0, int height = 0, float rotation = 0.0, Color bg = Color.white) {
draw(where.x, where.y, width, height, rotation, bg); draw(where.x, where.y, width, height, rotation, bg);
} }
///
void draw(float x, float y, int width = 0, int height = 0, float rotation = 0.0, Color bg = Color.white) { void draw(float x, float y, int width = 0, int height = 0, float rotation = 0.0, Color bg = Color.white) {
glPushMatrix(); glPushMatrix();
glTranslatef(x, y, 0); glTranslatef(x, y, 0);

File diff suppressed because it is too large Load Diff