I found some syntax errors in your text example (last code block). I also noticed when I tried to compile it with free pascal that it did compile as a much smaller file than yours (29k vs 134 or something) and it seemed to get stuck when It tried to do something with the true type font but when I used yours it seemed to work fine. I would like to convert the library I have released http://dexrow.blogspot.com/2007/10/w...-extended.html this is what I have come up with..
Code:
PROGRAM chap5;
USES SDL, SDL_TTF;
VAR
screen,fontface:pSDL_SURFACE;
loaded_font:pointer;
colour_font, colour_font2:pSDL_COLOR;
BEGIN
SDL_INIT(SDL_INIT_VIDEO);
screen:=SDL_SETVIDEOMODE(400,200,32,SDL_SWSURFACE);
IF screen=NIL THEN HALT;
if TTF_INIT=-1 THEN HALT;
loaded_font:=TTF_OPENFONT('C:\WINDOWS\fonts\Ariel.ttf',40);
NEW(colour_font);
NEW(colour_font2);
colour_font^.r:=255; colour_font^.g:=0; colour_font^.b:=0;
colour_font2^.r:=255; colour_font2^.g:=0; colour_font2^.b:=0;
fontface:=TTF_RENDERTEXT_SHADED(loaded_font,'HELLO WORLD!',colour_font^, colour_font2^);
SDL_BLITSURFACE(fontface,NIL,screen,NIL);
SDL_FLIP(screen);
readln;
DISPOSE(colour_font);
DISPOSE(colour_font2);
SDL_FREESURFACE(screen);
SDL_FREESURFACE(fontface);
TTF_CLOSEFONT(loaded_font);
TTF_QUIT;
SDL_QUIT;
END.
Bookmarks