let's say I make a text adventure game and I wanna use a font for it... I find dozens of 'free' TTF fonts all over the web.

1.) do I include the font with the game and use some api call to temporarily use the font?

2.) do I need to worry about copyright infringements on fonts - should I only download from sites
with licenses?

thanks. Here is an extra credit question :)



KEYHIT MACRO KEYTST
invoke GetAsyncKeyState,KEYTST
ror eax,16
or ax,ax
.IF ax != 0
mov eax,KEYTST
.ENDIF
endm


Instead of having to call this KEYHIT macro every single time for each keypress, is it possible to get a key once and then test by some method such as rotating or shifting?

Something like:



invoke GetAsyncKeyState, magic_number ;pass it some number, unsure how this works
push eax
xor eax, VK_ENTER
.if eax==VK_ENTER
...
.endif
pop eax
push eax
xor eax,VK_ESCAPE
.if eax==VK_ESCAPE
...
.endif
pop eax
Posted on 2004-07-14 04:48:42 by drarem
1. Yes, you can do that, look at AddFontResourceEx & RemoveFontResourceEx and also AddFontMemResourceEx, RemoveFontMemResourceEx.

2. Fonts are generally copyright and require a liscense fee to use, you can google for Ray Larabie, he has a tremendous collection of freeware, freely distributable fonts of very high quality.
Posted on 2004-07-14 07:49:32 by donkey
For the extra credit, you would use GetKeyboardState to dump the state of every key to an 256 byte array then check the array location for any particular key.
Posted on 2004-07-14 08:05:07 by donkey
thanks, it works great. The half of knowledge is knowing where to find it.. looked it up and found older posts on a good way to check for the keyboard state using the test opcode.


.data
pbstate db 256 dup(0)



.code
invoke GetKeyboardState,ADDR pbstate

test byte ptr [pbstate + VK_LEFT], 80h
jz @F
sub px,1
mov pm,2
add pt,1
mov pb,64
@@:
test byte ptr [pbstate + VK_RIGHT], 80h
jz @F
add px,1
mov pm,1
add pt,1
mov pb,0
@@:



I know macros have trouble with jumping forwards outside of themselves.. is there a way so
I can simplify as below

TESTKEY VK_LEFT
sub px,1
add pt,1
mov pm,2
@@:
Posted on 2004-07-14 22:07:49 by drarem