mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-01-07 19:52:40 +01:00
Попизже буфер, а еще оска чутка тоже
This commit is contained in:
parent
5b37b13f1a
commit
3ef4739bf0
@ -8,7 +8,7 @@
|
||||
about="IgorTimofeev/OpenComputers/master/MineOS/About/",
|
||||
type="Script",
|
||||
forceDownload=true,
|
||||
version=3.22,
|
||||
version=3.23,
|
||||
},
|
||||
{
|
||||
name="MineOS/Pictures/Raspberry.pic",
|
||||
@ -401,7 +401,7 @@
|
||||
name="lib/doubleBuffering.lua",
|
||||
url="IgorTimofeev/OpenComputers/master/lib/doubleBuffering.lua",
|
||||
type="Library",
|
||||
version=1.11,
|
||||
version=1.12,
|
||||
},
|
||||
{
|
||||
name="lib/thread.lua",
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
-- package.loaded.MineOSCore = nil
|
||||
-- _G.MineOSCore = nil
|
||||
|
||||
---------------------------------------------- Копирайт, епта ------------------------------------------------------------------------
|
||||
|
||||
@ -16,23 +14,23 @@ local copyright = [[
|
||||
]]
|
||||
|
||||
-- Вычищаем копирайт из оперативки, ибо мы не можем тратить СТОЛЬКО памяти.
|
||||
-- Сколько тут, раз, два, три... 295 ASCII-символов!
|
||||
-- А это, между прочим, 59 раз по слову "Пидор". Но один раз - не пидорас, поэтому очищаем.
|
||||
-- Я передумал, не очищаем, пригодится еще. Вот же ж неоптимизированная параша!
|
||||
-- Сколько тут, раз, два, три... 282 UTF-8 символа!
|
||||
-- А это, между прочим, 56 раз по слову "Пидор". Но один раз - не пидорас, поэтому очищаем.
|
||||
|
||||
-- Я передумал, не очищаем, пригодится еще кое-где. Вот же ж костыльная параша!
|
||||
-- copyright = nil
|
||||
|
||||
---------------------------------------------- Библиотеки ------------------------------------------------------------------------
|
||||
|
||||
-- Адаптивная загрузка необходимых библиотек и компонентов
|
||||
local libraries = {
|
||||
component = "component",
|
||||
image = "image",
|
||||
buffer = "doubleBuffering",
|
||||
MineOSCore = "MineOSCore",
|
||||
GUI = "GUI",
|
||||
image = "image",
|
||||
ecs = "ECSAPI",
|
||||
component = "component",
|
||||
event = "event",
|
||||
term = "term",
|
||||
files = "files",
|
||||
context = "context",
|
||||
SHA2 = "SHA2",
|
||||
|
||||
@ -7,13 +7,7 @@ local libraries = {
|
||||
["colorlib"] = "colorlib",
|
||||
}
|
||||
|
||||
local components = {
|
||||
["gpu"] = "gpu",
|
||||
}
|
||||
|
||||
for library in pairs(libraries) do if not _G[library] then _G[library] = require(libraries[library]) end end
|
||||
for comp in pairs(components) do if not _G[comp] then _G[comp] = _G.component[components[comp]] end end
|
||||
libraries, components = nil, nil
|
||||
for library in pairs(libraries) do if not _G[library] then _G[library] = require(libraries[library]) end end; libraries = nil
|
||||
|
||||
local buffer = {}
|
||||
local debug = false
|
||||
@ -64,7 +58,7 @@ function buffer.start()
|
||||
buffer.screen = {}
|
||||
buffer.screen.current = {}
|
||||
buffer.screen.new = {}
|
||||
buffer.screen.width, buffer.screen.height = gpu.getResolution()
|
||||
buffer.screen.width, buffer.screen.height = component.gpu.getResolution()
|
||||
|
||||
buffer.resetDrawLimit()
|
||||
|
||||
@ -533,21 +527,20 @@ function buffer.draw(force)
|
||||
|
||||
--Перебираем все цвета текста и фона, выполняя гпу-операции
|
||||
for foreground in pairs(buffer.screen.changes) do
|
||||
if indexPlus1 ~= foreground then gpu.setForeground(foreground); indexPlus1 = foreground end
|
||||
if indexPlus1 ~= foreground then component.gpu.setForeground(foreground); indexPlus1 = foreground end
|
||||
for background in pairs(buffer.screen.changes[foreground]) do
|
||||
if index ~= background then gpu.setBackground(background); index = background end
|
||||
if index ~= background then component.gpu.setBackground(background); index = background end
|
||||
|
||||
for i = 1, #buffer.screen.changes[foreground][background], 2 do
|
||||
--Конвертируем указанный индекс в координаты
|
||||
x, y = convertIndexToCoords(buffer.screen.changes[foreground][background][i])
|
||||
--Выставляем ту самую собранную строку из одинаковых цветов
|
||||
gpu.set(x, y, buffer.screen.changes[foreground][background][i + 1])
|
||||
component.gpu.set(x, y, buffer.screen.changes[foreground][background][i + 1])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Очищаем память, ибо незачем нам хранить третий буфер
|
||||
buffer.screen.changes = {}
|
||||
buffer.screen.changes = nil
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user