diff --git a/Applications.txt b/Applications.txt index dd5ee079..f9c695e4 100644 --- a/Applications.txt +++ b/Applications.txt @@ -472,6 +472,13 @@ ["icon"]="IgorTimofeev/OpenComputers/master/Applications/AppStore/Icon.pic", ["version"]=1.0, }, + { + ["name"]="MineOS/Applications/Matrix", + ["url"]="IgorTimofeev/OpenComputers/master/Applications/Matrix/Matrix.lua", + ["type"]="Application", + ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Matrix/Icon.pic", + ["version"]=1.0, + }, ----------------------------------------------------- Приложения с ресурсами -------------------------------------------------------------------------- diff --git a/Applications/Matrix/Icon.pic b/Applications/Matrix/Icon.pic new file mode 100644 index 00000000..a7d61f29 Binary files /dev/null and b/Applications/Matrix/Icon.pic differ diff --git a/Applications/Matrix/Matrix.lua b/Applications/Matrix/Matrix.lua new file mode 100644 index 00000000..23f0ae0b --- /dev/null +++ b/Applications/Matrix/Matrix.lua @@ -0,0 +1,83 @@ + + +local event = require("event") +local gpu = require("component").gpu +if not _G.buffer then _G.buffer = require("doubleBuffering") end + +local xOld, yOld = gpu.getResolution() +local xSize, ySize = 80, 25 +gpu.setResolution(xSize, ySize) + +local lengthOfLine = 14 +local countOfLinesToGenerate = 5 +local counter = 0 +local speed = 0.08 + +local lines = { + {x = 2, y = 3}, +} + +local chars = { "%", "!", "@", "#", ":", "<", ">", "&", "?", "~", "/", "+", "=", "-", "*"} + +local function generateLines() + for i = 1, countOfLinesToGenerate do + table.insert(lines, {x = math.random(1, xSize), y = 1}) + end +end + +local function moveLines() + local i = 1 + while i <= #lines do + lines[i].y = lines[i].y + 1 + if lines[i].y - lengthOfLine > ySize then table.remove(lines, i) else i = i + 1 end + end +end + +local function showLine(lineNumber) + local baseColor = 0x00FF00 + local yPos = lines[lineNumber].y + for i = 1, lengthOfLine do + local symbol = chars[math.random(1, #chars)] + + if i == 1 then + buffer.set(lines[lineNumber].x, yPos, 0x000000, 0xFFFFFF, symbol) + else + buffer.set(lines[lineNumber].x, yPos, 0x000000, baseColor, symbol) + baseColor = baseColor - 0x001100 + end + + yPos = yPos - 1 + end + buffer.set(lines[lineNumber].x, yPos, 0x000000, 0x000000, " ") +end + +local function showLines() + for i = 1, #lines do + showLine(i) + end +end + +local counter = 0 +local function matrix() + showLines() + moveLines() + counter = counter + 1 + if counter >= 5 then counter = 0; generateLines() end + buffer.draw() +end + +buffer.square(1, 1, xSize, ySize, 0x000000, 0x000000, " ") +buffer.draw() + +local timerID = event.timer(speed, matrix, math.huge) + +ecs.wait() +event.cancel(timerID) +gpu.setResolution(xOld, yOld) + +buffer.square(1, 1, xSize, ySize, 0x000000, 0x000000, " ") +buffer.draw() + + + + diff --git a/Installer/Installer.lua b/Installer/Installer.lua index 2144cb90..333b3308 100644 --- a/Installer/Installer.lua +++ b/Installer/Installer.lua @@ -431,6 +431,8 @@ local apps = { "Camera.app", "Autorun.app", "BufferDemo.app", + "Matrix.app", + "AppStore.app", } local dockApps = {