Rockbox Technical Forums

Rockbox Development => Starting Development and Compiling => Topic started by: mikeage on November 24, 2007, 11:57:59 PM

Title: Displaying lots of text in a plugin
Post by: mikeage on November 24, 2007, 11:57:59 PM
I'm writing a plugin which will display a lot of text. My first idea was to write to a temporary file and launch the text viewer, which could handle the scrolling, but I understand that a plugin may not launch another plugin.

Currently, I'm using rb->splash on a short amount of text, and parsing left and right to display the next or previous screen, but in addition to being incredibly ugly (from a coding standpoint), I have no way to know how much text I can print to one screen (so I'm just snprintf'ing a fixed, relatively small amount at a time).

Can anyone suggest a better way?
Title: Re: Displaying lots of text in a plugin
Post by: safetydan on November 25, 2007, 01:20:14 AM
You can get the size of the current font from the the plugin API. Either rb->font_get_width or rb->font_getstringsize will let you figure out the size in pixels of the current font. Combine that with the screen dimensions and you should be able to figure out how much text you can print with lcd_puts.
Title: Re: Displaying lots of text in a plugin
Post by: mikeage on November 25, 2007, 02:11:03 AM
thanks... I didn't know about those APIs!

I'll check it out...