SMGF is a small framework to make 2D games in Lua for the web, macOS, Linux and Windows.
Features:
- minimal Lua (5.4) API, with exports for the web, macOS, Linux and Windows
- LSP annotations available for the whole API
- a simple hardware-accelerated 2D API powered by the SDL2
- streamed and static audio sources from multiple sound formats (ogg and wav by default, others formats such as mp3, flac, and tracker formats can be configured on build)
- inputs from mouse, keyboard and game controllers
- sandboxed IO environment to save/load data on the player computer, which allows for game modding out of the box
- open source under the zlib license, which means you can use it and distribute your games freely and free of charge
Display an image on screen:
function smgf.init()
my_texture = smgf.graphics.new("my_image.png")
end
function smgf.draw()
smgf.graphics.clear()
smgf.graphics.draw(my_texture, 5, 5)
end
Play a sound on key press:
function smgf.init()
sound = smgf.audio.new("sfx.wav")
end
function smgf.key_down(key)
if key == "return" then
sound:play()
end
end