Skip to content

Commit

Permalink
add am.load_bitmap_font + extended ascii chars for default font
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmaclarty committed Jun 12, 2016
1 parent f762f71 commit 9b0ea8f
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 496 deletions.
23 changes: 23 additions & 0 deletions doc/spritepack.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,26 @@ i.e:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
~~~

## Loading bitmap font images

### am.load_bitmap_font(filename, key) {#am.load_bitmap_font .func-def}

Loads the image `filename` and returns a font using
the glyph layout described by `key` where `key` is a string
containing all the glyphs in the file as they are layed out.
All glyphs must have the same width and height which is
determined from the width and height of the image and the
number of rows and columns in `key`. For example if the
key is:

~~~ {.lua}
[[
ABC
DEF
GHI
]]
~~~

then the image contains 9 glyphs in 3 rows and 3 columns.
If the image has height 30 and width 36 then each glyph has
width 10 and height 12.
7 changes: 6 additions & 1 deletion examples/text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ win.scene = am.group{
,
am.translate(100, -100)
^ am.text("Left\nTop\nAligned\nText", vec4(1, 0.5, 0, 1), "left", "top")
,
am.text([[
╔═══════════╗
║ ♥ UTF-8 ♦ ║
║ ♫ Text‼ ☺ ║
╚═══════════╝]])
}

Loading

0 comments on commit 9b0ea8f

Please sign in to comment.