Skip to content
Open

4 #1

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added 1/dot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
Binary file added AbrilFatface-Regular.ttf
Binary file not shown.
603 changes: 0 additions & 603 deletions fonction.c

This file was deleted.

104 changes: 0 additions & 104 deletions fonction.h

This file was deleted.

Binary file added images/back_button.png
Binary file added images/bg/1.png
Binary file added images/bg/2.png
Binary file added images/bg/3.png
Binary file added images/masque_stage1.bmp
Binary file not shown.
Binary file added images/mini/1.png
Binary file added images/mini/2.png
Binary file added images/mini/3.png
135 changes: 135 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include "minimap.h"
#include <string.h>

int main(int argc,char *argv[])


{
TTF_Init();
SDL_Init (SDL_INIT_VIDEO);
SDL_Event event ;
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY , SDL_DEFAULT_REPEAT_INTERVAL );
int done = 0 , direction =0 ,i=0;


int startime=-1 ,time=0 , timeL = 169000 , j;
image mask ,bg[3];
minimap M;
perso C;
SDL_Surface *screen;
Text T;
screen = SDL_SetVideoMode (SCREEN_W , SCREEN_H,32 , SDL_HWSURFACE |SDL_SRCALPHA|SDL_DOUBLEBUF);

initText(&T,1180,20,125,0,0,50);
initMinimap (&M);
initback (&mask);
initAnime ( bg, "images/bg/",".png" , 3 , 0, 0,0,0, 5768,1080);
initC(&C.I);
while (done!=1)
{

playAnime2 ( bg , screen , 3 , &i);
playAnime2 ( M.b , screen , 3 , &i);
affichage (C.I,screen);
pos (&M.dot , C.I.pos1.x-M.b[1].pos2.x*5 , C.I.pos1.y-M.b[1].pos2.y*5);
affichage (M.dot , screen);
afficheT((timeL-time)*0.001 , T , screen);
SDL_Flip (screen);
while (SDL_PollEvent (&event))
{
switch (event.type)
{
case SDL_QUIT :
done = 1 ;
break;
case SDL_KEYUP:
direction=0;
break;
case SDL_KEYDOWN:
if (event.key.keysym.sym == SDLK_RIGHT )
{
direction = 1;
}
else if (event.key.keysym.sym == SDLK_LEFT )
{
direction = 2;
}
else if (event.key.keysym.sym == SDLK_UP )
{
direction = 3;
}
else if (event.key.keysym.sym == SDLK_DOWN )
{
direction = 4;
}
else if (event.key.keysym.sym == SDLK_ESCAPE )
{
done =1;
}

break ;

}

}

if (startime==-1)
startime = SDL_GetTicks();

time = SDL_GetTicks() - startime;

if (time==-1)
printf("\n%s",SDL_GetError());

if (i<=3-2)
i++;
else
i=0;
affichage ( mask , screen);

collision (&C,mask,&done);

if ( ( direction == 1 )&&(C.T[3].c==0) &&(C.I.pos1.x<5738) )
{
C.I.pos1.x = C.I.pos1.x + 10 ;
}
if ( ( direction == 2 )&&(C.T[7].c==0)&&(C.I.pos1.x>10) )
{
C.I.pos1.x = C.I.pos1.x - 10;
}
if ( ( direction == 3 )&&(C.T[1].c==0) )
{
C.I.pos1.y = C.I.pos1.y - 10 ;
}
if ( ( direction == 4 )&&( C.T[5].c==0 ) )
{
C.I.pos1.y = C.I.pos1.y + 10 ;
}
for ( j=0;j<3;j++)
scrollingMINI ( &M.b[j], direction );
if (time - timeL>0)
{
done=1;
}




}

freeAnime(M.b , 3 ) ;
freeAnime( bg , 3 ) ;
TTF_CloseFont(T.font);
//liberer (M.b);
liberer (mask);
liberer (C.I);
liberer (M.dot);
freeText( T);
SDL_Quit();
TTF_Quit();
return 0;
}
Binary file added main.o
Binary file not shown.
9 changes: 9 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
prog : main.o minimap.o
gcc main.o minimap.o -o prog -lSDL -lSDL_image -lSDL_ttf

main.o : main.c
gcc -c main.c

minimap.o : minimap.c
gcc -c minimap.c

Loading