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
|
SDL_Event event;
SDL_PollEvent(&event);
if (this->field.all != NULL)
{
aff_map(this);
switch(event.type)
{
case SDL_QUIT:
printf("%d\n", SDL_QUIT);
//this->end = 1;
break;
case SDL_MOUSEMOTION:
printf("jv\n");
aff_food(this, (int)event.motion.x, (int)event.motion.y);
break;
case SDL_KEYDOWN:
printf("jv\n", SDL_QUIT);
this->time_key++;
if (this->time_key >= 10)
{
this->time_key = 0;
switch (event.key.keysym.sym)
{
case SDLK_UP:
this->y_cam -= IMG;
break;
case SDLK_DOWN:
this->y_cam += IMG;
break;
case SDLK_RIGHT:
this->x_cam += IMG;
break;
case SDLK_LEFT:
this->x_cam -= IMG;
break;
}
}
} |
Partager