|
@@ -30,6 +30,9 @@ int main()
|
|
|
|
|
|
// [2.2] Other components
|
|
|
SDL_Surface* grass = SDL_LoadBMP("textures/grass.bmp");
|
|
|
+ SDL_Surface* water = SDL_LoadBMP("textures/water.bmp");
|
|
|
+ SDL_Surface* desert = SDL_LoadBMP("textures/desert.bmp");
|
|
|
+ SDL_Surface* mountain = SDL_LoadBMP("textures/mountain.bmp");
|
|
|
SDL_Surface* pawn = SDL_LoadBMP("textures/pawn.bmp");
|
|
|
SDL_Rect pos({0, 0, 0, 0});
|
|
|
SDL_Rect pawnPos({0, 0, 0, 0});
|
|
@@ -64,9 +67,9 @@ int main()
|
|
|
// [3.3] Draw phase
|
|
|
SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 255, 255));
|
|
|
|
|
|
- for (pos.y = 0; pos.y < height; pos.y += grass->h)
|
|
|
- for (pos.x = 0; pos.x < width; pos.x += grass->w)
|
|
|
- SDL_BlitSurface(grass, NULL, screen, &pos);
|
|
|
+ for (pos.y = 0; pos.y < height; pos.y += water->h)
|
|
|
+ for (pos.x = 0; pos.x < width; pos.x += water->w)
|
|
|
+ SDL_BlitSurface(water, NULL, screen, &pos);
|
|
|
|
|
|
SDL_BlitSurface(pawn, NULL, screen, &pawnPos);
|
|
|
|
|
@@ -77,6 +80,9 @@ int main()
|
|
|
|
|
|
///[4] Free components
|
|
|
SDL_FreeSurface(grass);
|
|
|
+ SDL_FreeSurface(water);
|
|
|
+ SDL_FreeSurface(desert);
|
|
|
+ SDL_FreeSurface(mountain);
|
|
|
SDL_FreeSurface(pawn);
|
|
|
|
|
|
SDL_FreeSurface(screen);
|