Game Development Reference
In-Depth Information
7.
Let's go a level above and see how images are fetched from the server. The image
collection is retrieved from a website and stored in the clGallery object:
class clGallery: public iObject
{
public:
clGallery(): FNoImagesList(true) {}
8.
Return the full-size image URL:
std::string GetFullSizeURL(int Idx) const
{
return ( Idx < (int)FURLs.size() ) ?
Picasa_GetDirectImageURL(
FURLs[Idx], L_PHOTO_SIZE_ORIGINAL )
: std::string();
}
size_t GetTotalImages() const
{
return FImages.size();
}
clPtr<sImageDescriptor> GetImage( size_t Idx ) const
{
return ( Idx < FImages.size() ) ?
FImages[Idx] : NULL;
}
9.
Restart the downloading of all images that are not loaded:
void ResetAllDownloads();
bool StartListDownload();
10. We store the base URLs of all images, and the images themselves:
std::vector<std::string> FURLs;
std::vector< clPtr<sImageDescriptor> > FImages;
};
11. To decode an image list, we use the Picasa downloader code from Chapter 3 ,
Networking :
class clListDownloadedCallback: public clDownloadCompleteCallback
{
public:
clListDownloadedCallback( const clPtr<clGallery>& G )
: FGallery(G) {}
 
Search WWH ::




Custom Search