your-own-drum/sitelenpona.lua

18 lines
564 B
Lua
Raw Normal View History

2023-01-13 18:28:58 +00:00
--Render Sitelen Pona text. One file per glyph.
local love = love
local sp = {}
local info = love.filesystem.getInfo( "sitelenpona" )
for _, filename in ipairs(love.filesystem.getDirectoryItems( "sitelenpona" )) do
sp[filename:gsub( ".png", "" )] = love.graphics.newImage( "sitelenpona/"..filename )
end
--Render one glyph in the center.
sp.Draw = function( str )
local w, h = love.graphics.getDimensions()
local x, y = 0.5 * w - 128, 0.5 * h - 128
love.graphics.setColor( 1.0, 1.0, 1.0, 0.5 )
2023-01-13 18:28:58 +00:00
love.graphics.draw( sp[str] or sp.q, x, y )
end
return sp