瀏覽代碼

Blit one grass square

DricomDragon 4 年之前
父節點
當前提交
1457f699a2
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      main.cpp

+ 4 - 2
main.cpp

@@ -28,7 +28,7 @@ int main()
     }
 
     // [2.2] Other components
-	// Nothing for now
+	SDL_Surface* grass = SDL_LoadBMP("textures/grass.bmp");
 
     /// [3] Main loop
     bool done(false);
@@ -56,7 +56,7 @@ int main()
         // [3.3] Draw phase
         SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 255, 255));
 
-        // other draws
+		SDL_BlitSurface(grass, 0x0, screen, 0x0);
 
         SDL_Flip(screen);
 
@@ -64,6 +64,8 @@ int main()
     } // end of main loop
 
     ///[4] Free components
+	SDL_FreeSurface(grass);
+
     SDL_FreeSurface(screen);
 
     std::cout << "No error caught." << std::endl;