First of all, thank you Garry for helping me. Anyway, I still have problem to do what I want. My goal is to be able to specify a size for the crosshair. Currently I'm proceeding like this:
CHudTexture *tex = new CHudTexture(); if ( !tex ) return; // Key Name is the sprite name Q_strncpy( tex->szShortName, "crosshair", sizeof( tex->szShortName ) ); tex->bRenderUsingFont = true; tex->cCharacterInFont = crosshair_font_char.GetString()[0]; // Garry Newman code in here tex->hFont = vgui::surface()->CreateFont(); vgui::surface()->SetFontGlyphSet( tex->hFont, "crosshairs", pg_test.GetInt(), 0, 0, 0, 0x200 ); // where crosshairs is refering to crosshairs.ttf // End of GN code // Q_strncpy( tex->szTextureFile, "client_scheme_crosshairs", sizeof( tex->szTextureFile ) ); // Previously I was using this, but I don't want to refer to ClientScheme any more. pWeaponInfo->iconCrosshair = gHUD.AddUnsearchableHudIconToList( *tex ); pWeaponInfo->iconZoomedCrosshair = gHUD.AddUnsearchableHudIconToList( *tex ); --> it is resulting in nothing displayed. I think I have to deal with szTextureFile but I don't know what to do exactly. J. 2009/12/9 Garry Newman <[email protected]> > Here's what I do in GMod: > > HFont font = vgui::surface()->CreateFont(); > Assert(font); > if ( !vgui::surface()->SetFontGlyphSet( font, strName, iTall, iWeight, 0, > 0, > iFlags ) > { > // Error reporting etc > } > > garry > > On Wed, Dec 9, 2009 at 11:21 AM, Janek <[email protected]> wrote: > > > In fact I would like to understand how to recreate it. Is it possible to > > fill in a structure including all parameters (keyvalues) describing a > font > > in clientscheme.res and passing it using SetFont ? > > > > J. > > > > 2009/12/9 Garry Newman <[email protected]> > > > > > AFAIK you need to destroy and recreate it. It isn't just rendering > text, > > > it's drawing all the characters to a texture and then copying them over > > > (educated guess). > > > > > > garry > > > > > > On Wed, Dec 9, 2009 at 9:01 AM, Janek <[email protected]> wrote: > > > > > > > No idea ? This tall parameter should be somewhere. > > > > > > > > J. > > > > > > > > 2009/12/7 Janek <[email protected]> > > > > > > > > > Hi all, > > > > > > > > > > In ClientScheme.res we can specify a font codename and specify its > > > > features > > > > > for a specific resolution by using keyvalues for "name", "tall", > > > > "weight"... > > > > > In our codeline we're refering to this font using SetFont function. > > All > > > > > features specified in ClientScheme.res are used for it. > > > > > > > > > > I would like to know how to modify "tall" keyvalues on the fly > (doing > > > > that > > > > > using few lines of code) but I don't understand how. hfont is only > a > > > > unique > > > > > ID for the font ;-( > > > > > > > > > > I hope you'll be able to help me :-) > > > > > > > > > > Cheers, > > > > > > > > > > ------------------- > > > > > j...@nek > > > > > > > > > > > > > > > > > > > > > -- > > > > ------------------- > > > > j...@nek > > > > _______________________________________________ > > > > 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 > > > > > > > > > > > > -- > > ------------------- > > j...@nek > > _______________________________________________ > > 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 > > -- ------------------- j...@nek _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

