From 0549b379d9d4e82eb98182f5de039e29761b927b Mon Sep 17 00:00:00 2001 From: Smok1e Date: Thu, 9 May 2024 14:56:35 +0300 Subject: [PATCH] zalupa --- Wallpapers/DVD.wlp/Config.cfg | 1 + Wallpapers/DVD.wlp/Logo.pic | Bin 0 -> 704 bytes Wallpapers/DVD.wlp/Main.lua | 94 ++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 Wallpapers/DVD.wlp/Config.cfg create mode 100644 Wallpapers/DVD.wlp/Logo.pic create mode 100644 Wallpapers/DVD.wlp/Main.lua diff --git a/Wallpapers/DVD.wlp/Config.cfg b/Wallpapers/DVD.wlp/Config.cfg new file mode 100644 index 00000000..ede70df2 --- /dev/null +++ b/Wallpapers/DVD.wlp/Config.cfg @@ -0,0 +1 @@ +{["speed"]=2,["backgroundColor"]=3351743} \ No newline at end of file diff --git a/Wallpapers/DVD.wlp/Logo.pic b/Wallpapers/DVD.wlp/Logo.pic new file mode 100644 index 0000000000000000000000000000000000000000..eedb43a062cd242a97e2ec25a0fc8b65cf12f8ec GIT binary patch literal 704 zcmXw0NsiP&5R9zNz1VHHyJx01U-`&LNSydmj|PDd;sJ;QWf$Vc4Y3FWf60$DS=lwW zsEo+0$jF!XFP_haKmc((-Btb6Bh zkncQ(fPv#f77Fbx28W8{Tb)M~c5ZQXr0zMsQ^L|>9dP3Kq3Ei8062ckPx()nPYMH$ z9DgY^s5$<=>Tw7;Aa!jl=AN2W@UpoC#N%1@gqFwG3V{`mZxk9@-tnmR;IQTKeGz*e zzZNJ0oooq9gWghilq>Lb&b$HE278AYPmkJQu;D2xBylzUELDM5=N1i5>Kv5YbhyAR zr?YBZCFiLdIR~d#xgudpwkJ+cMmL-^Iq}?bidka_ok8U#xAa+?JdQzv;Pj=;I0dnt z%34n1xw+-^t&qJJv*~+&$=!^VF%g;Pq GK>Hsw4Uu{P literal 0 HcmV?d00001 diff --git a/Wallpapers/DVD.wlp/Main.lua b/Wallpapers/DVD.wlp/Main.lua new file mode 100644 index 00000000..c210df81 --- /dev/null +++ b/Wallpapers/DVD.wlp/Main.lua @@ -0,0 +1,94 @@ +local screen = require("Screen") +local color = require("Color") +local filesystem = require("Filesystem") +local system = require("System") +local GUI = require("GUI") +local image = require("Image") + +-------------------------------------------------------------------------------- + +local workspace, wallpaper = select(1, ...), select(2, ...) + +local configPath = filesystem.path(system.getCurrentScript()) .. "Config.cfg" + +local config = { + backgroundColor = 0x000000, + speed = 1 +} + +if filesystem.exists(configPath) then + for key, value in pairs(filesystem.readTable(configPath)) do + config[key] = value + end +end + +local function saveConfig() + filesystem.writeTable(configPath, config) +end + +-------------------------------------------------------------------------------- + +local logo = image.load(filesystem.path(system.getCurrentScript()) .. "Logo.pic") + +local logoPosition = { + x = math.random(1, wallpaper.width - image.getWidth (logo)), + y = math.random(1, wallpaper.height - image.getHeight(logo)) +} + +local logoSpeed = { + x = (2 * math.random() - 1) * 10, + y = (2 * math.random() - 1) * 10 +} + +local lastUpdateTime = computer.uptime() + +-------------------------------------------------------------------------------- + +wallpaper.draw = function(wallpaper) + local currentTime = computer.uptime() + local deltaTime = currentTime - lastUpdateTime + lastUpdateTime = currentTime + + screen.drawRectangle(wallpaper.x, wallpaper.y, wallpaper.width, wallpaper.height, config.backgroundColor, 0, " ") + screen.drawImage(wallpaper.x + math.floor(logoPosition.x), wallpaper.y + math.floor(logoPosition.y), logo) + + logoPosition.x = logoPosition.x + logoSpeed.x * config.speed * deltaTime + logoPosition.y = logoPosition.y + logoSpeed.y * config.speed * deltaTime + + if logoPosition.x < 1 or logoPosition.x >= wallpaper.width - image.getWidth(logo) then + logoSpeed.x = -logoSpeed.x + end + + if logoPosition.y < 1 or logoPosition.y >= wallpaper.height - image.getHeight(logo) then + logoSpeed.y = -logoSpeed.y + end +end + +wallpaper.configure = function(layout) + layout:addChild(GUI.colorSelector(1, 1, 36, 3, config.backgroundColor, "Background color")).onColorSelected = function(_, object) + config.backgroundColor = object.color + saveConfig() + end + + local speedSlider = layout:addChild( + GUI.slider( + 1, 1, + 36, + 0x66DB80, + 0xE1E1E1, + 0xFFFFFF, + 0xA5A5A5, + 0, 50, + config.speed, + false, + "Speed: " + ) + ) + + speedSlider.onValueChanged = function() + config.speed = math.floor(speedSlider.value) + saveConfig() + end +end + +-------------------------------------------------------------------------------- \ No newline at end of file