Advertisement
Corbinhol

guiTEST

Jul 17th, 2021 (edited)
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1. local component = require("component");
  2. local gpu = component.gpu;
  3. local event = require("event");
  4.  
  5. local x = 1;
  6. local y = 1;
  7.  
  8. local c_white = 0xffffff;
  9.  
  10. os.execute("sleep 1");
  11. --event.listen("key_down");
  12.  
  13.  
  14.  
  15. function setBackgroundSpace(color)
  16.     gpu.setBackground(color);
  17.     width, height = gpu.getResolution();
  18.     gpu.fill(1, 1, width, height, " ");
  19.     return true;
  20. end
  21.  
  22. function drawTextLn(...)
  23.     local tempText;
  24.     local arg = {...};
  25.     for i, v in ipairs(arg) do
  26.         if i % 2 == 1 then
  27.            
  28.             tempText = v;
  29.         else
  30.             gpu.setForeground(v);
  31.             gpu.set(x, y, tempText);
  32.             x = x + string.len(tempText);
  33.         end
  34.     end
  35.     y = y + 1;
  36.     x = 1;
  37. end
  38.  
  39. function resetScreen()
  40.     x = 1;
  41.     y = 1;
  42.     setBackgroundSpace(0x0d0d0d);
  43. end
  44.  
  45. --Code starts here
  46. gpu.setResolution(36, 36/2);
  47.  
  48.  
  49. while true do
  50.     setBackgroundSpace(0x0d0d0d);
  51.     drawTextLn("Reactor Status: ", 0xffffff)
  52.     drawTextLn("Energy Produced Per Second: ", c_white, "1 gazillion", 0x00ff44)
  53.     check = event.pull(.1, "key_down");
  54.     if check ~= nil then break; end
  55.     resetScreen();
  56. end
  57.  
  58. os.execute("clear");
  59.  
  60.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement