Ok voici mon code(j'utilise la sdl)
1 . #include <stdlib.h>
2 . #include <stdio.h>
3 . #include <SDL/SDL.h>
4 . #include <SDL/SDL_ttf.h>
5 .
6 . int main(int argc, char *argv[])
7 . {
8 . SDL_Surface *ecran = NULL, *texte = NULL, *fond = NULL;
9 . SDL_Rect position;
10 . SDL_Event event;
11 . TTF_Font *police = NULL;
12 . SDL_Color couleurNoire = {0, 0, 0};
13 . int continuer = 1;
14 .
15 .
16 . SDL_Init(SDL_INIT_VIDEO);
17 . TTF_Init();
18 .
19 . ecran = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
20 . SDL_WM_SetCaption("Gestion du texte avec SDL_ttf", NULL);
21 .
22 . fond = IMG_Load("back");
23 .
24 . /* Chargement de la police */
25 . police = TTF_OpenFont("angelina.ttf", 65);
26 . /* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
27 . texte = TTF_RenderText_Blended(police, "Salut", couleurNoire);
28 .
29 . while (continuer)
30 . {
31 . SDL_WaitEvent(&event);
32 . switch(event.type)
33 . {
34 . case SDL_QUIT:
35 . continuer = 0;
36 . break;
37 . }
38 .
39 . SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255));
40 .
41 . position.x = 0;
42 . position.y = 0;
43 . SDL_BlitSurface(fond, NULL, ecran, &position); /* Blit du fond */
44 .
45 . position.x = 60;
46 . position.y = 370;
47 . SDL_BlitSurface(texte, NULL, ecran, &position); /* Blit du texte par-dessus */
48 . SDL_Flip(ecran);
49 . }
50 .
51 . TTF_CloseFont(police);
52 . TTF_Quit();
53 .
54 . SDL_FreeSurface(texte);
55 . SDL_Quit();
56 .
57 .
58 . return EXIT_SUCCESS;
59 . }
les erreurs sont les suivantes :
line 22 warnign : assignement makes pointer form integer without a cast
line 59 warnign : no newline at end of file
j'ai seulement un fichier : main.c