I have a small issue but it's driving me nuts lol. The names never seem to be centered over the player sprite. They're always a few pixels off.. and it doesn't look very nice to me. If anyone has managed to center the text exactly over the player sprite can you post your code please? :p
Misunderstood
Unregistered
to get the text size of a string you can use this.
Code:
Public Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" (ByVal hdc As Long, ByVal lpsz As String, ByVal cbString As Long, lpSize As textSize) As Long
Public Function getSize(ByVal DC As Long, ByVal Text As String) As textSize
Dim lngReturn As Long
Dim typSize As textSize
lngReturn = GetTextExtentPoint32(DC, Text, Len(Text), typSize)
getSize = typSize
End Function
Public Type textSize
width As Long
height As Long
End Type
User defined type not defined, highlightes:
Public Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" (ByVal hdc As Long, ByVal lpsz As String, ByVal cbString As Long, lpSize As Point) As Long
Misunderstood
Unregistered
whoops, change that to this
Code:
Public Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" (ByVal hdc As Long, ByVal lpsz As String, ByVal cbString As Long, lpSize As textSize) As Long
Misunderstood
Unregistered
in the blt name sub
the x should be the getplayerx(index) * pic_x + 16 - (getSize(texthdc,getplayername(index)).width/2)
There is a picbox function that will allow you to get the exact text width and height on any font
All you do is set the picbox to the font you want, then you call the gettextwidth (or something) function.
Dunno if its quicker then api
Misunderstood
Unregistered
well each letter is a different with, thats why this function is useful, it gets the exact width, ms uses 8*len, which is only an estimate.
Also I posted a reply to funky before but I don't see it here...maybe I posted it in the wrong place xD.
I think the picture box probably uses this API, so I doubt it would be faster.
Course I don't really know...