Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: screen/EALCD.cpp
- Revision:
- 7:6cf21b018420
- Parent:
- 6:4fe6f365cbeb
--- a/screen/EALCD.cpp	Thu May 06 23:32:14 2010 +0000
+++ b/screen/EALCD.cpp	Mon Nov 01 13:07:40 2010 +0000
@@ -598,24 +598,34 @@
     img.paint(*this);
 }
 
-void EALCD::drawText(unsigned short x, unsigned short y, char* text)
+void EALCD::drawText(unsigned short x, unsigned short y, const std::string& text)
 {
+    printf("Draw text.\r\n");
+
     // Don't try painting with an invalid font or no text
-    if ((_font.isValid() == false) || (text == NULL))
+    if ((_font.isValid() == false) || (text.empty() == true))
     {
+        printf("Failed to load valid font.\r\n");
         return;
     }
     
-    EAImage* img = _font._data();
+    EAImage img;
+    
+    if (_font._data(img) == false)
+    {
+        printf("Failed to load data.\r\n");
+        return;
+    }
+    
     EAFont::EACharacter detail;
       
-    for (int i = 0; i < strlen(text); i++)
+    for (int i = 0; i < text.length(); i++)
     {
         if (_font._getCharacter(text[i], detail) == true)
         {
-            img->setX(x+detail.xOffset);
-            img->setY(y+detail.yOffset);
-            img->paint(*this, detail.x, detail.y, detail.width, detail.height);       
+            img.setX(x+detail.xOffset);
+            img.setY(y+detail.yOffset);
+            img.paint(*this, detail.x, detail.y, detail.width, detail.height);       
             
             x += detail.xAdvance;
         } else {