• Keeping derma visible on the screen (like a hud)
    5 replies, posted
How would I go about it? I tried searching the wiki, with no luck I really only want to make it so the mouse cursor dissapears and you can move around ingame, with the derma frame still on screen. shit, this was meant to go in newbie questions >.> sorry
Using the HUDPaint hook function, you can make Derma Frames on the HUD, but be warned, I think they're rather laggy. [lua] function GM:HUDPaint() if( Frame ) then local Frame = vgui.Create( "DFrame" ) Frame:SetSize( 50, 50 ) Frame:Center() --position Frame:SetTitle( "Title here.." ) Frame:SetVisible( true ) end end --end the function [/lua]
Thankyou [editline]01:09AM[/editline] wow that is rather laggy.. Is there any other way, or is it just the draw functions?
Hm, you could do a check to see if the frame already exists.. [lua] function GM:HUDPaint() if( Frame ) then return end local Frame = vgui.Create( "DFrame" ) Frame:SetSize( 50, 50 ) Frame:Center() --position Frame:SetTitle( "Title here.." ) Frame:SetVisible( true ) end --end the function [/lua]
That's not going to work Horsey. You're creating "Frame" in the local scope of HUDPaint. Its going to be recreated over and over and over again. [editline]08:26AM[/editline] Create the vgui in the clientside Initialize.
ah I understand, its calling the vgui every frame.. no wonder it gets laggy. I have fixed it so it only gets called once, framerate is fine now. Thanks
Sorry, you need to Log In to post a reply to this thread.