[Sdl] strange problem with SDL_ttf

Hello,

I have ported freetype2 and SDL_ttf to QNX 6.3.2. The original demo “lat / latin1.c” is working.
Now I have modified the latin1.c example in order to render text strings.

It has been successfully compiled exactly in the same manner as the original latin1.c example, but it write just an unordered set of red pixels into the window.
Here is the code of my example … what’s wrong with it ???

#include <stdlib.h>
#include <string.h>
#include “SDL.h”
#include “SDL_ttf.h”

SDL_Event event;
SDL_Surface *screen=NULL, *text;

TTF_Font *font=NULL;

void draw(void)
{
SDL_Rect r;
SDL_Color color= {255,0,0};

text = TTF_RenderText_Solid(font, "1234567890ABCDEFG", color);
r.x=200;
r.y=200;
r.w=text->w;
r.h=text->h;

SDL_BlitSurface(text,0,screen,&r);

}

void free_surf()
{
if(text)
SDL_FreeSurface(text);
text=NULL;
}

void free_font()
{
if(font)
TTF_CloseFont(font);
font=NULL;

}

void load_font(char *fname, int size)
{

free_font();
font=TTF_OpenFont(fname, size);
if(!font)
{
	printf("TTF_OpenFont: %s\n", TTF_GetError());
	exit(3);
}

}

int main(int argc, char **argv)
{

/* start SDL video */
if(SDL_Init(SDL_INIT_VIDEO)==-1)
{	
	printf("SDL_Init: %s\n",SDL_GetError());
	return 1;
}

/* open the screen */
if(!(screen=SDL_SetVideoMode(800,600,0,0)))
{
	printf("SDL_SetVideoMode: %s\n",SDL_GetError());
	return 1;
}

/* start SDL_ttf */
if(TTF_Init()==-1)
{
	printf("TTF_Init: %s\n", TTF_GetError());
	return 2;
}

load_font("FreeSans.ttf", 64);

SDL_FillRect(screen,0,~0);
draw();
printf("Error 1 ?: %s\n", TTF_GetError());
SDL_Flip(screen);
printf("Error 2 ?: %s\n", TTF_GetError());

getchar();

free_font();
free_surf();
TTF_Quit();
SDL_Quit();

return 0;

}_______________________________________________________________________
Sensationsangebot verl?ngert: WEB.DE FreeDSL - Telefonanschluss + DSL
f?r nur 16,37 Euro/mtl.!* http://dsl.web.de/?ac=OM.AD.AD008K13805B7069a