love-loader/readme.md

92 lines
2.7 KiB
Markdown
Raw Normal View History

2022-04-27 18:32:52 +00:00
# Love Loader
Custom menu for selecting game from multiple for Love2D.
2022-05-30 07:33:56 +00:00
![PSP Style](./scr/psp.png)
[Other screenshots](./scr)
2022-04-27 18:32:52 +00:00
# How it works?
2022-05-30 07:33:56 +00:00
Just place games into `games` folder! (like `this_folder/games/game/main.lua`)
Technically, this creates the loop until game wasn't selected or user wants to exit
with custom event handling and redrawing.
# LibLL
Love Loader from v2.0 includes library to simplify creating custom interfaces.
It is like a backend for Love Loader.
It have not so many functions and fields:
- `ll.games` - field for games, which have this structure:
```lua
{
name = 'string', -- Friendly name for game or placeholder
desc = 'string', -- Description for game or placeholder
base = 'string', -- base directory used in game mounting, must end with `/`
dir = 'string', -- directory name, used if no name was defined
main = 'string', -- main file to execute or `main.lua`
screens = {'array of', 'path to screenshots'},
scrcur = 1, --[[number]] -- current index from screenshots
scrprv = 1, --[[number]] -- previous index from screenshots
dat = nil, --[[any]] -- maybe platform-dependent data to reduce operations
}
```
- `ll.mdir` - string or nil, contains full mounted directory.
- `ll.mgme` - game or nil, contains mounted game.
- `ll.gameNew(configuration --[[string]], fileName --[[string, not used]], base --[[string]], directory --[[string]])`
Creates game object (defined above) and returns it.
- `ll.gameAdd(conf, file, base, dir)` - same as `ll.gameNew`, but inserts game into `ll.games`.
- `ll.mount(game)` - mounts game.
Can throw an error.
Sets `ll.mdir` and `ll.mgme`.
- `ll.umount()` - unmounts game if can.
Unsets `ll.mdir` and `ll.mgme`.
2022-04-27 18:32:52 +00:00
2022-05-30 07:33:56 +00:00
- `ll.home()` - calls `llHome`
2022-04-27 18:32:52 +00:00
2022-05-30 07:33:56 +00:00
# API
2022-04-27 18:32:52 +00:00
2022-05-30 07:33:56 +00:00
To simplify task to the game developers, this loader creates some global variables to use.
2022-04-27 18:32:52 +00:00
2022-05-30 07:33:56 +00:00
You can also use it without Love Loader by including `ll-min.lua` file.
2022-04-27 18:33:49 +00:00
2022-05-30 07:33:56 +00:00
`W` and `H`: width and height of the screen which controls by custom love.resize function.
2022-04-27 18:33:49 +00:00
2022-05-30 07:33:56 +00:00
`love.resize` and optional `resize` payload: functions called when screen size was changed and on booting.
2022-04-28 18:35:21 +00:00
2022-05-30 07:33:56 +00:00
`love.event.quit`: function to exit to main screen.
2022-04-28 18:35:21 +00:00
2022-05-30 07:33:56 +00:00
`llHome`: function called by `love.event.quit` (broken for now).
2022-04-28 18:35:21 +00:00
2022-05-30 07:33:56 +00:00
`llUsed`: is Love Loader (not minimal API) used.
2022-04-28 18:35:21 +00:00
2022-05-30 07:33:56 +00:00
`COLDIV`: color divider (1 or 255) to `love.graphics.setColor` function.
2022-04-27 18:32:52 +00:00
# Fill game information
To fill game information in game folder need to create `info.ll` file.
Syntax is `k = v` with `# comments`
```
# are there needed any comments?
name = New awesome game using Love Loader
desc = Some descripion about the game.
# main = optional main file instead of `main.lua`
2022-04-28 18:35:21 +00:00
pic = screen.png
2022-05-30 07:33:56 +00:00
pics = [ screen.png; screen2.png ] # wow arrays
2022-04-27 18:32:52 +00:00
```