Skip to content
Snippets Groups Projects
Commit 02097b6b authored by Montjoie Henri's avatar Montjoie Henri
Browse files

tentative de getion des terrains et des classes

parent 5140ed93
No related branches found
No related tags found
No related merge requests found
Pipeline #
resources/case_brillante.bmp

15.2 KiB

resources/normal2_brillant.bmp

15.2 KiB

......@@ -21,8 +21,15 @@ int main_SDL()
int i,j;
SDL_Surface* ecran=NULL;
SDL_Event event;
SDL_Surface* perso[NB_PERSO]={NULL};
SDL_Surface* Case=NULL;
SDL_Surface* guerrier=NULL;
SDL_Surface* mage=NULL;
SDL_Surface* voleur=NULL;
SDL_Surface* archer=NULL;
SDL_Surface* guerisseur=NULL;
SDL_Surface* plaine=NULL;
SDL_Surface* eau=NULL;
SDL_Surface* montagne=NULL;
SDL_Surface* foret=NULL;
SDL_Surface* Case_brillante=NULL;
SDL_Rect Position_Case[LARGEUR_CARTE*HAUTEUR_CARTE];
SDL_Rect Position_Perso[NB_PERSO];
......@@ -46,28 +53,86 @@ int main_SDL()
SDL_WM_SetCaption("Elder Internal Ignition",NULL);
perso[0] = SDL_LoadBMP("../resources/personnage.bmp");
if (!perso[0])
guerrier = SDL_LoadBMP("../resources/guerrier.bmp");
if (!guerrier)
{
printf("Unable to load bitmap: %s\n", SDL_GetError());
return 1;
}
SDL_SetColorKey(guerrier, SDL_SRCCOLORKEY, SDL_MapRGB(guerrier->format, 0, 0, 255));
mage = SDL_LoadBMP("../resources/mage.bmp");
if (!mage)
{
printf("Unable to load bitmap: %s\n", SDL_GetError());
return 1;
}
SDL_SetColorKey(mage, SDL_SRCCOLORKEY, SDL_MapRGB(mage->format, 0, 0, 255));
voleur = SDL_LoadBMP("../resources/voleur.bmp");
if (!voleur)
{
printf("Unable to load bitmap: %s\n", SDL_GetError());
return 1;
}
SDL_SetColorKey(voleur, SDL_SRCCOLORKEY, SDL_MapRGB(voleur->format, 0, 0, 255));
archer = SDL_LoadBMP("../resources/archer.bmp");
if (!archer)
{
printf("Unable to load bitmap: %s\n", SDL_GetError());
return 1;
}
SDL_SetColorKey(archer, SDL_SRCCOLORKEY, SDL_MapRGB(archer->format, 0, 0, 255));
guerisseur = SDL_LoadBMP("../resources/guerisseur.bmp");
if (!guerisseur)
{
printf("Unable to load bitmap: %s\n", SDL_GetError());
return 1;
}
SDL_SetColorKey(guerisseur, SDL_SRCCOLORKEY, SDL_MapRGB(guerisseur->format, 0, 0, 255));
plaine = SDL_LoadBMP("../resources/plaine.bmp");
if (!plaine)
{
printf("Unable to load bitmap: %s\n", SDL_GetError());
return 1;
}
SDL_SetColorKey(perso[0], SDL_SRCCOLORKEY, SDL_MapRGB(perso[0]->format, 0, 0, 255));
Case = SDL_LoadBMP("../resources/normal2.bmp");
if (!Case)
SDL_SetColorKey(plaine, SDL_SRCCOLORKEY, SDL_MapRGB(plaine->format, 0, 0, 255));
eau = SDL_LoadBMP("../resources/eau.bmp");
if (!eau)
{
printf("Unable to load bitmap: %s\n", SDL_GetError());
return 1;
}
SDL_SetColorKey(Case, SDL_SRCCOLORKEY, SDL_MapRGB(Case->format, 0, 0, 255));
SDL_SetColorKey(eau, SDL_SRCCOLORKEY, SDL_MapRGB(eau->format, 0, 0, 255));
Case_brillante = SDL_LoadBMP("../resources/normal2_brillant.bmp");
montagne = SDL_LoadBMP("../resources/montagne.bmp");
if (!montagne)
{
printf("Unable to load bitmap: %s\n", SDL_GetError());
return 1;
}
SDL_SetColorKey(montagne, SDL_SRCCOLORKEY, SDL_MapRGB(montagne->format, 0, 0, 255));
foret = SDL_LoadBMP("../resources/foret.bmp");
if (!foret)
{
printf("Unable to load bitmap: %s\n", SDL_GetError());
return 1;
}
SDL_SetColorKey(foret, SDL_SRCCOLORKEY, SDL_MapRGB(foret->format, 0, 0, 255));
Case_brillante = SDL_LoadBMP("../resources/case_brillante.bmp");
if (!Case_brillante)
{
printf("Unable to load bitmap: %s\n", SDL_GetError());
return 1;
}
SDL_SetColorKey(Case_brillante, SDL_SRCCOLORKEY, SDL_MapRGB(Case->format, 0, 0, 255));
SDL_SetColorKey(Case_brillante, SDL_SRCCOLORKEY, SDL_MapRGB(Case_brillante->format, 0, 0, 255));
for(i=0;i<LARGEUR_CARTE;i+=2)
{
......@@ -123,16 +188,19 @@ int main_SDL()
SDL_FillRect(ecran,NULL,SDL_MapRGB(ecran->format,0,0,0));
for(i=0;i<LARGEUR_CARTE*HAUTEUR_CARTE;i++)
{
SDL_BlitSurface(Case,NULL,ecran,&Position_Case[i]);
SDL_BlitSurface(type_case(i),NULL,ecran,&Position_Case[i]);
}
SDL_BlitSurface(Case_brillante,NULL,ecran,&Position_Case_brillante);
SDL_BlitSurface(perso[0],NULL,ecran,&Position_Perso[0]);
for(i=0;i<NB_PERSO;i++)
{
SDL_BlitSurface(type_perso(i),NULL,ecran,&Position_Perso[i]);
}
SDL_Flip(ecran);
}
quitter=0;
SDL_FreeSurface(Case);
SDL_FreeSurface(guerrier);
SDL_FreeSurface(Case_brillante);
SDL_FreeSurface(perso[0]);
SDL_FreeSurface(plaine);
SDL_Quit();
return 0;
}
......
......@@ -11,7 +11,7 @@
#define HAUTEUR_CARTE 10
#define LARGEUR_CASE 53
#define HAUTEUR_CASE 71
#define NB_PERSO 1
#define NB_PERSO 3
int main_SDL();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment