Hello,
in the spawn menu, there's a tab where you can select an overlay. I'm wondering which function is able to do this?
AFAIK, it's just drawing a material over the screen. You can accomplish the same results by using the surface library inside a HUDPaint hook.
For example:
[code]
local Overlay = Material( "effects/combine_binocoverlay" )
hook.Add( "HUDPaint", "MaterialOverlay", function()
surface.SetMaterial( Overlay )
surface.DrawTexturedRect( 0, 0, ScrW(), ScrH() )
end )
[/code]
You can also accomplish by using a console command which I cannot remember right now.
Thanks for the code, I will test it out.
[editline]26th December 2015[/editline]
The code is doing exactly what I wanted. Thank you!
However, it is drawn after all other HUD Elements. I tried using HUDPaintBackground, but then it is not drawing at all. Does anybody have an idea?
You can do this
[code]
local Overlay = Material( "effects/combine_binocoverlay" )
local function drawOverlay()
surface.SetMaterial( Overlay )
surface.DrawTexturedRect( 0, 0, ScrW(), ScrH() )
end
if(!hook.GetTable()["HUDPaint"]["MaterialOverlay"]) then
table.insert(hook.GetTable()["HUDPaint"],1,{MaterialOverlay = drawOverlay })
else
hook.GetTable()["HUDPaint"]["MaterialOverlay"] = drawOverlay
end
[/code]
this has been untested, but basically push that funciona into the hook table and runs drawOverlay
isn't it done in the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/RenderScreenspaceEffects]GM/RenderScreenspaceEffects[/url] hook?
[QUOTE]You can do this
local Overlay = Material( "effects/combine_binocoverlay" )
local function drawOverlay()
surface.SetMaterial( Overlay )
surface.DrawTexturedRect( 0, 0, ScrW(), ScrH() )
end
if(!hook.GetTable()["HUDPaint"]["MaterialOverlay"]) then
table.insert(hook.GetTable()["HUDPaint"],1,{MaterialOverlay = drawOverlay })
else
hook.GetTable()["HUDPaint"]["MaterialOverlay"] = drawOverlay
end
this has been untested, but basically push that funciona into the hook table and runs drawOverlay
[/QUOTE]
This is not working, without giving an error.
[QUOTE=Giraffen93;49395340]isn't it done in the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/RenderScreenspaceEffects]GM/RenderScreenspaceEffects[/url] hook?[/QUOTE]
I were going to suggest that, but then he looked happy about this :v
Anyway, i would recommend RCE since you can use screen space effects like blur or bumpmaps, thing that you cant paint in hudhook
[QUOTE=P4sca1;49395346]This is not working, without giving an error.[/QUOTE]
Restart your server, because this won't modify the herarchy created with in the table.insert, anyway, i'm not sure if table.insert index parameter, inserts inside non-number keys
[QUOTE=Giraffen93;49395340]isn't it done in the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/RenderScreenspaceEffects]GM/RenderScreenspaceEffects[/url] hook?[/QUOTE]
Yes it is, thank you!
[CODE]
local function swrp_draw_mask()
local mask = "effects/combine_binocoverlay"
DrawMaterialOverlay(mask, 0)
end
hook.Add("RenderScreenspaceEffects", "swrp_draw_mask", swrp_draw_mask)
[/CODE]
This code is doing what expected.
Sorry, you need to Log In to post a reply to this thread.