Advertisement
Guest User

Color font codea

a guest
Nov 26th, 2011
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.90 KB | None | 0 0
  1. --color disiplay
  2.  
  3. function setup()
  4.     x11d = false
  5.     x11l = false
  6.     svgd = false
  7.     svgl = false
  8.     ct = {}
  9.     cc = 0
  10.     yt = 0
  11.     f=HersheyRomanSimplex()
  12.     watch("min")
  13.     watch("max")
  14.     watch("yt")
  15. end
  16.  
  17. function draw()
  18.     rect(0,0,10,10)
  19.     background(0, 0, 0, 255)
  20.     strokeWidth(6)
  21.     if not x11d  then
  22.         f:drawstring("x11 loading ..", 150, 200)
  23.         x11d = true
  24.     elseif not x11l then
  25.         for k,v in pairs(Colour.x11) do
  26.             r = Colour.x11[k].colour.
  27.             g = Colour.x11[k].colour.g
  28.             b = Colour.x11[k].colour.b
  29.             lt = k .. " " .. r .. "," .. g .. "," .. b
  30.             cc = cc + 1
  31.             ct[cc] = {r=r,g=g,b=b,lt=lt}
  32.         end
  33.         x11l = true    
  34.     elseif not svgd then
  35.         f:drawstring("svg loading ..", 150, 200)
  36.         svgd = true
  37.     elseif not svgl then
  38.         for k,v in pairs(Colour.svg) do
  39.             r = Colour.svg[k].colour.
  40.             g = Colour.svg[k].colour.g
  41.             b = Colour.svg[k].colour.b
  42.             lt = k .. " " .. r .. "," .. g .. "," .. b
  43.             cc = cc + 1
  44.             ct[cc] = {r=r,g=g,b=b,lt=lt}
  45.         end
  46.         svgl = true   
  47.     else
  48.         min = math.floor(yt / 45)    
  49.         max = math.floor((yt+HEIGHT)/45)
  50.         if min < 1 then min = 1 end
  51.         if min > cc then min = cc end
  52.         if max > cc then max = cc end
  53.         if max < 1 then max = 1 end
  54.         for i = min, max do            
  55.             stroke(ct[i].r,ct[i].g,ct[i].b)
  56.             f:drawstring(ct[i].lt, 10, (i * 45)-yt,1.5)
  57.         end
  58.     end
  59. end
  60.  
  61. function touched(touch)
  62.     --translate(0, yt)
  63.     yt = yt + touch.prevY - touch.y
  64.     
  65. end
  66.  
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement