Problème de disparition de la fenêtre (SDL)
foo
-
mmetalect Messages postés 5 Date d'inscription Statut Membre Dernière intervention -
mmetalect Messages postés 5 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
La fenêtre apparaît et disparaît très vite même avec la boucle while!!
voici le code:
#include <stdlib.h>
#include <stdio.h>
#include <SDL/SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
int main(int argc, char *argv[])
{
SDL_Surface *ecran = NULL, *texte = NULL, *grille = NULL;
SDL_Rect position;
SDL_Event event;
TTF_Font *police = NULL;
SDL_Color couleurNoire = {0, 0, 0};
int continuer = 1;
SDL_Init(SDL_INIT_VIDEO);
TTF_Init();
ecran = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
SDL_WM_SetCaption("Gestion du texte avec SDL_ttf", NULL);
grille = IMG_Load("grille.png");
police = TTF_OpenFont("angelina.ttf", 65);
texte = TTF_RenderText_Blended(police, "Salut !", couleurNoire);
while (continuer)
{
SDL_WaitEvent(&event);
switch(event.type)
{
case SDL_QUIT:
continuer = 0;
break;
}
SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255));
position.x = 0;
position.y = 0;
SDL_BlitSurface(grille, NULL, ecran, &position);
position.x = 60;
position.y = 370;
SDL_BlitSurface(texte, NULL, ecran, &position);
SDL_Flip(ecran);
}
TTF_CloseFont(police);
TTF_Quit();
SDL_FreeSurface(texte);
SDL_Quit();
return EXIT_SUCCESS;
}
et merci d'avance
La fenêtre apparaît et disparaît très vite même avec la boucle while!!
voici le code:
#include <stdlib.h>
#include <stdio.h>
#include <SDL/SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
int main(int argc, char *argv[])
{
SDL_Surface *ecran = NULL, *texte = NULL, *grille = NULL;
SDL_Rect position;
SDL_Event event;
TTF_Font *police = NULL;
SDL_Color couleurNoire = {0, 0, 0};
int continuer = 1;
SDL_Init(SDL_INIT_VIDEO);
TTF_Init();
ecran = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
SDL_WM_SetCaption("Gestion du texte avec SDL_ttf", NULL);
grille = IMG_Load("grille.png");
police = TTF_OpenFont("angelina.ttf", 65);
texte = TTF_RenderText_Blended(police, "Salut !", couleurNoire);
while (continuer)
{
SDL_WaitEvent(&event);
switch(event.type)
{
case SDL_QUIT:
continuer = 0;
break;
}
SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255));
position.x = 0;
position.y = 0;
SDL_BlitSurface(grille, NULL, ecran, &position);
position.x = 60;
position.y = 370;
SDL_BlitSurface(texte, NULL, ecran, &position);
SDL_Flip(ecran);
}
TTF_CloseFont(police);
TTF_Quit();
SDL_FreeSurface(texte);
SDL_Quit();
return EXIT_SUCCESS;
}
et merci d'avance
A voir également:
- Laure possède un espace google drive personnel. la fenêtre présente son dossier google drive local. que peut-on affirmer sur la situation ?
- Google maps satellite - Guide
- À quoi sert google drive sur android - Guide
- Dns google - Guide
- Google drive - Accueil - Arnaque
- Google maps - Guide