Stawlie0

Untitled

Oct 10th, 2023
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. local component = require("component")
  2. local gpu = component.gpu
  3. local baseLib = {}
  4. local id = 1
  5.  
  6. baseLib.getId = function()
  7.     id = id + 1
  8.     return id - 1
  9. end
  10.  
  11. --Возвращает индекс пикселя в буфере по координатам, кол-ву переменных, принадлежащих 1 пикселю, и ширине буфера
  12. baseLib.getIndexByCoords = function(x, y, numberItems, width)
  13.     width = width or gpu.getResolution()
  14.     numberItems = numberItems or 1
  15.     return (y * width - width + x) * numberItems - numberItems
  16. end
  17.  
  18.  
  19. return baseLib
Advertisement
Add Comment
Please, Sign In to add comment