

![]() |
![]() |
|
|||||||
![]() |
![]() |
| Code Snippets and Tutorials The place for open source releases, great information, and tutorials written by other members. |
![]() |
|
|
LinkBack | Thread Tools |
![]() |
![]() |
|
|
#1 (permalink) |
|
Banned
![]() Evangelist |
I found the function starcraft uses to get the width of a character in the current font:
0041F7B0h So I wrote two functions to get character widths and get string widths: Code:
GetCharacterWidth proc character:byte ;returns the width of the character in the current font
movzx ecx, character
mov eax, 0041F7B0h
call eax
Ret
GetCharacterWidth EndP
Code:
GetStringWidth proc text:DWORD ;returns the width of the string in the current font
xor edx, edx
xor ecx, ecx
mov ebx, text
add ebx, ecx
mov bl, byte ptr ds:[ebx]
.while bl != 0
mov eax, text
add eax, ecx
mov al, byte ptr ds:[eax]
.if al > 1Fh ;if you are using extended color characters you will need to add them to be filtered out
invoke GetCharacterWidth,al
add edx, eax
.endif
inc ecx
mov ebx, text
add ebx, ecx
mov bl, byte ptr ds:[ebx]
.endw
mov eax, edx
Ret
GetStringWidth EndP
![]() |
|
|
|
![]() |
![]() |
|
Advertisement
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Basic VB Stuff - String Manipulation, Variables, If Statments, For Statments. | LCSBSSRHXXX | Programming | 22 | 05-27-2008 06:57 AM |
| Useful VB6 Functions | bLueStar | Starcraft Hacking Related | 13 | 05-12-2008 01:40 PM |
| Aka, do your job. | Mystic Videl | Website Related | 8 | 09-07-2006 07:09 AM |
| I've got another problem now. | Dyndrilliac | Programming | 1 | 02-22-2006 02:18 PM |
| All times are GMT. The time now is 01:37 AM. |

