CapsAdmin

Untitled

Sep 13th, 2012
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. local tex =  Texture(32, 32, ETF_A8R8G8B8)
  2.  
  3. ffi.cdef("typedef struct { uint8_t r, g, b, a; } rgba_pixel;")
  4. local size = 32*32
  5. local img = ffi.new("rgba_pixel[?]", size)
  6. for i = 0, size-1 do
  7.     img[i].r = math.random(255)
  8.     img[i].g = math.random(255)
  9.     img[i].b = math.random(255)
  10.     img[i].a = math.random(255)
  11. end
  12.  
  13. tex:SetData(img)-- ????
  14.  
  15. local rect = Rect(0, 0, 32*8, 32*8)
  16.  
  17. hook.Add("PostDrawMenu", "draw_texture_noise", function()
  18.     graphics.Set2DFlags()
  19.     rect.x, rect.y = mouse.GetPos()
  20.     graphics.DrawTexture(tex, rect, nil, nil, true)
  21. end)
Advertisement
Add Comment
Please, Sign In to add comment