added wrapping element token text in level editor, if needed
authorHolger Schemel <holger.schemel@virtion.de>
Sun, 6 Oct 2024 09:28:07 +0000 (11:28 +0200)
committerHolger Schemel <holger.schemel@virtion.de>
Sun, 6 Oct 2024 09:28:08 +0000 (11:28 +0200)
src/editor.c

index d505f325f8808ec6e304574ead3060950229fcc6..edad7c554234f6a34234a789cffb80636446be46 100644 (file)
@@ -12337,10 +12337,11 @@ static void DrawPropertiesInfo(void)
     int font3_nr = FONT_TEXT_3;
     int font3_height = getFontHeight(font3_nr);
 
-    DrawTextF(xpos, ypos, font3_nr,
-             "[%s]", element_info[properties_element].token_name);
+    // wrap element token text if it is longer than window width
+    char *text_token = getStringPrint("[%s]", element_info[properties_element].token_name);
+    int num_lines = PrintTextFromBuffer(text_token, font3_nr, xpos, ypos);
 
-    ypos += 2 * font3_height;
+    ypos += (num_lines + 1) * font3_height;
   }
 
   // ----- print number of elements / percentage of this element in level