Getting Started
Setup Instructions
Crystal is only supported on Windows.
- Download Crystal’s latest release
- Extract the archive
- From the top-level directory of the archive, run
bin\lovec.exe game. This should display aHello Worldwindow. - Start making changes to
game\main.luaand they should be immediately reflected in the game window.
Project Structure
In addition to main.lua and a suggested directory to store assets, the starter project also comes with:
- A
bindirectory you should leave alone (other than possibly adding otherdllyour game needs). - A
.githubdirectory containing a Github Actions CI setup to runs tests (if any) and build the game on every push. Feel free to edit this or remove it entirely. - A game packaging script (
package.ps1) used by the above CI process to package the game together. Feel free to edit this or remove it entirely. - A
crystal.jsonand default program icon used by the packaging script.
The vast majority of you work should happen under the /game directory, which is a regular LOVE project with the crystal Lua library added.
Crystal & LOVE
Crystal is not a replacement for LOVE. Everything available in LOVE is also usable within a Crystal project.
You can use as much or as little as you want from the Crystal API. Similar to LOVE, Crystal gives you tools to build your game without imposing too much predetermined structure.
By default, Crystal overwrites the following LOVE callbacks:
love.loadlove.updatelove.drawlove.run(only when running tests)love.keypressedlove.keyreleasedlove.gamepadpressedlove.gamepadreleasedlove.mousemovedlove.mousepressedlove.mousereleasedlove.textinput
If you choose to implement these callbacks yourself, make sure to call the crystal.* equivalent before or after your own code:
love.update = function(dt)
-- Your update code here
crystal.update(dt);
end
love.draw = function()
crystal.draw();
-- Your draw code here
end