Probleme SDL
dwyane346
Messages postés
156
Statut
Membre
-
dwyane346 Messages postés 156 Statut Membre -
dwyane346 Messages postés 156 Statut Membre -
Bonjour,
j ai configurer visual studio 2008 grace a ce tuto http://lazyfoo.net/SDL_tutorials/lesson01/windows/msvsnet0508e/index.php
le probleme est que mon programme compile normalement mais quand je charge une image elle n aparait jamais . il n y a juste qu une fenetre noir merci pour vos reponse .
ps voici mon main dailleur il n ya que sa dans mon programme
//Include SDL functions and datatypes
#include "SDL.h"
int main( int argc, char* args[] )
{
//The images
SDL_Surface* hello = NULL;
SDL_Surface* screen = NULL;
//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );
//Set up screen
screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );
//Load image
hello = SDL_LoadBMP( "hello.bmp" );
//Apply image to screen
SDL_BlitSurface( hello, NULL, screen, NULL );
//Update Screen
SDL_Flip( screen );
//Pause
SDL_Delay( 2000 );
//Free the loaded image
SDL_FreeSurface( hello );
//Quit SDL
SDL_Quit();
return 0;
}
j ai configurer visual studio 2008 grace a ce tuto http://lazyfoo.net/SDL_tutorials/lesson01/windows/msvsnet0508e/index.php
le probleme est que mon programme compile normalement mais quand je charge une image elle n aparait jamais . il n y a juste qu une fenetre noir merci pour vos reponse .
ps voici mon main dailleur il n ya que sa dans mon programme
//Include SDL functions and datatypes
#include "SDL.h"
int main( int argc, char* args[] )
{
//The images
SDL_Surface* hello = NULL;
SDL_Surface* screen = NULL;
//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );
//Set up screen
screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );
//Load image
hello = SDL_LoadBMP( "hello.bmp" );
//Apply image to screen
SDL_BlitSurface( hello, NULL, screen, NULL );
//Update Screen
SDL_Flip( screen );
//Pause
SDL_Delay( 2000 );
//Free the loaded image
SDL_FreeSurface( hello );
//Quit SDL
SDL_Quit();
return 0;
}
A voir également:
- Probleme SDL
- Sdl no available video device ✓ - Forum C
3 réponses
Il faut positionner ta surface qui contient l'image, je me souvein pas, mais je croi que c ,
SDL_Rect pos_hello;
pos_hello.x = 500;
pos_hello.y = 200;
Oué c du genre... :D
SDL_Rect pos_hello;
pos_hello.x = 500;
pos_hello.y = 200;
Oué c du genre... :D
tu doit mettre la SDL_Rect avec,
SDL_BlitSurface(hello, NULL, screen, &pos_hello);
Comme ceci. :D