//</SnippetDisplayFormat1> //<SnippetListSupportedFormats1> // List all supported formats on the service void ListSupportedFormats( _In_ IPortableDeviceService* service) { ComPtr<IPortableDeviceServiceCapabilities> capabilities; ComPtr<IPortableDevicePropVariantCollection> formats; DWORD numFormats = 0; // Get an IPortableDeviceServiceCapabilities interface from the IPortableDeviceService interface to // access the service capabilities-specific methods. HRESULT hr = service->Capabilities(&capabilities); if (FAILED(hr)) { wprintf(L"! Failed to get IPortableDeviceServiceCapabilities from IPortableDeviceService, hr = 0x%lx\n", hr); } else { // Get all formats supported by the service. hr = capabilities->GetSupportedFormats(&formats); if (FAILED(hr)) { wprintf(L"! Failed to get supported formats from the service, hr = 0x%lx\n", hr); } } // Get the number of supported formats found on the service. if (SUCCEEDED(hr)) { hr = formats->GetCount(&numFormats); if (FAILED(hr)) { wprintf(L"! Failed to get number of supported formats, hr = 0x%lx\n", hr); } } // Loop through each format and display it if (SUCCEEDED(hr)) { wprintf(L"\n%u Supported Formats Found on the service\n\n", numFormats); for (DWORD index = 0; index < numFormats; index++) { PROPVARIANT format = {0}; hr = formats->GetAt(index, &format); if (SUCCEEDED(hr)) { // We have a format. It is assumed that // formats are returned as VT_CLSID VarTypes. if (format.vt == VT_CLSID && format.puuid != nullptr) { DisplayFormat(capabilities.Get(), *format.puuid); wprintf(L"\n"); } } PropVariantClear(&format); } } }
/** Inicializálja a hp bar kirajzolásához szükséges, globális * változókban eltárolt képeket (csak a képre mutató pointer * globális, az meg nem foglal sok helyet). */ void Hp_bar_init (void) { hp_bar = IMG_Load("./sprite/etc/hp_bar.gif"); SDL_SetColorKey(hp_bar,SDL_SRCCOLORKEY|SDL_RLEACCEL,SDL_MapRGB(hp_bar->format,0,0,0)); DisplayFormat(&hp_bar); hp_line = IMG_Load("./sprite/etc/hp_line.gif"); DisplayFormat(&hp_line); hp_start = IMG_Load("./sprite/etc/hp_start.gif"); SDL_SetColorKey(hp_start,SDL_SRCCOLORKEY|SDL_RLEACCEL,SDL_MapRGB(hp_start->format,0,0,0)); DisplayFormat(&hp_start); hp_end = FlipSurface(hp_start); hp_tick = IMG_Load("./sprite/etc/hp_tick.gif"); SDL_SetColorKey(hp_tick,SDL_SRCCOLORKEY|SDL_RLEACCEL,SDL_MapRGB(hp_tick->format,0,0,0)); DisplayFormat(&hp_tick); }
/** Elvégzi a hp bar konkrét kirajzolását */ static void Draw_hp_bar2 (int percent, SDL_Surface *screen, int x, int y, char *s) { SDL_Surface *current = SDL_CreateRGBSurface(SDL_ANYFORMAT, hp_bar->w, hp_bar->h, screen_bpp, screen_rmask, screen_gmask, screen_bmask, screen_amask); DisplayFormat(¤t); SDL_Rect rect = {0,0,0,0}; SDL_BlitSurface(hp_bar, NULL, current, NULL); if(percent > 0) { rect.x = 16; rect.y = 10; SDL_BlitSurface(hp_start, NULL, current, &rect); } int i; if(percent > 2) { rect.x += 5; for(i=0; i < (percent - 2) * 2.4; i++) { SDL_BlitSurface(hp_line, NULL, current, &rect); rect.x++; } SDL_BlitSurface(hp_end, NULL, current, &rect); } rect.x = 13 + 61; rect.y = 16; for(i=0; i<3; i++) { SDL_BlitSurface(hp_tick, NULL, current, &rect); rect.x += 61; } rect.x = x; rect.y = y; DisplayFormat(¤t); Scale(¤t); BlitSurface(current, NULL, screen, &rect); SDL_FreeSurface(current); SDL_Color white = {255, 255, 255}; current = RenderText(Cour15, s, white); rect.y = y - current->h/2; rect.x = x + hp_bar->w*scale/2 - current->w/2; BlitSurface(current, NULL, screen, &rect); }