mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Resize font in editor to show full image and sound name
This commit is contained in:
parent
7a4c9990d1
commit
c7617b06d2
|
@ -3284,8 +3284,12 @@ void CEditor::RenderImages(CUIRect ToolBox, CUIRect ToolBar, CUIRect View)
|
|||
Selected += 4; // Image should be embedded
|
||||
}
|
||||
|
||||
if(int Result = DoButton_Editor(&m_Map.m_lImages[i], aBuf, Selected, &Slot,
|
||||
BUTTON_CONTEXT, "Select image"))
|
||||
float FontSize = 10.0f;
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1) > Slot.w)
|
||||
FontSize--;
|
||||
|
||||
if(int Result = DoButton_Ex(&m_Map.m_lImages[i], aBuf, Selected, &Slot,
|
||||
BUTTON_CONTEXT, "Select image", 0, FontSize))
|
||||
{
|
||||
m_SelectedImage = i;
|
||||
|
||||
|
@ -3436,8 +3440,12 @@ void CEditor::RenderSounds(CUIRect ToolBox, CUIRect ToolBar, CUIRect View)
|
|||
if(Selected < 2 && e == 1)
|
||||
Selected += 4; // Sound should be embedded
|
||||
|
||||
if(int Result = DoButton_Editor(&m_Map.m_lSounds[i], aBuf, Selected, &Slot,
|
||||
BUTTON_CONTEXT, "Select sound"))
|
||||
float FontSize = 10.0f;
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1) > Slot.w)
|
||||
FontSize--;
|
||||
|
||||
if(int Result = DoButton_Ex(&m_Map.m_lSounds[i], aBuf, Selected, &Slot,
|
||||
BUTTON_CONTEXT, "Select sound", 0, FontSize))
|
||||
{
|
||||
m_SelectedSound = i;
|
||||
|
||||
|
|
Loading…
Reference in a new issue