Page 1 of 1

Measuring the length of Name String

Posted: Wed Sep 19, 2012 12:32 am
by Ghost_Fang
I'm planning on adding Kill Icons instead of the quake traditional "Player killed Player2 with WeaponX" I want it to look like "Player1 [ICON] Player2" I can see already that in order to do this I would need to get the length of the player's name string and then place the icon X amount of pixels after the name string. What would be the best method? I could set the number of space required for the icon between player1's name and player2's in QC. I would only need the length of the string to place it correctly on the HUD. And also CSQC is not an option for this one.

Thanks in advance

EDIT: Ok with a little (more) research i came up with:

Code: Select all

#include <cstring>
using std::strlen;

int n = strlen(playername);
Is that correct? And how would I translate that into pixels? would i just take strlen(sting)*pixel width, to get my output? Where in the quake engine is bprint handled or player names?