mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Fix current selection highlighting
This commit is contained in:
parent
3d7ee89104
commit
ab6f344daa
|
@ -1159,11 +1159,6 @@ void CEditor::DoToolbar(CUIRect ToolBar)
|
|||
Storage()->ListDirectory(IStorage::TYPE_ALL, "editor/entities", EntitiesListdirCallback, this);
|
||||
std::sort(m_SelectEntitiesFiles.begin(), m_SelectEntitiesFiles.end());
|
||||
|
||||
for(int i = 0; i < (int)m_SelectEntitiesFiles.size(); i++) {
|
||||
if (m_SelectEntitiesFiles[i] == "DDNet")
|
||||
m_SelectEntitiesImage = i;
|
||||
}
|
||||
|
||||
static int s_EntitiesPopupID = 0;
|
||||
UiInvokePopupMenu(&s_EntitiesPopupID, 0, Button.x, Button.y+18.0f,
|
||||
250, m_SelectEntitiesFiles.size()*14 + 10, PopupEntities);
|
||||
|
|
|
@ -668,6 +668,8 @@ public:
|
|||
m_FilesCur = 0;
|
||||
m_FilesStopAt = 999;
|
||||
|
||||
m_SelectEntitiesImage = "DDNet";
|
||||
|
||||
m_WorldOffsetX = 0;
|
||||
m_WorldOffsetY = 0;
|
||||
m_EditorOffsetX = 0.0f;
|
||||
|
@ -859,7 +861,7 @@ public:
|
|||
int m_FilesStopAt;
|
||||
|
||||
std::vector<std::string> m_SelectEntitiesFiles;
|
||||
int m_SelectEntitiesImage;
|
||||
std::string m_SelectEntitiesImage;
|
||||
|
||||
float m_WorldOffsetX;
|
||||
float m_WorldOffsetY;
|
||||
|
|
|
@ -1664,9 +1664,9 @@ int CEditor::PopupEntities(CEditor *pEditor, CUIRect View)
|
|||
|
||||
const char *Name = pEditor->m_SelectEntitiesFiles[i].c_str();
|
||||
|
||||
if(pEditor->DoButton_MenuItem(Name, Name, i==pEditor->m_SelectEntitiesImage, &Button)) {
|
||||
if (i != pEditor->m_SelectEntitiesImage) {
|
||||
pEditor->m_SelectEntitiesImage = i;
|
||||
if(pEditor->DoButton_MenuItem(Name, Name, pEditor->m_SelectEntitiesFiles[i] == pEditor->m_SelectEntitiesImage, &Button)) {
|
||||
if (pEditor->m_SelectEntitiesFiles[i] != pEditor->m_SelectEntitiesImage) {
|
||||
pEditor->m_SelectEntitiesImage = pEditor->m_SelectEntitiesFiles[i];
|
||||
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "editor/entities/%s.png", Name);
|
||||
|
|
Loading…
Reference in a new issue