diff --git a/docs/index.html b/docs/index.html index bb6ee8a..b78fb8c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -108,7 +108,7 @@
generated by LDoc 1.4.6 -Last updated 2021-12-27 13:22:21 +Last updated 2021-12-27 14:09:51
diff --git a/docs/modules/asset.html b/docs/modules/asset.html index 4bdd1a4..952c0b6 100644 --- a/docs/modules/asset.html +++ b/docs/modules/asset.html @@ -334,7 +334,7 @@
generated by LDoc 1.4.6 -Last updated 2021-12-27 13:22:21 +Last updated 2021-12-27 14:09:51
diff --git a/docs/modules/ecs.html b/docs/modules/ecs.html index e4484a8..c5a1cb2 100644 --- a/docs/modules/ecs.html +++ b/docs/modules/ecs.html @@ -224,6 +224,14 @@ end System:render (e, c) [callback] Called when drawing the system, for every entity the system contains. + + System:onUpdateEnd (dt) [callback] + Called after updating the system. + + + System:onDrawEnd () [callback] + Called after drawing the system. +

Read-only fields.

@@ -1002,6 +1010,7 @@ avoid repeating your filters or allow controlling several system from a single p
Called when updating the system. + Called before any call to System:process or call to subsystems. @@ -1027,6 +1036,7 @@ avoid repeating your filters or allow controlling several system from a single p
Called when drawing the system. + Called before any call to System:draw or call to subsystems. @@ -1044,7 +1054,8 @@ avoid repeating your filters or allow controlling several system from a single p System:process (e, c, dt) [callback]
- Called when updating the system, for every entity the system contains. Called after System:onUpdate was called on the system. + Called when updating the system, for every entity the system contains. + Called after System:onUpdate was called on the system, and before any call to subsystems. @@ -1077,7 +1088,8 @@ avoid repeating your filters or allow controlling several system from a single p System:render (e, c) [callback]
- Called when drawing the system, for every entity the system contains. Called after System:onDraw was called on the system. + Called when drawing the system, for every entity the system contains. + Called after System:onDraw was called on the system, and before any call to subsystems. @@ -1100,6 +1112,51 @@ avoid repeating your filters or allow controlling several system from a single p +
+
+ + System:onUpdateEnd (dt) [callback] +
+
+ Called after updating the system. + Called after System:onDraw, System:process and calls to subsystems. + + + + + + +

Parameters:

+ + + + + + +
+
+ + System:onDrawEnd () [callback] +
+
+ Called after drawing the system. + Called after System:onUpdate, System:render and calls to subsystems. + + + + + + + + + + +

Read-only fields.

@@ -1626,7 +1683,7 @@ its sibling systems (i.e. completely stop the propagation of the event).
generated by LDoc 1.4.6 -Last updated 2021-12-27 13:22:21 +Last updated 2021-12-27 14:09:51
diff --git a/docs/modules/ldtk.html b/docs/modules/ldtk.html index f246f03..b1289ac 100644 --- a/docs/modules/ldtk.html +++ b/docs/modules/ldtk.html @@ -178,7 +178,7 @@ end

Layer objects

- + @@ -311,11 +311,11 @@ end

Level objects

Layer:draw ()Layer:draw ([, x=0[, y=0]]) Draw the current layer.
- - + + - + @@ -712,7 +712,8 @@ end
Called for the entity when drawing the associated entity layer (you will likely want to redefine it).

-

By default, this draws the tile associated with the entity if there is one, or a rectangle around the entity position otherwise. +

By default, this draws the tile associated with the entity if there is one, or a rectangle around the entity position otherwise, + assuming we are currently in layer coordinates (i.e. layer top-left is at 0,0).

Requires:

+

Parameters:

+ @@ -1459,13 +1475,16 @@ end
- Level:draw () + Level:draw ([, x=0[, y=0]])
- Draw this level (background and layers). - Assumes we are currently in world coordinates (i.e. world top-left is at 0,0). - The level must be loaded. - Will draw the eventual backgrounds and all the layers in the level. + Draw this level. + Will draw the eventual backgrounds and all the layers in the level.

+ +

Assumes we are currently in world coordinates (i.e. world top-left is at 0,0). + You can specify an offset if your world top-left coordinate is not at 0,0 (or to produce other effects).

+ +

The level must be loaded.

Requires:

    @@ -1475,6 +1494,19 @@ end
+

Parameters:

+
    +
  • x + number + offset X position to draw the level at + (default 0) +
  • +
  • y + number + offset Y position to draw the level at + (default 0) +
  • +
@@ -1483,12 +1515,15 @@ end
- Level:drawBackground () + Level:drawBackground ([, x=0[, y=0]])
- Draw this level background. - Assumes we are currently in level coordinates (i.e. level top-left is at 0,0). - The level must be loaded. + Draw this level background.

+ +

Assumes we are currently in level coordinates (i.e. level top-left is at 0,0). + You can specify an offset if your level top-left coordinate is not at 0,0 (or to produce other effects).

+ +

The level must be loaded.

Requires:

    @@ -1498,6 +1533,19 @@ end
+

Parameters:

+
    +
  • x + number + offset X position to draw the background at + (default 0) +
  • +
  • y + number + offset Y position to draw the backgroud at + (default 0) +
  • +
@@ -1781,7 +1829,7 @@ end Level background.

If there is a background image, background.image contains a table {image=image, x=number, y=number, sx=number, sy=number} - where image is the LÖVE image (or image filepath if LÖVE not available) x and y are the top-left position, + where image is the LÖVE image (or image filepath if LÖVE not available) x and y are the top-left position, and sx and sy the horizontal and vertical scale factors. @@ -1856,7 +1904,7 @@ end

  • Enum are converted into a Lua string giving the currently selected enum value.
  • Filepath are converted into a Lua string giving the file path.
  • Arrays are converted into a Lua table with the elements in it as a list.
  • -
  • Points are converted into a Lua table with the fields x and y: { x=number, y=number }.
  • +
  • Points are converted into a Lua table with the fields x and y: { x=number, y=number }.
  • Colors are converted into a Lua table with the red, green and blue components in [0-1] as a list: {r,g,b}.
  • @@ -1882,7 +1930,7 @@ end
    generated by LDoc 1.4.6 -Last updated 2021-12-27 13:22:21 +Last updated 2021-12-27 14:09:51
    diff --git a/docs/modules/scene.html b/docs/modules/scene.html index 34b6551..d60f215 100644 --- a/docs/modules/scene.html +++ b/docs/modules/scene.html @@ -702,7 +702,7 @@
    generated by LDoc 1.4.6 -Last updated 2021-12-27 13:22:21 +Last updated 2021-12-27 14:09:51
    diff --git a/docs/modules/signal.html b/docs/modules/signal.html index f5e84bb..e5e4cf4 100644 --- a/docs/modules/signal.html +++ b/docs/modules/signal.html @@ -414,7 +414,7 @@
    generated by LDoc 1.4.6 -Last updated 2021-12-27 13:22:21 +Last updated 2021-12-27 14:09:51
    diff --git a/docs/modules/timer.html b/docs/modules/timer.html index 6cb72a5..1c97244 100644 --- a/docs/modules/timer.html +++ b/docs/modules/timer.html @@ -1153,7 +1153,7 @@
    generated by LDoc 1.4.6 -Last updated 2021-12-27 13:22:21 +Last updated 2021-12-27 14:09:51
    diff --git a/docs/modules/ubiquitousse.html b/docs/modules/ubiquitousse.html index 26be33a..3929eb8 100644 --- a/docs/modules/ubiquitousse.html +++ b/docs/modules/ubiquitousse.html @@ -362,7 +362,7 @@
    generated by LDoc 1.4.6 -Last updated 2021-12-27 13:22:21 +Last updated 2021-12-27 14:09:51
    diff --git a/docs/modules/util.html b/docs/modules/util.html index 21b884c..0239a99 100644 --- a/docs/modules/util.html +++ b/docs/modules/util.html @@ -784,7 +784,7 @@
    generated by LDoc 1.4.6 -Last updated 2021-12-27 13:22:21 +Last updated 2021-12-27 14:09:51
    diff --git a/docs/topics/LICENSE.html b/docs/topics/LICENSE.html index caff6fb..c30109c 100644 --- a/docs/topics/LICENSE.html +++ b/docs/topics/LICENSE.html @@ -64,7 +64,7 @@
    generated by LDoc 1.4.6 -Last updated 2021-12-27 13:22:21 +Last updated 2021-12-27 14:09:51
    diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index 608d8ae..bac6dc4 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -71,7 +71,7 @@
    generated by LDoc 1.4.6 -Last updated 2021-12-27 13:22:21 +Last updated 2021-12-27 14:09:51
    diff --git a/ecs/ecs.can b/ecs/ecs.can index 55761ff..9f3fea3 100644 --- a/ecs/ecs.can +++ b/ecs/ecs.can @@ -327,23 +327,36 @@ let system_mt = { -- @callback onDestroy = :() end, --- Called when updating the system. + -- Called before any call to `System:process` or call to subsystems. -- @callback -- @number dt delta-time since last update onUpdate = :(dt) end, --- Called when drawing the system. + -- Called before any call to `System:draw` or call to subsystems. -- @callback onDraw = :() end, - --- Called when updating the system, for every entity the system contains. Called after `System:onUpdate` was called on the system. + --- Called when updating the system, for every entity the system contains. + -- Called after `System:onUpdate` was called on the system, and before any call to subsystems. -- @callback -- @tparam Entity e the entity table -- @tparam Component c the entity's system component, if any -- @number dt delta-time since last update process = :(e, c, dt) end, - --- Called when drawing the system, for every entity the system contains. Called after `System:onDraw` was called on the system. + --- Called when drawing the system, for every entity the system contains. + -- Called after `System:onDraw` was called on the system, and before any call to subsystems. -- @callback -- @tparam Entity e the entity table -- @tparam Component c the entity's system component, if any render = :(e, c) end, + --- Called after updating the system. + -- Called after `System:onDraw`, `System:process` and calls to subsystems. + -- @callback + -- @number dt delta-time since last update + onUpdateEnd = :(dt) end, + --- Called after drawing the system. + -- Called after `System:onUpdate`, `System:render` and calls to subsystems. + -- @callback + onDrawEnd = :() end, --- Read-only fields. -- @@ -626,6 +639,7 @@ let system_mt = { for _, s in ipairs(@systems) do s:update(dt) end + @onUpdateEnd(dt) if @interval then @_waited -= @interval end @@ -645,6 +659,7 @@ let system_mt = { for _, s in ipairs(@systems) do s:draw() end + @onDrawEnd() end end, --- Trigger a custom callback on a single entity.
    Level:draw ()Draw this level (background and layers).Level:draw ([, x=0[, y=0]])Draw this level.
    Level:drawBackground ()Level:drawBackground ([, x=0[, y=0]]) Draw this level background.