1
0
Fork 0
mirror of https://github.com/Reuh/ubiquitousse.git synced 2025-10-27 09:09:30 +00:00

Add LDtk, update docs

This commit is contained in:
Étienne Fildadut 2021-12-24 23:50:03 +01:00
parent c793617ded
commit 582f592a79
13 changed files with 2733 additions and 39 deletions

View file

@ -1,7 +1,14 @@
-- ubiquitousse
--- Ubiquitousse Game Framework.
-- Main module, which will try to load every other Ubiquitousse module when required and provide a few convenience functions.
--- Ubiquitousse main module.
-- Set of various Lua libraries to make game development easier, mainly made to be used alongside the [LÖVE](https://love2d.org/) game framework.
-- Nothing that hasn't been done before, but these are tailored to what I need. They can be used independently too, and are relatively portable, even without LÖVE.
--
-- This is the main module, which will try to load every other Ubiquitousse module when required and may even provide a few convenience functions.
--
-- This also perform a quick LÖVE version check and show a warning in case of potential incompatibility.
--
-- **Regarding Ubiquitousse's organization**
--
-- Ubiquitousse may or may not be used in its totality. You can delete the modules directories you don't need and Ubiquitousse
-- should adapt accordingly. You can also simply copy the modules directories you need and use them directly, without using this
@ -9,47 +16,67 @@
-- However, some modules may provide more feature when other modules are available.
-- These dependencies are written at the top of every main module file.
--
-- Ubiquitousse's goal is to run everywhere with the least porting effort possible, so while the current version mainly focus LÖVE, it
-- should be easily modifiable to work with something else. Ubiquitousse should only require:
-- * The backend needs to have access to some kind of main loop, or at least a function called very often (may or may not be the
-- same as the redraw screen callback).
-- * Some way of measuring time (preferably with millisecond-precision).
-- * Some kind of filesystem.
-- * Lua 5.1, 5.2, 5.3 or LuaJit.
-- * Other requirement for specific modules should be described in the module's documentation.
-- Ubiquitousse's original goal was to run everywhere with the least porting effort possible, so while the current version now mainly focus LÖVE, it
-- should still be easily modifiable to work with something else. Ubiquitousse is mainly tested on LuaJIT and Lua 5.3 but should also support Lua 5.1 and 5.2.
-- In order to keep a good idea of how portable this all is, other dependencies, including LÖVE, are explicited at the top of every module file and in specific
-- functions definition using the `@require` tag (e.g., `-- @require love` for LÖVE).
--
-- Functions that depends on LÖVE or anything that's not in the Lua standard libraries (and therefore the one you may want to port to
-- another framework) are indicated by a "-- @impl love" annotation.
-- Some modules are developped in [Candran](https://github.com/Reuh/candran) (.can files), but can easily be compiled into regular Lua code.
--
-- Units used in the API documentation, unless written otherwise:
--
-- Units used in the API documentation:
-- * All distances are expressed in pixels (px)
-- * All durations are expressed in seconds (ms)
--
-- These units are only used to make writing documentation easier; you can use other units if you want, as long as you're consistent.
--
-- Style:
--
-- * tabs for indentation, spaces for esthetic whitespace (notably in comments)
-- * no globals
-- * UPPERCASE for constants (or maybe not).
-- * CamelCase for class names.
-- * lowerCamelCase is expected for everything else.
--
-- For game writer:
-- Ubiquitousse works with Lua 5.1 to 5.3, including LuaJit, but doesn't provide any version checking or compatibility layer
-- between the different versions, so it's up to you to handle that in your game (or ignore the problem and sticks to your
-- main's backend Lua version).
--
-- Regarding the documentation: Ubiquitousse used LDoc/LuaDoc styled-comments, but since LDoc hates me and my code, the
-- generated result is complete garbage, so please read the documentation directly in the comments here until fix this.
-- Stuff you're interested in starts with triple - (e.g., "--- This functions saves the world").
--
-- *UPDATE*: I give up, currently in the process of admitting defat to LDoc and progressively porting all my documentation to it.
-- Though I had to modify a few things to get LDoc to like me, so the documentation is generated using [my LDoc fork](https://github.com/Reuh/LDoc).
--
-- @usage local ubiquitousse = require("ubiquitousse")
local p = ... -- require path
local ubiquitousse
ubiquitousse = {
--- Ubiquitousse version.
version = "0.1.0"
--- Ubiquitousse version string (currently `"0.1.0"`).
version = "0.1.0",
--- Asset manager module, if available.
-- @see asset
asset = nil,
--- Entity Component System, if available.
-- @see ecs
ecs = nil,
--- Input management, if available.
-- @see input
input = nil,
--- LDtk level import, if available.
-- @see ldtk
ldtk = nil,
--- Scene management, if available.
-- @see scene
scene = nil,
--- Signal management, if available.
-- @see signal
signal = nil,
--- Timer utilities, if available.
-- @see timer
timer = nil,
--- Various useful functions, if available.
-- @see util
util = nil
}
-- Check LÖVE version
@ -70,7 +97,7 @@ end
package.loaded[p] = ubiquitousse
-- Require external submodules
for _, m in ipairs{"signal", "asset", "ecs", "input", "scene", "timer", "util"} do
for _, m in ipairs{"signal", "asset", "ecs", "input", "scene", "timer", "util", "ldtk"} do
local s, t = pcall(require, p.."."..m)
if s then
ubiquitousse[m] = t