|
@@ -30,6 +30,7 @@ int main()
|
|
|
|
|
|
// [2.2] Other components
|
|
|
SDL_Surface* grass = SDL_LoadBMP("textures/grass.bmp");
|
|
|
+ SDL_Rect pos({0, 0, 0, 0});
|
|
|
|
|
|
/// [3] Main loop
|
|
|
bool done(false);
|
|
@@ -57,7 +58,9 @@ int main()
|
|
|
// [3.3] Draw phase
|
|
|
SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 255, 255));
|
|
|
|
|
|
- SDL_BlitSurface(grass, NULL, screen, NULL);
|
|
|
+ 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);
|
|
|
|
|
|
SDL_Flip(screen);
|
|
|
|