[問題] 請問SDL的部分程式碼問題
請問一下,我經版友的推薦,目前在http://ppt.cc/lnwu學SDL
我看到第二章Optimized Surface Loading and Blitting 的部分
裡面有段副程式如下:
SDL_Surface *load_image(std::string FileName){
SDL_Surface *LoadedImage = NULL;
SDL_Surface *OptimizedImage = NULL;
LoadedImage=SDL_LoadBMP(FileName.c_str());
if(LoadedImage!=NULL){
OptimizedImage = SDL_DisplayFormat(LoadedImage);
SDL_FreeSurface(LoadedImage);
}
return OptimizedImage;
}
我想請問的是那個if判斷的是如果圖片讀到的非NULL就成立
接著執行SDL_DisplayFormat(LoadedImage);
可是我不太懂他解釋這段的意思
『
If the image loaded fine, SDL_DisplayFormat() is called which creates a new
version of "loadedImage" in the same format as the screen. The reason we do
this is because when you try to stick one surface onto another one of a
different format, SDL converts the surface so they're the same format.
』
可以請高手們幫忙解釋嗎?謝謝
因為在此教學的第一章中,明明同樣是讀取BMP檔,但卻不需要使用SDL_DisplayFormat
所以對此有點困惑。
另外有些英文單字可以的話也想請各位幫忙解釋一下
surface、stick、bilt請問該怎麼解釋?
另外『Now SDL won't have to convert it on the fly.』此文中的fly又是什麼意思?
謝謝各位的幫忙
另外這SDL的網頁真的滿不錯的,教的很詳細,
而且用的句子讓我這個英文初學者幾乎都看得懂@@
讓我對英文有一點點的信心了
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.0.51.8
※ 編輯: yoll522 來自: 123.0.51.8 (07/19 16:39)
※ 編輯: yoll522 來自: 123.0.51.8 (07/19 16:41)
※ 編輯: yoll522 來自: 123.0.51.8 (07/19 16:49)
推
07/19 16:53, , 1F
07/19 16:53, 1F
→
07/19 19:01, , 2F
07/19 19:01, 2F
→
07/19 19:02, , 3F
07/19 19:02, 3F
→
07/19 19:02, , 4F
07/19 19:02, 4F
→
07/19 20:40, , 5F
07/19 20:40, 5F
→
07/19 20:41, , 6F
07/19 20:41, 6F
→
07/19 20:41, , 7F
07/19 20:41, 7F
→
07/19 22:52, , 8F
07/19 22:52, 8F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):