From f8fce099cac955fe2bd7573f29c472558a1ca6de Mon Sep 17 00:00:00 2001 From: Igor Date: Mon, 21 Mar 2016 10:59:27 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B8=D0=BD=D0=B8-=D1=84=D0=B8=D0=BA?= =?UTF-8?q?=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/doubleBuffering.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/doubleBuffering.lua b/lib/doubleBuffering.lua index 03568da2..87e124ab 100644 --- a/lib/doubleBuffering.lua +++ b/lib/doubleBuffering.lua @@ -486,8 +486,9 @@ function buffer.draw(force) currentBackground, currentForeground = buffer.screen.current[index], buffer.screen.current[index + 1] buffer.screen.changes[currentForeground] = buffer.screen.changes[currentForeground] or {} buffer.screen.changes[currentForeground][currentBackground] = buffer.screen.changes[currentForeground][currentBackground] or {} - table.insert(buffer.screen.changes[currentForeground][currentBackground], { index, table.concat(massiv) }) - + table.insert(buffer.screen.changes[currentForeground][currentBackground], index) + table.insert(buffer.screen.changes[currentForeground][currentBackground], table.concat(massiv)) + --Смещаемся по иксу вправо x = x + #massiv - 1 end @@ -504,11 +505,11 @@ function buffer.draw(force) if currentForeground ~= foreground then gpu.setForeground(foreground); currentForeground = foreground end for background in pairs(buffer.screen.changes[foreground]) do if currentBackground ~= background then gpu.setBackground(background); currentBackground = background end - for i = 1, #buffer.screen.changes[foreground][background] do + for i = 1, #buffer.screen.changes[foreground][background], 2 do --Конвертируем указанный индекс в координаты - x, y = convertIndexToCoords(buffer.screen.changes[foreground][background][i][1]) + x, y = convertIndexToCoords(buffer.screen.changes[foreground][background][i]) --Выставляем ту самую собранную строку из одинаковых цветов - gpu.set(x, y, buffer.screen.changes[foreground][background][i][2]) + gpu.set(x, y, buffer.screen.changes[foreground][background][i + 2]) end end end