From 10ad19ae756bdef277ec351e5b389032f5aaa42e Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Thu, 7 Feb 2019 05:24:05 +0300 Subject: [PATCH] Added Multiscreen and Shooting applications --- Applications/Multiscreen.app/Icon.pic | Bin 0 -> 151 bytes Applications/Multiscreen.app/Main.lua | 313 ++++++++++++++++++ Applications/Shooting.app/Icon.pic | Bin 0 -> 254 bytes .../Shooting.app/Localizations/English.lang | 3 + .../Shooting.app/Localizations/French.lang | 3 + .../Shooting.app/Localizations/German.lang | 3 + .../Shooting.app/Localizations/Italian.lang | 3 + .../Shooting.app/Localizations/Russian.lang | 3 + .../Shooting.app/Localizations/Ukrainian.lang | 3 + Applications/Shooting.app/Main.lua | 101 ++++++ Installer/Files.cfg | 6 + 11 files changed, 438 insertions(+) create mode 100644 Applications/Multiscreen.app/Icon.pic create mode 100644 Applications/Multiscreen.app/Main.lua create mode 100644 Applications/Shooting.app/Icon.pic create mode 100644 Applications/Shooting.app/Localizations/English.lang create mode 100644 Applications/Shooting.app/Localizations/French.lang create mode 100644 Applications/Shooting.app/Localizations/German.lang create mode 100644 Applications/Shooting.app/Localizations/Italian.lang create mode 100644 Applications/Shooting.app/Localizations/Russian.lang create mode 100644 Applications/Shooting.app/Localizations/Ukrainian.lang create mode 100644 Applications/Shooting.app/Main.lua diff --git a/Applications/Multiscreen.app/Icon.pic b/Applications/Multiscreen.app/Icon.pic new file mode 100644 index 0000000000000000000000000000000000000000..f0bf750d500d66ad9d506711a176a9a56883e5d7 GIT binary patch literal 151 zcmXYqu?@p85CcU%r3i5Eg$x8pm6hBDsj`A?En%;tN%E4_@bSk3_+DPml!Xvd-G2z2 z3BV91ztMoYeQ!#dF+H4nnt%1UhA%^Iem1C hSlider.value then + SSX, SSY = 1, SSY + 1 + if SSY > vSlider.value then + saveConfig() + break + end + end + + workspace:draw() + end + end + end + + GUI.alert("All screens has been successfully calibrated") + mainMenu() + else + GUI.alert("Invalid count of connected screens. You're specified " .. specifiedCount .. " of screens, but there's " .. connectedCount .. " connected screens") + end + end + + workspace:draw() + end + end + + actionComboBox.onItemSelected() + workspace:draw(force) +end + +window.onResize = function(width, height) + window.backgroundPanel.width = width + window.backgroundPanel.height = height + + layout.width = width + layout.height = height +end + +-------------------------------------------------------------------------------- + +window:resize(window.width, window.height) +mainMenu(true) +workspace:draw() diff --git a/Applications/Shooting.app/Icon.pic b/Applications/Shooting.app/Icon.pic new file mode 100644 index 0000000000000000000000000000000000000000..dc24b8f01c62c7cab83344eeb9e50d909c1979b0 GIT binary patch literal 254 zcmXYqy$!-Z425Igly7ZZU z%>wmCGkuAeJ4`R= y do + screen.drawSemiPixelLine(x0 - x, y0 + y, x0 + x, y0 + y, color) + screen.drawSemiPixelLine(x0 - y, y0 + x, x0 + y, y0 + x, color) + screen.drawSemiPixelLine(x0 - x, y0 - y, x0 + x, y0 - y, color) + screen.drawSemiPixelLine(x0 - y, y0 - x, x0 + y, y0 - x, color) + + if err <= 0 then + y = y + 1 + err = err + dy + dy = dy + 2 + end + + if err > 0 then + x = x - 1 + dx = dx + 2 + err = err + dx - bit32.lshift(radius, 1) + end + end +end + +local radius = 30 +local size = radius * 2 +local points = {} +local players = {} +local lastPlayer + +local workspace, window = system.addWindow(GUI.filledWindow(1, 1, 104, 34, 0x1E1E1E)) + +local layout = window:addChild(GUI.layout(1, 1, window.width, window.height, 1, 1)) +layout:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL) +layout:setSpacing(1, 1, 8) + +local circle = layout:addChild(GUI.object(1, 1, size, math.floor(size / 2))) + +local function getColor() + return lastPlayer and players[lastPlayer].color or 0x0092FF +end + +circle.draw = function() + local r, limit = radius, 6 + for i = 1, limit do + drawcircle(circle.x + radius - 1, circle.y * 2 + radius - 2, r, i == limit and 0xFF4940 or i % 2 == 0 and 0x0 or 0xE1E1E1) + r = r - 5 + end + + for i = 1, #points do + screen.drawText(circle.x + points[i][1], circle.y + points[i][2], getColor(), "⬤") + end +end + +local counter = layout:addChild(GUI.object(1, 1, 24, 5)) +counter.draw = function() + local radius = 4 + drawcircle(counter.x + radius, counter.y * 2 + radius, radius, getColor()) + bigLetters.drawText(counter.x + radius * 2 + 4, counter.y, 0xE1E1E1, lastPlayer and tostring(players[lastPlayer].score) or "0") +end + +circle.eventHandler = function(workspace, circle, e1, e2, e3, e4, e5, e6) + if e1 == "touch" then + lastPlayer = e6 + players[lastPlayer] = players[lastPlayer] or { + color = color.HSBToInteger(math.random(360), 1, 1), + score = 0 + } + + players[lastPlayer].score = math.max(0, radius - math.floor(math.sqrt((e3 - (circle.x + radius)) ^ 2 + (e4 * 2 - (circle.y * 2 + radius)) ^ 2))) + + table.insert(points, {e3 - circle.x, e4 - circle.y}) + workspace:draw() + end +end + +window.onResize = function(width, height) + window.backgroundPanel.width = width + window.backgroundPanel.height = height + + layout.width = width + layout.height = height +end + +--------------------------------------------------------------------------------- + +workspace:draw() diff --git a/Installer/Files.cfg b/Installer/Files.cfg index b1ddc7be..a1f127b7 100644 --- a/Installer/Files.cfg +++ b/Installer/Files.cfg @@ -149,6 +149,12 @@ "Libraries/OpenComputersGL/Renderer.lua", "Libraries/OpenComputersGL/Materials.lua", "Libraries/Vector.lua", + -- Multiscreen + { path="Applications/Multiscreen.app/Main.lua", id=1055, shortcut = true }, + "Applications/Multiscreen.app/Icon.pic", + -- Shooting + { path="Applications/Shooting.app/Main.lua", id=1055, shortcut = true }, + "Applications/Shooting.app/Icon.pic", -- Reinstall OS { path="Applications/Reinstall OS.app/Main.lua", id=1055, shortcut = true }, "Applications/Reinstall OS.app/Icon.pic",