Advertisement
rjs232323

back server rack spirit world

Jun 19th, 2015
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.69 KB | None | 0 0
  1. --script for back server rack
  2. local component = require("component");
  3. local event = require("event");
  4. local shell= require("shell");
  5. local gpu = component.gpu;
  6. local unicode = require("unicode");
  7. local camera = component.camera;
  8. local distanceCamera=camera.distance;
  9. local term = require("term")
  10.  
  11. local leftScreen = component.get("cd6");
  12. --gpu.bind(leftScreen);
  13.  
  14.  
  15. local rightScreen = component.get("575");
  16. --gpu.bind(rightScreen);
  17. gpu.bind(leftScreen);
  18. local leftW, leftH = gpu.getResolution()
  19. gpu.fill(1, 1, leftW,leftH, " ") -- clears the screen
  20.  
  21. gpu.bind(rightScreen);
  22. local rightW, rightH= gpu.getResolution()
  23. gpu.fill(1, 1, rightW,rightH, " ") -- clears the screen
  24.  
  25. local debugEvent=false;
  26. local eventToBeListening={"touch","walk","chat","motion","component_added","scroll"};
  27.  
  28. local function eventListener_example(eve)
  29. gpu.bind(rightScreen);
  30. print(eve);
  31. end
  32.  
  33. for eventName= 1, #eventToBeListening do
  34. event.listen(eventToBeListening[eventName],eventListener_example);
  35. end
  36.  
  37. local array = " .,-=+xX#";
  38. local charBlock=unicode.char(9608);
  39. local function camera_draw ()
  40. local yp = 1;
  41.  
  42. gpu.bind(leftScreen);
  43.  
  44. gpu.setBackground(0xFFFFFF)
  45.  
  46. for j = -0.75,0.25,0.025 do
  47. local xPos=1;
  48.   for i = -1,1,0.025 do
  49.     local d = distanceCamera(i, 0-j)
  50.     local a = 1
  51.     if d > 0 then a = 2 + (8 - math.min(8, (d/1.2))) end
  52.     gpu.setForeground(0xffffff*a)
  53.     gpu.fill(xPos,yp,1,1,charBlock)
  54.     xPos=xPos+1;
  55.     --term.write(string.sub(array, a, a)) -- works
  56.     --print("test"); prints fine.
  57.   end
  58.   yp=yp+1
  59.   --term.setCursor(1,yp) -- works
  60. end
  61. os.sleep(1)
  62. camera_draw();
  63. end
  64. event.timer(1,camera_draw , 1);
  65.  
  66.  
  67. while debugEvent do
  68. print(event.pull())
  69. os.sleep(0.05);
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement