mirror of
https://github.com/fairyglade/ly.git
synced 2026-06-22 07:22:00 +00:00
Fix example.lua doc + add ly-community in README
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -56,6 +56,10 @@ Join us on Matrix over at [#ly-dm:matrix.org](https://matrix.to/#/#ly-dm:matrix.
|
|||||||
|
|
||||||
[](https://repology.org/project/ly-display-manager/versions)
|
[](https://repology.org/project/ly-display-manager/versions)
|
||||||
|
|
||||||
|
## Custom animations & user scripts
|
||||||
|
|
||||||
|
If you want to pimp your Ly installation even further than what the traditional configuration file allows you to, a [community repository](https://codeberg.org/fairyglade/ly-community) exists containing custom animations & scripts, so go check it out!
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
Every environment that works on other login managers also should work on Ly.
|
Every environment that works on other login managers also should work on Ly.
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
--
|
--
|
||||||
-- For the byte argument, you may use string.byte to fill this argument.
|
-- For the byte argument, you may use string.byte to fill this argument.
|
||||||
--
|
--
|
||||||
-- putCell(byte, fg, bg, x, y, w, h) -- Draw a rectangle.
|
-- putRect(byte, fg, bg, x, y, w, h) -- Draw a rectangle.
|
||||||
-- Arguments are the same as putCell except for w and h, which are also
|
-- Arguments are the same as putCell except for w and h, which are also
|
||||||
-- unsigned integers. The rectangle will be drawn from the top-left, with
|
-- unsigned integers. The rectangle will be drawn from the top-left, with
|
||||||
-- argument w extending it to the right and argument h extending downwards.
|
-- argument w extending it to the right and argument h extending downwards.
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
-- you create.
|
-- you create.
|
||||||
local FPS_COUNT = 40
|
local FPS_COUNT = 40
|
||||||
local function FPS()
|
local function FPS()
|
||||||
return (1/FPS_COUNT)*1000000
|
return (1 / FPS_COUNT) * 1000000
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -64,56 +64,56 @@ local SQUARE_COUNT = 25
|
|||||||
local squares = {}
|
local squares = {}
|
||||||
|
|
||||||
for i = 1, SQUARE_COUNT do
|
for i = 1, SQUARE_COUNT do
|
||||||
local vx = 1
|
local vx = 1
|
||||||
local vy = 1
|
local vy = 1
|
||||||
if math.random(1, 2) == 2 then vx = -vx end
|
if math.random(1, 2) == 2 then vx = -vx end
|
||||||
if math.random(1, 2) == 2 then vy = -vy end
|
if math.random(1, 2) == 2 then vy = -vy end
|
||||||
squares[#squares+1] = {
|
squares[#squares + 1] = {
|
||||||
x = math.random(1, ly.width - SQUARE_WIDTH),
|
x = math.random(1, ly.width - SQUARE_WIDTH),
|
||||||
y = math.random(1, ly.height - SQUARE_HEIGHT),
|
y = math.random(1, ly.height - SQUARE_HEIGHT),
|
||||||
vx = vx,
|
vx = vx,
|
||||||
vy = vy,
|
vy = vy,
|
||||||
color = math.random(0xFFFFFF)
|
color = math.random(0xFFFFFF)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local timer = ly.clock()
|
local timer = ly.clock()
|
||||||
local perf = ly.clock()
|
local perf = ly.clock()
|
||||||
|
|
||||||
function draw()
|
function draw()
|
||||||
-- Rather than progressing the animation by frame, do it based on
|
-- Rather than progressing the animation by frame, do it based on
|
||||||
-- seconds, via ly.clock(). In this timeframe, you can update the animation
|
-- seconds, via ly.clock(). In this timeframe, you can update the animation
|
||||||
-- state.
|
-- state.
|
||||||
-- DO NOT DRAW CELLS IN THIS TIMEFRAME. You will get flickering.
|
-- DO NOT DRAW CELLS IN THIS TIMEFRAME. You will get flickering.
|
||||||
|
|
||||||
-- if this check passes, we can update the animation
|
-- if this check passes, we can update the animation
|
||||||
if timer + FPS() < ly.clock() then
|
if timer + FPS() < ly.clock() then
|
||||||
for i, v in ipairs(squares) do
|
for i, v in ipairs(squares) do
|
||||||
v.x = v.x + v.vx
|
v.x = v.x + v.vx
|
||||||
v.y = v.y + v.vy
|
v.y = v.y + v.vy
|
||||||
if v.x == 0 then
|
if v.x == 0 then
|
||||||
v.vx = 1; v.color = math.random(0xFFFFFF)
|
v.vx = 1; v.color = math.random(0xFFFFFF)
|
||||||
end
|
end
|
||||||
if v.x + SQUARE_WIDTH >= ly.width-1 then
|
if v.x + SQUARE_WIDTH >= ly.width - 1 then
|
||||||
v.vx = -1; v.color = math.random(0xFFFFFF)
|
v.vx = -1; v.color = math.random(0xFFFFFF)
|
||||||
end
|
end
|
||||||
if v.y == 0 then
|
if v.y == 0 then
|
||||||
v.vy = 1; v.color = math.random(0xFFFFFF)
|
v.vy = 1; v.color = math.random(0xFFFFFF)
|
||||||
end
|
end
|
||||||
if v.y + SQUARE_HEIGHT >= ly.height-1 then
|
if v.y + SQUARE_HEIGHT >= ly.height - 1 then
|
||||||
v.vy = -1; v.color = math.random(0xFFFFFF)
|
v.vy = -1; v.color = math.random(0xFFFFFF)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
timer = ly.clock()
|
timer = ly.clock()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
for i, v in ipairs(squares) do
|
for i, v in ipairs(squares) do
|
||||||
ly.putRect(string.byte(' '), 0, v.color, v.x, v.y, SQUARE_WIDTH, SQUARE_HEIGHT)
|
ly.putRect(string.byte(' '), 0, v.color, v.x, v.y, SQUARE_WIDTH, SQUARE_HEIGHT)
|
||||||
end
|
end
|
||||||
|
|
||||||
local new_perf = ly.clock()
|
local new_perf = ly.clock()
|
||||||
local str = "FT: "..((new_perf - perf) / 1000).."ms"
|
local str = "FT: " .. ((new_perf - perf) / 1000) .. "ms"
|
||||||
ly.putLabel(str , 0x00FFFFFF, 0, (ly.width/2) - (string.len(str)/2), ly.height-1)
|
ly.putLabel(str, 0x00FFFFFF, 0, (ly.width / 2) - (string.len(str) / 2), ly.height - 1)
|
||||||
perf = new_perf
|
perf = new_perf
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user