-
Notifications
You must be signed in to change notification settings - Fork 6
/
mouvment.c
52 lines (48 loc) · 1.19 KB
/
mouvment.c
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
#include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_ttf.h>
#include"struct.h"
int mouvment(hero leon,SDL_Event *event){
int mouvment;
SDL_PollEvent(event);
switch (event->type)
{
case SDL_QUIT:
mouvment=0;
break;
case SDL_MOUSEBUTTONUP:
mouvment=1;
break;
case SDL_KEYDOWN:
switch (event->key.keysym.sym)
{
case SDLK_ESCAPE:
mouvment=100;
break;
case SDLK_RIGHT:
mouvment=1;
//scrolling (hero *evan,background *bckg);
break;
case SDLK_LEFT:
mouvment=2;
//scrolling (hero *evan,background *bckg);
break;
case SDLK_UP:
mouvment=3;
break;
case SDLK_m:
mouvment=7;
break;
case SDLK_SPACE:
mouvment=5;
break;
}
break;
default: mouvment=9;
}
//printf("%d c",mouvment);
return mouvment;
}