Bon voila, j'ai un code qui se compile, qui s'execute mais qui ne fait pas ce que je veux. Je voudrais avoir un affichage de fond et rajouter par le biais d'instances des acteurs.

Le probleme c'est que quand je compile il n'y a que le fond qui s'affiche et je ne comprend absolument pas pourquoi.
Les fichiers sont au bons endroit, correctement appelés.
Pas d'erreur de compilation. Cela m'aiderai bien si vous pouviez jeter un oeil.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
 
 
#include <stdlib.h>
#include <stdio.h>
#include <SDL/SDL.h>
#include <cstdlib>
#include <iostream>
 
using namespace std;
 
/*======CLASSES======*/
 
class affichage  /*Affichage*/    
{
      private : 
              SDL_Surface *ecran;
              char img_bmp[50];
              SDL_Rect img_coord;
              int pos_x;
              int pos_y;
 
      public:
              affichage(char*);
              void perso_aff(char*, int, int);
              void refresh();
              void pause();
};
 
 
/*======DEFINITIONS AFFICHAGE======*/
 
affichage::affichage(char* img_bmp) /*Constructeur Surchargé Affichage*/
{
     SDL_Surface *ecran = NULL, *fond = NULL;
 
     SDL_Rect img_coord;
 
     img_coord.x = 0;
     img_coord.y = 0; 
 
     SDL_Init(SDL_INIT_VIDEO);
 
     ecran = SDL_SetVideoMode(1024, 768, 32, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN);
     SDL_WM_SetCaption("                                                                                                     ~~~~~BATTLE LEGEND~~~~~", NULL);
 
     fond = SDL_LoadBMP(img_bmp);
     SDL_BlitSurface(fond, NULL, ecran, &img_coord); 
 
     SDL_Flip(ecran);
}     
 
 
void affichage::pause() /*Fonction PAUSE*/   
{
 
    int continuer = 1;
    SDL_Event event;
 
    while (continuer)
{
    SDL_WaitEvent(&event);
    switch(event.type)
    {
        case SDL_QUIT:
            continuer = 0;
            break;
        case SDL_KEYDOWN:
            switch (event.key.keysym.sym)
            {
                case SDLK_ESCAPE:
                    continuer = 0;
                    break;
            }
            break;
    }
}
}
 
void affichage::refresh() /*Fonction Refresh*/
{
    SDL_Flip(ecran);
}
 
 
void affichage::perso_aff(char* img_bmp , int pos_x, int pos_y) /*Fonction Afficher Perso*/
{    
     SDL_Surface *perso_stock = NULL;
     SDL_Rect img_coord;
 
     img_coord.x = pos_x;
     img_coord.y = pos_y;
 
     perso_stock = SDL_LoadBMP(img_bmp);
     SDL_SetColorKey(perso_stock, SDL_SRCCOLORKEY, SDL_MapRGB(perso_stock->format, 255, 255, 255));
     SDL_BlitSurface(perso_stock, NULL, ecran, &img_coord); 
     SDL_Flip(ecran);
}
 
 
/*======MAIN======*/
 
int main(int argc, char *argv[])
{
    affichage instance1("Battlefond.bmp");
    instance1.perso_aff("warrior.bmp", 800, 400);
    instance1.refresh();
    instance1.pause();
 
 
     return 0;
}