Commit ea09c236 authored by Valentin MEUNIER's avatar Valentin MEUNIER
Browse files

le

parent 52010a1b
File added
......@@ -180,7 +180,7 @@ void afficherImage(SDL_Renderer *renderer,SDL_Window *window,int **tab,int taill
void peindreMap(SDL_Texture * texture, SDL_Window* window ,SDL_Renderer *renderer, int noeuds, int taille_cell, int ** laby)
{
printf("peindre case %d %d %d \n",noeuds%P,noeuds/P,laby[noeuds%P][noeuds/P]);
//printf("peindre case %d %d %d \n",noeuds%P,noeuds/P,laby[noeuds%P][noeuds/P]);
affichage_texture(texture,window, renderer, laby[noeuds%P][noeuds/P], noeuds%P, noeuds/P, taille_cell);
}
......
......@@ -306,18 +306,29 @@ int main (int argc, char** argv)
}*/
//on initialise une fenêtre 2 pour une mini-map
SDL_Window *window2;
window2 = SDL_CreateWindow("SDL2 Programme 0.1", screen.w-screen.w/5, 0,screen.w/4,screen.h/4, SDL_WINDOW_RESIZABLE);
window2 = SDL_CreateWindow("SDL2 Programme 0.1", screen.w-screen.w/3, 0,screen.w/3,screen.h/4, SDL_WINDOW_RESIZABLE);
if (window2 == 0) fprintf(stderr, "Erreur d'initialisation de la SDL : %s\n", SDL_GetError());
SDL_SetWindowTitle(window2, "Carte d'exploration");
//on initialise le renderer de la mini-map
SDL_Renderer *renderer2;
renderer2 = SDL_CreateRenderer(window2, -1, SDL_RENDERER_ACCELERATED); /* SDL_RENDERER_SOFTWARE */
if (renderer2 == 0) fprintf(stderr, "Erreur d'initialisation de la SDL : %s\n", SDL_GetError());
//on initialise les textures pour la deuxième fenêtre
SDL_Texture *texture2,*texture_fin2;
texture2 = load_texture_from_image("road.png",renderer2);
if (texture2==NULL) exit(EXIT_FAILURE);
texture_fin2 = load_texture_from_image("roguelikeChar_transparent.png",renderer2);
if (texture_fin2==NULL) exit(EXIT_FAILURE);
int pause=1;
int noeud_dep=rand()%TAILLE;
int right=1;
......@@ -330,9 +341,9 @@ int main (int argc, char** argv)
int noeud_arrive=rand()%TAILLE;
int colli;
int noeud_actuel;
int taille_cell2=min((screen.w/4)/(P+2),(screen.h/4)/(N+2));
int taille_cell2=min((screen.w/3)/(P+2),(screen.h/3)/(N+2));
affichage_fin(texture_fin,window2,renderer2,noeud_arrive%P,noeud_arrive/P,taille_cell2);
affichage_fin(texture_fin2,window2,renderer2,noeud_arrive/P,noeud_arrive%P,taille_cell2);
printf("l : relancer \np,SPACE : pause \ncroix : quitter\n");
while ((running)||(temps<50))
......@@ -395,8 +406,7 @@ int main (int argc, char** argv)
}
const Uint8 *keystates = SDL_GetKeyboardState(NULL);
if (pause){
printf("%d\n",noeud_actuel);
peindreMap(texture,window2,renderer2,noeud_actuel,taille_cell,tab);
peindreMap(texture2,window2,renderer2,noeud_actuel,taille_cell2,tab);
SDL_RenderPresent(renderer2);
if ((keystates[SDL_SCANCODE_UP]||keystates[SDL_SCANCODE_W])) {
colli=collision_N(pos_x,pos_y,tab,taille_cell);
......
......@@ -12,6 +12,7 @@
#include "texture_perso.h"
#include "colision.h"
#include "DFS.h"
#include<SDL2/SDL_ttf.h>
void end_sdl(char ok,char const* msg,SDL_Window* window, SDL_Renderer* renderer);
void afficheEcranIntelligement(SDL_Renderer*,int**,int);
......
......@@ -2,12 +2,18 @@ CC= gcc
OPT = -c -Wextra -Wall -g
SDL2 = -lSDL2 -lSDL2_gfx -lSDL2_image -lSDL2_ttf -lSDL2_mixer -lSDL2_net -lm
prog : kruskal.o graph_aretes_tab.o partition.o tas.o main.o dijsktra.o DFS.o affichage_image.o
$(CC) kruskal.o graph_aretes_tab.o partition.o tas.o main.o dijsktra.o DFS.o affichage_image.o $(SDL2) -o prog
prog : kruskal.o graph_aretes_tab.o partition.o tas.o main.o affichage_image.o dijkstra.o texture_perso.o colision.o DFS.o
$(CC) kruskal.o graph_aretes_tab.o partition.o tas.o main.o affichage_image.o dijkstra.o texture_perso.o colision.o DFS.o $(SDL2) -o prog
main.o : main.c main.h
$(CC) $(OPT) main.c
dijkstra.o : dijkstra.c dijkstra.h
$(CC) $(OPT) dijkstra.c
affichage_image.o : affichage_image.c affichage_image.h
$(CC) $(OPT) affichage_image.c
graph_aretes_tab.o: graph_aretes_tab.c graph_aretes_tab.h
$(CC) $(OPT) graph_aretes_tab.c
......@@ -20,14 +26,14 @@ partition.o : partition.c partition.h
tas.o : tas.c tas.h
$(CC) $(OPT) tas.c
dijsktra.o : dijsktra.c dijsktra.h
$(CC) $(OPT) dijsktra.c
texture_perso.o : texture_perso.c texture_perso.h
$(CC) $(OPT) texture_perso.c
DFS.o : DFS.c DFS.h
$(CC) $(OPT) DFS.c
colision.o : colision.c colision.h
$(CC) $(OPT) colision.c
affichage_image.o : affichage_image.c affichage_image.h
$(CC) $(OPT) affichage_image.c
DFS.o : DFS.c DFS.h
$(CC) $(OPT) DFS.c
clear :
rm *.o
File added
This diff is collapsed.
#ifndef _gard_balek_
#define _gard_balek_
#include <SDL2/SDL.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <SDL2/SDL_image.h>
#include "affichage_image.h"
#include "kruskal.h"
void play_with_background(SDL_Texture *my_background, SDL_Window *window, SDL_Renderer *renderer,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
void play_with_elve_N(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,int deplacement,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
void play_with_elve_N_l(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,int deplacement,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
void play_with_elve_S(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,int deplacement,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
void play_with_elve_S_l(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,int deplacement,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
void play_with_elve_O(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,int deplacement,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
void play_with_elve_E(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,int deplacement,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
void play_standstill_1(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
void play_standstill_1_l(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
void play_standstill_2(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
void play_standstill_2_l(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
void play_standstill_3(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
void play_standstill_3_l(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
void play_standstill_4(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
void play_standstill_4_l(SDL_Texture* texture_elve,SDL_Texture* background,SDL_Window* window,SDL_Renderer* renderer,int pos_x,int pos_y,float zoom,int **tab, int taille_cell,SDL_Texture *texture_fin,int noeud_arrive);
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment