I've just spent 4 hours debugging this and after making it work i still
have no clue why i was facing this behaviour with this function. Here's
a description of the problem:
I made a new Hud element to display hints about my mod. Everything goes
along okay, the element displays and fades nicely after 5 seconds like i
want it to, now comes the part where i add the text in it!

And that's where the trouble starts. Basically, i have an Array of Wide
Chars to hold the Localized string that i find. My message Function
receives the number of the hint, converts this all to a nice token
string in ASCII like so: "#Cal_Hints_1" and then looks it up and fills
my array with the string!

So far so good, the array is filled, then i call Paint(). And every time
it would not show up! Here's the snippet from Paint():
   // Get our scheme and font information
   vgui::HScheme scheme = vgui::scheme()->GetScheme( "ClientScheme" );
   vgui::HFont hFont = vgui::scheme()->GetIScheme(scheme)->GetFont(
"Default" );

   // Draw our text
   surface()->DrawSetTextFont( hFont ); // set the font
   surface()->DrawSetTextColor( 255, 255, 255, flAlpha ); // white
   surface()->DrawSetTextPos( 0, 0 ); // x,y position

   int length = wcslen(m_pWText);
   surface()->DrawPrintText( m_pWText , length );

In debug when i have a spy on the array all looks fine, except the array
doesn't get printed.
This is what i have in Reset():
   memset(m_pWText,0,sizeof(m_pWText));

And if i comment that out, miraculously, the text gets displayed.

That is the only thing i changed, i moved it to the constructor and to
the message function and that's it, and now it all works fine!

Please someone tell me i'm not mad and DrawPrintText somehow calls Reset
without my knowledge...?


-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.6.13 - Release Date: 16/01/2005



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



Reply via email to