Love Loader v2.2

Added conf.lua support.

Updated readme.

Updated screenshots.
This commit is contained in:
Er2 2022-07-08 16:12:11 +03:00
parent e46bc230a6
commit 45f3db4f47
4 changed files with 103 additions and 37 deletions

View File

@ -67,5 +67,53 @@ if ll.mdir then
end)
end
local t = {
title = 'Untitled',
window = {
width = W, height = H,
fullscreen = love.window.getFullscreen(),
resizable = false,
},
audio = {
mixwithsystem = true,
mic = false,
},
modules = {},
console = false,
accelerometerjoystick = true,
gammacorrect = false,
}
if pcall(require, 'conf')
and love.conf
then pcall(love.conf, t)
end
if t.console and love._openConsole
then love._openConsole()
end
love._setGammaCorrect(t.gammacorrect)
if MOBILE then
love._setAccelerometerAsJoystick(t.accelerometerjoystick)
if love.isVersionCompatible '11.3' then
love._setAudioMixWithSystem(t.audio.mixwithsystem)
love._requestRecordingPermission(t.audio.mic)
end
love.filesystem._setAndroidSaveExternal(t.externalstorage)
end
if t.window then
love.window.setTitle(t.window.title or t.title)
local ww, wh, wi =
t.window.width, t.window.height,
t.window.icon
t.window.width, t.window.height, t.window.title, t.window.icon
= nil
assert(love.window.setMode(ww, wh, t.window), 'Error setting up window')
if wi
then love.window.setIcon(love.image.newImageData(wi))
end
end
love.resize(love.graphics.getDimensions())
end

View File

@ -2,6 +2,8 @@
Custom menu for selecting game from multiple for Love2D.
Works from Love2D 0.10.
![PSP Style](./scr/psp.png)
[Other screenshots](./scr)
@ -10,7 +12,7 @@ Custom menu for selecting game from multiple for Love2D.
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
Technically, this creates the loop until game wasn't selected or user wants to exit,
with custom event handling and redrawing.
# LibLL
@ -19,8 +21,8 @@ Love Loader from 2.0 includes backend API to simplify creating custom skins.
It have not so many functions and fields:
- `ll.games` - field for games, which have this structure:
```lua
```lua
ll.games = { -- field for games with structure below
{
name = 'string', -- Friendly name for game or placeholder
desc = 'string', -- Description for game or placeholder
@ -32,69 +34,85 @@ It have not so many functions and fields:
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.mdir -- string or nil, contains full mounted directory.
ll.mgme -- game or nil, contains mounted game
- `ll.mgme` - game or nil, contains mounted game.
-- check if game mounted by ll.mdir!
- `ll.gameNew(configuration --[[string]], fileName --[[string, not used]], base --[[string]], directory --[[string]])`
function ll.gameNew(
configuration, --string
fileName, -- string, not used
baseDirectory, -- string
gameDirectory -- string
) -- creates game object (defined above) and returns it.
Creates game object (defined above) and returns it.
function ll.gameAdd(...) -- same as ll.gameNew with insertion into ll.games.
- `ll.gameAdd(conf, file, base, dir)` - same as `ll.gameNew` with insertion into `ll.games`.
function ll.addGame(fileName, fileContent) -- reserved function for file dropping.
- `ll.addGame(fileName, fileContent)` - function for file dropping, reserved for v3.0.
function ll.mount(gameObject) -- mounts game.
-- throws error.
-- Sets ll.mdir and ll.mgme
- `ll.mount(game)` - mounts game.
function ll.umount() -- unmounts game if was mounted.
-- Unsets ll.mdir and ll.mgme
Can throw an error.
ll.home = llHome
Sets `ll.mdir` and `ll.mgme`.
function ll.devtools() -- enable developer tools.
- `ll.umount()` - unmounts game if can.
if ll.dt then -- is developer tools enabled?
__LL = ll -- global variable with Love Loader instance.
end
Unsets `ll.mdir` and `ll.mgme`.
function ll.fsIsAbs(file) -- is file absolute? (/file)
- `ll.home()` - calls `llHome`
function ll.fsIsRel(file) -- is file relative? (./file)
-- return not ll.fsIsAbs(file)
- `ll.dt` - is developer tools enabled?
function ll.fsDir(path) -- get directory name (2 from /1/2/3.file)
- `__LL` - global variable of Love Loader instance when developer tools enabled.
function ll.fsFile(path) -- get file (including dividers after) (2 from /1/2)
- `ll.devtools()` - enable developer tools.
function ll.kbInit(
direction, -- string: '*', 'h', 'v', 'x', 'y'
c1, -- number, coordinate before card (for mouse) (left/top)
c2, -- number, coordinate after card (for mouse) (right/bottom)
clim -- number = -1, other coordinate limit (for mouse) (x for v, y for h), -1 to disable
) -- initialize keyboard module (inside skins).
- `ll.fsIsAbs(file)` - is file absolute (/file)?
function ll.kbGet() -- get key pressed.
-- need ll.kbInit(...) before
-- returns nil | string: '<', '>', 'o', 'm', ('^', 'v' if direction == '*')
- `ll.fsIsRel(file)` - is file relative, inverted result of ll.fsIsAbs (./file).
- `ll.fsDir(path)` - get directory name (2 from /1/2/3.file).
- `ll.fsFile(path)` - get file (including dividers after) (2 from /1/2/).
- `ll.kbInit(direction --[[string: *, h, v, x, y]], c1 --[[number, coordinate before card for mouse (left/top)]], c2 --[[number, coordinate after card for mouse (right/bottom)]], clim --[[other coordinate limit for mouse or -1 to disable]])` - initialize keyboard module for skins.
- `ll.kbGet() --[[nil, string: <, >, o, m, ^ anv v if direction is *]]` - get key pressed.
```
# API
To reduce things to do for game developers, this loader creates some global variables to use.
You can also use it without Love Loader (or if your game can distribute without loader) by including `ll-min.lua` file.
You can also use it without Love Loader (or if your game can distribute without loader)
using `require 'll-min'`
`W` and `H`: width and height of the screen which controls by custom love.resize function.
```lua
W, H = width, height -- of the screen.
`love.resize` and optional `resize` payload: functions called when screen size was changed and on booting.
function love.resize() -- internal function that updates W, H and calls resize function if exists.
`love.event.quit`: function to exit to main screen.
function resize() -- payload for love.resize function.
`llHome`: function called by `love.event.quit` (broken for now).
function love.event.quit() -- *should* exit to Love Loader screen.
`llUsed`: is Love Loader (not minimal API) used.
function llHome() -- function called by love.event.quit.
`COLDIV`: color divider (1 or 255) to `love.graphics.setColor` function.
llUsed = false -- is Love Loader (not minimal API) used.
`MOBILE`: is this device runs Android or iOS?
COLDIV = 1 -- or 255, color divider for love.graphics.setColor function (150/COLDIV).
MOBILE = false -- is this device runs Android or iOS?
```
# Fill game information

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 31 KiB