Skip to content

Latest commit

 

History

History
183 lines (132 loc) · 3.76 KB

File metadata and controls

183 lines (132 loc) · 3.76 KB

Cloning

Clone this project recursively, because libraries are included as submodules:

git clone --recurse-submodules
# or
git clone --recurse-submodules --shallow-submodules

If it's already cloned without, and you don't want to start over, they can be initialized with:

git submodule update --init
# or
git submodule update --init --depth 1

Installing

To run the code, LÖVE2D is required. It's been tested and developed on version 11.5 (Mysterious Mysteries).

For unit tests, we are using the busted framework. Also, we need to supply a utf-8 library, one of which comes with LOVE, but is not available for Lua 5.1 / Luajit by default. Luafilesystem is used in some tests and utility scripts used for generating documentation.

The recommended way of installing these is with LuaRocks:

luarocks --local --lua-version 5.1 install busted
luarocks --local --lua-version 5.1 install luautf8
luarocks --local --lua-version 5.1 install luafilesystem

For information about installing LÖVE2D and LuaRocks, visit their respective webpages.

Web version

Hacking on this requires Node.js and NPM (or your node runtime and package manager of choice), to run love.js.

Tools

For automating tasks, we use just. For example, to set up the web version for development, you can run

just setup-web-dev

Development

util/lua.lua (luautils)

The contents of this module will be put into the global namespace (_G). However, the language server does not pick up on this (yet), so usages will be littered with warnings unless silenced.

prequire()

Analogous to pcall(), require a lua file that may or may not exist. Example:

--- @diagnostic disable-next-line undefined-global
local autotest = prequire('tests/autotest')
if autotest then
  autotest(self)
end

Web version

lovejs

Test mode

The game can be run with a test subcommand, which causes it to launch in test mode.

love src test

flags

auto

love src test --auto

Run the autotest function on startup. This is optionally defined in tests/autotest.lua with the following signature:

--- @param self ConsoleController
local function autotest(self)
  --- commands here
end

return autotest

size

love src test --size

This is causes the terminal and the input field to be smaller (so overflows are clearly visible).

draw

love src test --draw

For testing blend modes, draws several small canvases (implies --size).

Running unit tests

In project root:

busted tests

Environment variables

Debug mode

Certain diagnostic key combinations are only available in debug mode, to access this, run the project with the DEBUG environment variable set (it's value doesn't matter, just that it's set):

DEBUG=1 love src

In this mode, a VT-100 terminal test can be activated with ^T (C-t, or Ctrl+t).

HiDPI

Similarly, to set double scaling, set the HIDPI variable to true:

HIDPI=true love src