Advertisement
C0BRA

Console screen test

Dec 25th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. local screen = self.CreateLink("screen")
  2.  
  3. function ProgressBar(x, y, w, perc)
  4.     local extra = w * perc
  5.     local fg = string.rep(" ", extra)
  6.     local bg = string.rep(" ", w)
  7.    
  8.     screen.Draw(bg, x, y, Color(0, 0, 0, 0), Color(0, 0, 0, 127))
  9.     screen.Draw(fg, x, y, Color(0, 0, 0, 0), Color(127, 127, 127))
  10.    
  11.     screen.Draw( tostring(perc * 100) .. "%", x + w * 0.5 - 2, y)
  12. end
  13.  
  14. function Think()
  15.     if not screen.Connected then return 1 end
  16.     screen.Clear(Color(0, 0, 0, 0))
  17.    
  18.     screen.Draw("Hello, world.", 1, 16, Color(255, 0, 0, 255), Color(0, 0, 0, 0))
  19.     ProgressBar(1, 17, 30, 0.1)
  20.    
  21.     return 1
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement