Tile an image?

Hey facepunch, how do I tile an image in lua? Using a large image and scaling it down to fit a derma looks bad.

Image used:

surface.DrawTexturedRectUV


surface.DrawTexturedRectUV( x, y, w, h, 0, 0, w / actual_w, h / actual_h )

Would tile ( or clip ) a material to fit in the box of x, y, w, h even if actual_w or actual_h are not w, h.

Hmm, strange result. The code is as this:

Code Snippet



local function mymotd()
local MOTDFrame = vgui.Create( "DFrame" )
MOTDFrame:SetTitle( "" )
MOTDFrame:SetSize( ScrW(), ScrH() )
MOTDFrame:ShowCloseButton( true )
MOTDFrame:MakePopup()
function MOTDFrame:Paint(w,h)
	surface.SetDrawColor( 255, 255, 255, 255 )
	surface.SetMaterial( mbg )
	surface.DrawTexturedRectUV( 0, 0, w, h, 0, 0, w / 16, h / 9 )
	surface.SetMaterial( logo )
	surface.DrawTexturedRect( w/2.5, 50, 376, 57 )
end


And an Image.

Yes the materials are already defined further up the code.
**
Large image,** this is what it “Should” look like when tiled out correctly. I have the image set for my Terminal background as so.

For sake of loading im not embedding the image!

24 hour bump.

Still no luck.

How is mbg declared?

Up near the top of my code outside of any functions or statements. I just have a block of defined variables.



local mbg = Material("arcade/motd/bg.png")



Material( "arcade/motd/bg.png", "smooth" )

Might help

No change… im really at a loss here.

Could I somehow use a html frame as my background and have the html file be located on the clients computer instead of the Internet? (User would DL the .html) That might also allow me to achieve an animated background.

[lua]Material( “arcade/motd/bg.png”, “noclamp” )[/lua]

I’ve never tried this parameter myself, but it looks like it would fix your issue, give it a try.

Edited:

Never mind, didn’t read post properly.

Already tried that one with no luck :frowning:

Done, solved. Decided F lua and used HTML XD

The image in html if anyone wants it.

http://a.pomf.se/xfvoxf.html