about summary refs log tree commit diff
path: root/src/game/client/components/menus_demo.cpp
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-11-17 19:46:50 +0100
committeroy <Tom_Adams@web.de>2010-11-17 19:46:50 +0100
commitd94355729da4677f7bc7dcc59adcce33dfc7e2b4 (patch)
treef749d18c64f88b2d1e17d08b8f2753420b18859d /src/game/client/components/menus_demo.cpp
parent4383e1093398816a925794c1778974e29a35983c (diff)
downloadzcatch-d94355729da4677f7bc7dcc59adcce33dfc7e2b4.tar.gz
zcatch-d94355729da4677f7bc7dcc59adcce33dfc7e2b4.zip
added icons in the demo browser and the editor's file dialog. Closes #209
Diffstat (limited to 'src/game/client/components/menus_demo.cpp')
-rw-r--r--src/game/client/components/menus_demo.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp
index 2b0cb946..25ab0240 100644
--- a/src/game/client/components/menus_demo.cpp
+++ b/src/game/client/components/menus_demo.cpp
@@ -442,7 +442,7 @@ void CMenus::DemolistFetchCallback(const char *pName, int IsDir, int StorageType
 	}
 	else
 	{
-		str_format(Item.m_aName, min(static_cast<int>(sizeof(Item.m_aName)), Length), "    %s", pName);
+		str_copy(Item.m_aName, pName, min(static_cast<int>(sizeof(Item.m_aName)), Length));
 		char aBuffer[512];
 		str_format(aBuffer, sizeof(aBuffer), "%s/%s", pSelf->m_aCurrentDemoFolder, Item.m_aFilename);
 		// TODO: many items slow this down, don't load the info from every file when making the filelist
@@ -509,7 +509,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
 	RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_ALL, 10.0f);
 	MainView.Margin(10.0f, &MainView);
 	
-	CUIRect ButtonBar, RefreshRect, PlayRect, DeleteRect;
+	CUIRect ButtonBar, RefreshRect, PlayRect, DeleteRect, FileIcon;
 	MainView.HSplitBottom(ms_ButtonHeight+5.0f, &MainView, &ButtonBar);
 	ButtonBar.HSplitTop(5.0f, 0, &ButtonBar);
 	ButtonBar.VSplitRight(130.0f, &ButtonBar, &PlayRect);
@@ -524,7 +524,12 @@ void CMenus::RenderDemoList(CUIRect MainView)
 	{
 		CListboxItem Item = UiDoListboxNextItem((void*)(&r.front()));
 		if(Item.m_Visible)
+		{
+			Item.m_Rect.VSplitLeft(Item.m_Rect.h, &FileIcon, &Item.m_Rect);
+			Item.m_Rect.VSplitLeft(5.0f, 0, &Item.m_Rect);
+			DoButton_Icon(IMAGE_FILEICONS, r.front().m_IsDir?SPRITE_FILE_FOLDER:SPRITE_FILE_DEMO1, &FileIcon);
 			UI()->DoLabel(&Item.m_Rect, r.front().m_aName, Item.m_Rect.h*ms_FontmodHeight, -1);
+		}
 	}
 	bool Activated = false;
 	m_DemolistSelectedIndex = UiDoListboxEnd(&s_ScrollValue, &Activated);