-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|352|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Blogs Home -> Blogs


 
spinal
Created : 13 November 2007
Edited : 15 November 2007

Simple DS text reader



I have started a text reader for the DS, I hope yo eventually integrate it into my menu when it gets to a usable stage.
So far it reads text from a file one character at a time, and currently removes multiple line breaks ignoring single ones to wrap the text a little better.

I am trying to think up how to check for work breaks (spaces) to wrap words instead of characters.

I have noticed a problem already in the output (not sure whats wrong with the code though) when I find and use a line break (removing multiple breaks) I lose the next character (first one in new line). I assume its the muli-line removal.

anyway, here is the code so far if anyone wants to look at it, and a screeny to show the progress so far.






|edit| Fixed the missing character thing, I needed a " PA_SmartText(screen,lx,ly,192,256,filetext,1,font_number,3,1);
" at the end of my multi-line chacker.

 

Comments


Wednesday, 14 November 2007, 17:30
spinal
For safety (I tend to lose previous versions of stuff), I am going to shove working versions of the code in here. If anyone has any advice or ideas, just add a comment and I will, erm... read it.

This version is similar to the very first, in read 100 bytes at a time instead of 1.

Thursday, 15 November 2007, 06:01
spinal
OK, latest version, now wraps words, excellent! Now though I have noticed I'm losing a line ot ext at the bottom of the first screen, it should continue straight onto the top of the second screen.


Thursday, 15 November 2007, 06:26
Jayenkai
It's probably to do with "if(ly>240)".. remember that that's the TOP of the line, and that the text will in fact be going down to (ly+police8bitheight)
So, you should check (ly+police8bitheight)>240 instead.
Thursday, 15 November 2007, 17:14
spinal
How could I have missed something like that, I think I am already too close to the project to look for such silly mistakes.

I'm going to have to come up with some sort of interface for this, its eventual feature might include the following...

bookmarks (4 or 5 maybe per file)
stylus control for page turning
landscape and portrait orientation
mp3/mod playback (perhaps you have some relaxing music or something)
different font sizes

if anyone else has some suggestions let me know.


|edit|
OK, here is the latest code, it removes multiple lines and I have set it to use a custom font (see second screenshot). Whats bothering me now is that (a)I need a better font, preferably smaller but still very readable and (b) I can't think of a way to remove multiple spaces in a row.


Saturday, 17 November 2007, 18:47
spinal
Aaaaaarrrrrrrgggggghhhhhhh!!!!!!!!!!!!!11111111

After two days, TWO DAYS, of trying to get this code working in my menu I notice I have been trying to pass the file name like this

instead of like this

What a damn fool. Theres egg on my face I can tell you.

Now if only I can get it to exit back to the menu properly.