Compare commits
3 commits
e51d00708b
...
c63197f09b
Author | SHA1 | Date | |
---|---|---|---|
c63197f09b | |||
6acd16f1a5 | |||
fc16147265 |
2 changed files with 6 additions and 5 deletions
|
@ -8,18 +8,18 @@
|
||||||
|
|
||||||
extern int viewportWidth, viewportHeight;
|
extern int viewportWidth, viewportHeight;
|
||||||
extern Texture* debugFontTexture;
|
extern Texture* debugFontTexture;
|
||||||
extern Shader* debugFontShader;
|
extern Shader* fontShader;
|
||||||
extern Shader* identityShader;
|
extern Shader* identityShader;
|
||||||
|
|
||||||
void drawChar(char c, int x, int y, float scale=1.f) {
|
void drawChar(char c, int x, int y, float scale=1.f) {
|
||||||
debugFontShader->use();
|
fontShader->use();
|
||||||
debugFontTexture->activate(1);
|
debugFontTexture->activate(1);
|
||||||
debugFontShader->set("fontTex", 1);
|
fontShader->set("fontTex", 1);
|
||||||
|
|
||||||
debugFontShader->set("charIndex", (int)c);
|
fontShader->set("charIndex", (int)c);
|
||||||
|
|
||||||
// https://stackoverflow.com/a/10631263
|
// https://stackoverflow.com/a/10631263
|
||||||
int tex = debugFontShader->getAttribute("aTexCoord");
|
int tex = fontShader->getAttribute("aTexCoord");
|
||||||
|
|
||||||
y = viewportHeight - y - 16*scale;
|
y = viewportHeight - y - 16*scale;
|
||||||
float x0 = float(x)/viewportWidth, y0 = float(y)/viewportHeight, x1 = ((float)x + 8*scale)/viewportWidth, y1 = ((float)y + 16*scale)/viewportHeight;
|
float x0 = float(x)/viewportWidth, y0 = float(y)/viewportHeight, x1 = ((float)x + 8*scale)/viewportWidth, y1 = ((float)y + 16*scale)/viewportHeight;
|
||||||
|
|
|
@ -671,6 +671,7 @@ void render() {
|
||||||
// TODO: Make this a debug flag
|
// TODO: Make this a debug flag
|
||||||
// renderAABB();
|
// renderAABB();
|
||||||
|
|
||||||
|
drawText(sansSerif, "Hi", 0, 0, 1);
|
||||||
renderTime = tu_clock_micros() - startTime;
|
renderTime = tu_clock_micros() - startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue