If you only call surface()->DrawTexturedRect() and the like in your
Paint() function it won't defeat any VGUI2 functionality, but you will
make your code hard to maintain. I would decompose the UI into the basic
components, right a class to support each widget you need, put them
together using a panel and a .res file for layout and see how it runs.
If it is slow then use VPROF() to track down the problem and optimise as
needed by crunching down the class hierarchy.

- Alfred

John Sheu wrote:
> On Fri, 2006-04-14 at 12:25 -0700, Alfred Reynolds wrote:
>> It is a code maintainence, performance and reuse issue. If you roll
>> your own Paint() code you end up having to rewrite functionality in
>> each paint call and you tend to make your layout logic code rather
>> than data driven. Paint also gets called many times per second, it
>> is easy to blow away performance by making expensive calls on data
>> that rarely changes (like the ConvertANSIToUnicode() call below),
>> the VGUI2 framework is event driven and expensive calls only get
>> made when they need to be.
>
> "Premature optimization is the root of all evil"
> -- Donald Knuth (or Tony Hoare, depending on who you talk to)
>
> Right then.  In any case, my specific issue is with
> surface()->DrawTexturedRect() calls.  Gauges and icons seem to call
> this
> one a lot; is it a good idea to do this manually as part of Paint()?
> Or
> is there some behind-the-scenes VGUI caching functionality that would
> make this a bad idea?
>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list
> archives, please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders

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

Reply via email to