예제 #1
0
void MapPanel::AddMap(char* imageName, char* mapCommand, char* mapName)
{
	char tmp[256];
	Q_snprintf(tmp, sizeof(tmp), "Map%i", count);
	Label *name = new Label(this, tmp, mapName);

	ImageButton *image;	
	Q_snprintf(tmp, sizeof(tmp), "materials/vgui/%s.vmt", imageName);
	if (!g_pFullFileSystem->FileExists(tmp, "MOD")){
		Q_snprintf(tmp, sizeof(tmp), "Image%i", count);
		image = new ImageButton(this, tmp, "maps/menu_thumb_default", NULL, NULL, mapCommand);
	}
	else{
		Q_snprintf(tmp, sizeof(tmp), "Image%i", count);
		image = new ImageButton(this, tmp, imageName, NULL, NULL, mapCommand);
	}
	image->AddActionSignalTarget(this);
	//image->SetSize(32, 32);

	AddItem(image, name);
	count++;
}