gretro-text
v0.1.0gretro-text
Gretro-text is a gretro plugin to draw a text.
Installation
browser
include gretro-text.js after including gretro.js
<script src="gretro.js"></script>
<script src="gretro-text.js"></script>
node.js
gretro-text
is available on npm.
$ npm install gretro-text
var gretro = require("gretro");
var gretroText = require("gretro-text");
gretro.use(gretroText);
API Reference
char
Draws a 5x7 character to the canvas.
Syntax
canvas.char(ch, x, y);
Parameters
- ch: int
- ascii code (0x21 <= ch <= 0x7e)
- x: int
- x-coordinate of the character
- y: int
- y-coordinate of the character
Returns
Canvas: self for method chaining
text
Draws a text to the canvas.
Syntax
canvas.text(text, x, y);
Parameters
- text: string
- x: int
- x-coordinate of the text
- y: int
- y-coordinate of the text
Returns
Canvas: self for method chaining