Reviving an old thread of a month ago since I'm still not certain what
the implications are.

So exactly why is it better to avoid complex Paint() methods?  Methinks
that eventually down the line, the vgui::ISurface calls are still being
made, so it would make little difference that it is being called here.
Besides, there's gotta be some overhead involved in complicating the
hierarchy even more.

John Sheu

On Thu, 2006-03-30 at 11:00 -0800, Alfred Reynolds wrote:
> The third arg to ConvertANSIToUnicode() is the size of the output buffer
> in bytes. In this case you should use sizeof(unicode).
>
> This kind of code is the wrong pattern for VGUI2. It will perform really
> badly (because of the expensive operations you are running every time
> you paint) and makes your layout really fragile. A better model is to
> use a label to contain the text you want to draw and use an event to
> update text. The position, size and font the label uses should be
> contained in a .res file that is loaded by the base frame that owns the
> label ( it looks like CBBHudTaskList should be a frame in your case).
> If you cannot implement an event driven method then at least use the
> ::OnTick() method and only change the label text if the state changes.
> You can use the ::SetText() label call to set the string to render, and
> you don't need to do the unicode translation manually then.
>
> - Alfred


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to