-
Notifications
You must be signed in to change notification settings - Fork 3
/
intro.c
34 lines (32 loc) · 1.03 KB
/
intro.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
#include "pacman.h"
void intro(t_pacman *pacman, int *introOff)
{
int i;
i = 0;
SDL_Rect rect;
rect = (SDL_Rect) {0, 300, 30, 30};
while(i < 7)
{
putTextMessage(pacman, "PACMAN");
rect.x += 30;
SDL_RenderCopy(pacman->sdl.renderer, pacman->ghostYellowTexture, NULL, &(rect));
rect.x += 30;
SDL_RenderCopy(pacman->sdl.renderer, pacman->ghostPinkTexture, NULL, &(rect));
rect.x += 30;
SDL_RenderCopy(pacman->sdl.renderer, pacman->ghostBlueTexture, NULL, &(rect));
rect.x += 30;
SDL_RenderCopy(pacman->sdl.renderer, pacman->ghostRedTexture , NULL, &(rect));
rect.x += 60;
pacman->pacTexture = SDL_CreateTextureFromSurface(pacman->sdl.renderer, pacman->pacImageRight);
if (i % 2)
pacman->pacTexture = SDL_CreateTextureFromSurface(pacman->sdl.renderer, pacman->pacImage);
SDL_RenderCopy(pacman->sdl.renderer, pacman->pacTexture, NULL, &(rect));
SDL_RenderPresent(pacman->sdl.renderer);
rect.x -= 120;
sdlRenderClear(pacman);
SDL_Delay(250);
i++;
}
SDL_RenderPresent(pacman->sdl.renderer);
*introOff = 1;
}