CapsAdmin

Untitled

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