diff options
| author | oy <Tom_Adams@web.de> | 2011-02-16 12:36:51 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-02-16 12:36:51 +0100 |
| commit | b2f66978c981351727ded03bca5d87b1b990b2d6 (patch) | |
| tree | ef7cba8dd5fef9d4f40fd95ddcea0764d9bd0792 /src/game/editor | |
| parent | d939b841250180d89cd5843ff40e82d00b443c37 (diff) | |
| download | zcatch-b2f66978c981351727ded03bca5d87b1b990b2d6.tar.gz zcatch-b2f66978c981351727ded03bca5d87b1b990b2d6.zip | |
fixed overlapping image names in the editor. Closes #442
Diffstat (limited to 'src/game/editor')
| -rw-r--r-- | src/game/editor/ed_editor.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp index 69040499..bbe321cf 100644 --- a/src/game/editor/ed_editor.cpp +++ b/src/game/editor/ed_editor.cpp @@ -381,9 +381,13 @@ int CEditor::DoButton_Editor_Common(const void *pID, const char *pText, int Chec int CEditor::DoButton_Editor(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Flags, const char *pToolTip) { RenderTools()->DrawUIRect(pRect, GetButtonColor(pID, Checked), CUI::CORNER_ALL, 3.0f); - CUIRect NewRect = *pRect; - NewRect.y += NewRect.h/2.0f-7.0f; - UI()->DoLabel(&NewRect, pText, 10, 0, -1); + CUIRect NewRect = *pRect; + NewRect.y += NewRect.h/2.0f-7.0f; + float tw = min(TextRender()->TextWidth(0, 10.0f, pText, -1), NewRect.w); + CTextCursor Cursor; + TextRender()->SetCursor(&Cursor, NewRect.x + NewRect.w/2-tw/2, NewRect.y - 1.0f, 10.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); + Cursor.m_LineWidth = NewRect.w; + TextRender()->TextEx(&Cursor, pText, -1); return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip); } @@ -416,7 +420,10 @@ int CEditor::DoButton_MenuItem(const void *pID, const char *pText, int Checked, CUIRect t = *pRect; t.VMargin(5.0f, &t); - UI()->DoLabel(&t, pText, 10, -1, -1); + CTextCursor Cursor; + TextRender()->SetCursor(&Cursor, t.x, t.y - 1.0f, 10.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); + Cursor.m_LineWidth = t.w; + TextRender()->TextEx(&Cursor, pText, -1); return DoButton_Editor_Common(pID, pText, Checked, pRect, Flags, pToolTip); } |