Un problème avec SDL langage C
Résolu
xtrashild
-
fiddy Messages postés 11069 Date d'inscription Statut Contributeur Dernière intervention -
fiddy Messages postés 11069 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
j'ai un problème quand je créer une fenêtre SDL avec la couleur (17, 206, 112) je met le code C suivant :
#include <stdlib.h>
#include <stdio.h>
#include <SDL/SDL.h>
int main(int argc, char *argv[])
{
SDL_Surface *ecran = NULL;
SDL_Init(SDL_INIT_VIDEO);
ecran = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE);
SDL_WM_SetCaption("Ma super fenêtre SDL !", NULL);
// Coloration de la surface ecran en bleu-vert
SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 17, 206, 112));
SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
pause();
SDL_Quit();
return EXIT_SUCCESS;
}
ça me met l'erreur
-------------- Build: Debug in testsdl ---------------
Compiling: main.cpp
C:\Users\xtrio\Desktop\C\testdl\testsdl\main.cpp: In function `int SDL_main(int, char**)':
C:\Users\xtrio\Desktop\C\testdl\testsdl\main.cpp:19: error: `pause' undeclared (first use this function)
C:\Users\xtrio\Desktop\C\testdl\testsdl\main.cpp:19: error: (Each undeclared identifier is reported only once for each function it appears in.)
Process terminated with status 1 (0 minutes, 0 seconds)
2 errors, 0 warnings
comment résoudre ce problème ? merci
j'ai un problème quand je créer une fenêtre SDL avec la couleur (17, 206, 112) je met le code C suivant :
#include <stdlib.h>
#include <stdio.h>
#include <SDL/SDL.h>
int main(int argc, char *argv[])
{
SDL_Surface *ecran = NULL;
SDL_Init(SDL_INIT_VIDEO);
ecran = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE);
SDL_WM_SetCaption("Ma super fenêtre SDL !", NULL);
// Coloration de la surface ecran en bleu-vert
SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 17, 206, 112));
SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
pause();
SDL_Quit();
return EXIT_SUCCESS;
}
ça me met l'erreur
-------------- Build: Debug in testsdl ---------------
Compiling: main.cpp
C:\Users\xtrio\Desktop\C\testdl\testsdl\main.cpp: In function `int SDL_main(int, char**)':
C:\Users\xtrio\Desktop\C\testdl\testsdl\main.cpp:19: error: `pause' undeclared (first use this function)
C:\Users\xtrio\Desktop\C\testdl\testsdl\main.cpp:19: error: (Each undeclared identifier is reported only once for each function it appears in.)
Process terminated with status 1 (0 minutes, 0 seconds)
2 errors, 0 warnings
comment résoudre ce problème ? merci
A voir également:
- Un problème avec SDL langage C
- Langage ascii - Guide
- Langage binaire - Guide
- Pascal langage - Télécharger - Édition & Programmation
- Langage visual basic - Télécharger - Langages
- Langage basic gratuit - Télécharger - Édition & Programmation
3 réponses
j'ai trouvé la solution :
#include <stdlib.h>
#include <stdio.h>
#include <SDL/SDL.h>
void pause();
int main(int argc, char *argv[])
{
SDL_Surface *ecran = NULL;
SDL_Init(SDL_INIT_VIDEO);
ecran = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE);
SDL_WM_SetCaption("xtrashild", NULL);
SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 4, 139, 154));
SDL_Flip(ecran);
pause();
SDL_Quit();
return EXIT_SUCCESS;
}
void pause()
{
int continuer = 1;
SDL_Event event;
while (continuer)
{
SDL_WaitEvent(&event);
switch(event.type)
{
case SDL_QUIT:
continuer = 0;
}
}
}
#include <stdlib.h>
#include <stdio.h>
#include <SDL/SDL.h>
void pause();
int main(int argc, char *argv[])
{
SDL_Surface *ecran = NULL;
SDL_Init(SDL_INIT_VIDEO);
ecran = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE);
SDL_WM_SetCaption("xtrashild", NULL);
SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 4, 139, 154));
SDL_Flip(ecran);
pause();
SDL_Quit();
return EXIT_SUCCESS;
}
void pause()
{
int continuer = 1;
SDL_Event event;
while (continuer)
{
SDL_WaitEvent(&event);
switch(event.type)
{
case SDL_QUIT:
continuer = 0;
}
}
}
fiddy
Messages postés
11069
Date d'inscription
Statut
Contributeur
Dernière intervention
1 846
En fait, t'avais mal copier collé le code donné sur lesiteduzero ^^.