• Which way is better?
    3 replies, posted
I'm starting work on a game mode and I'm trying to decide if I want to have long hooks or multiple hooks or would it be the same either way. Mostly I'm thinking about drawing, should I hook for each HUD element i'm going to draw or should I just draw all elements in one hook? Thank you for any help.
[QUOTE=Fantym420;27309084]I'm starting work on a game mode and I'm trying to decide if I want to have long hooks or multiple hooks or would it be the same either way. Mostly I'm thinking about drawing, should I hook for each HUD element i'm going to draw or should I just draw all elements in one hook? Thank you for any help.[/QUOTE] Draw them all in one hook.
If you're worried about having ginormous hooks, you could have individual functions and then call them all in the same hook. i.e. [lua]function paintTheBox() draw.RoundedBox(0,0,0,100,100,color_white); end function paintTheText() draw.DrawText("Text","default",0,0,color_black,0); end hook.Add("HUDPaint","MyPainting",function() paintTheBox(); paintTheText(); end);[/lua]
[QUOTE=Entoros;27309188]If you're worried about having ginormous hooks, you could have individual functions and then call them all in the same hook. i.e. [lua]function paintTheBox() draw.RoundedBox(0,0,0,100,100,color_white); end function paintTheText() draw.DrawText("Text","default",0,0,color_black,0); end hook.Add("HUDPaint","MyPainting",function() paintTheBox(); paintTheText(); end);[/lua][/QUOTE] Ok, I like that idea. I'll Have one draw hook and use functions for each HUD. Thanks everybody.
Sorry, you need to Log In to post a reply to this thread.