I'm trying to develop a simple plain text reader add in for the Prizm. The idea is to, obviously, read the contents of a text file and display them on the screen.

One defect I find on the eActivity function, is that the font size is too big for much information to be shown on the screen at a time - you need to be constantly scrolling up and down.

The Prizm operating system has a smaller font built-in that appears, for example, on the status bar (on the top) when the Prizm is connected to the computer through USB. Note that I'm not talking about the small under-script characters you can insert by pressing CHAR on e.g. eActivity, but about a whole separate font size (which, unlike what happens if you insert multiple under-script chars together, has normal spacing).

So my question is, how to write with this smaller font size in C addins?
I was looking for something as simple to use as PrintXY.

KermM told me there was a routine already written for this, but it was not documented. So, anyone who has the routine can be kind enough to share it with the community (assuming he/she has permission from the original author)?

(Other questions I have include how to use scrollbars to slide text up and down, but I think I can try to figure that out later Wink )
I can help out with this, but only once I get home. There are a few sys calls that do this, but there's a wrapper function that simplifies it. I'll give you the code tonight.
Thank you! No stress though... Wink
Thanks, Shaun! Can you please oh please document it on the wiki and share your routine in the Useful Routines topic and page?
KermMartian wrote:
Thanks, Shaun! Can you please oh please document it on the wiki and share your routine in the Useful Routines topic and page?


You mean the Useful Prizm Routines? Please post whenever you get a working example as I need them for Sink Smile
Oh jeez I forgot to do this. People need to remind me tonight.
merthsoft wrote:
Oh jeez I forgot to do this. People need to remind me tonight.
Will certainly do so, good sir.
Alright, here's the main function that wraps around the sys calls and stuff:

Code:
int PrintMiniFix( int x, int y, const char*Msg, const int flags, const short color, const short bcolor ){
int i = 0, dx;
unsigned short width;
void*p;

   while ( Msg[ i ] ){
      p = GetMiniGlyphPtr( Msg[ i ], &width );
      dx = ( 12 - width ) / 2;
      if ( dx > 0 ) {
         PrintMiniGlyph( x, y, (void*)empty, flags, dx, 0, 0, 0, 0, color, bcolor, 0 );
      }else dx = 0;
      PrintMiniGlyph( x+dx, y, p, flags, width, 0, 0, 0, 0, color, bcolor, 0 );
      if ( width+dx < 12 ){
         PrintMiniGlyph( x+width+dx, y, (void*)empty, flags, 12-width-dx, 0, 0, 0, 0, color, bcolor, 0 );
      }
      x += 12;
      i++;
   }
   return x;
}

Use it like:

Code:
PrintMiniFix(0, 175,
         "Oh look a string at the bottom of the screen.",
         0, COLOR_WHITE, COLOR_BLACK);

Empty is defined as:

Code:
const short empty[18] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
Thank you! I'm going to test this when I have time and then I'll report how it worked.

EDIT: it seems to work well.

For my txtRead plugin, I still need to figure out how to translate special characters like áéíóú, àèìòù, ç Ç ñ Ñ into Prizm's own character map, as well as transform new line characters into actual lines: currently, my txt reading plugin shows newlines as an enter arrow (the one shown in the EXE key) and a bold P letter; I guess it means carriage return and then Paragraph.

Oh, as well as how to make a scrolling text with a nice scroll bar... still a long way to go.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement