Path: chuka.playstation.co.uk!news From: "Mario Wynands" Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: User defined fonts Date: Mon, 21 Jun 1999 12:20:16 +1200 Organization: PlayStation Net Yaroze (SCEE) Lines: 102 Message-ID: <7kk0m0$33u17@chuka.playstation.co.uk> References: <7kgohf$4fj24@chuka.playstation.co.uk> <7khhk2$33u2@chuka.playstation.co.uk> <7kijaj$33u7@chuka.playstation.co.uk> <376d35be.13127668@www.netyaroze-europe.com> NNTP-Posting-Host: p12-max8.wlg.ihug.co.nz X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MIMEOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Barry & Robert Swan wrote in message news:376d35be.13127668@www.netyaroze-europe.com... > advenutere game has a text handling routine already done. Mine is > slightly different to the others. ( i think) > > I parse the text string once, and use moveImage to copy each letter > one at a time from their original location to a part of vram > designated as the sentance sprite. But doesn't this a. limit the amount of characters you can have in a sentence b. restrict you to displaying only a single sentence at a time although I like the idea of processing the string only once. As for the speed thing, I just had a look at your code and saw { tAscii = tText[tEndWordCheckLetter]; if (tAscii == 33) tLetterCode = 62; // ! if (tAscii == 34) tLetterCode = 63; // " if (tAscii == 39) tLetterCode = 64; // ' if (tAscii == 40) tLetterCode = 65; // ( if (tAscii == 41) tLetterCode = 66; // ) if (tAscii == 43) tLetterCode = 67; // + if (tAscii == 44) tLetterCode = 68; // , if (tAscii == 45) tLetterCode = 69; // - if (tAscii == 46) tLetterCode = 70; // . if (tAscii == 58) tLetterCode = 71; // : if (tAscii == 59) tLetterCode = 72; // ; if (tAscii == 61) tLetterCode = 73; // = if (tAscii == 63) tLetterCode = 74; // ? if ((tAscii >47) && (tAscii <58)) tLetterCode = tAscii-48; // numbers if ((tAscii >64) && (tAscii <91)) tLetterCode = tAscii-55; // upper case if ((tAscii >96) && (tAscii <123)) tLetterCode = tAscii-61; // lower case tEndWordX += LetterWidth[tLetterCode]; tEndWordCheckLetter++; } It may be better structured like the following { tAscii = tText[tEndWordCheckLetter]; if ((tAscii >96) && (tAscii <123)) { tLetterCode = tAscii-61; // lower case } else { if ((tAscii >64) && (tAscii <91)) { tLetterCode = tAscii-55; // upper case } else { if ((tAscii >47) && (tAscii <58)) { tLetterCode = tAscii-48; // numbers } else { if (tAscii == 33) tLetterCode = 62; // ! if (tAscii == 34) tLetterCode = 63; // " if (tAscii == 39) tLetterCode = 64; // ' if (tAscii == 40) tLetterCode = 65; // ( if (tAscii == 41) tLetterCode = 66; // ) if (tAscii == 43) tLetterCode = 67; // + if (tAscii == 44) tLetterCode = 68; // , if (tAscii == 45) tLetterCode = 69; // - if (tAscii == 46) tLetterCode = 70; // . if (tAscii == 58) tLetterCode = 71; // : if (tAscii == 59) tLetterCode = 72; // ; if (tAscii == 61) tLetterCode = 73; // = if (tAscii == 63) tLetterCode = 74; // ? } } } tEndWordX += LetterWidth[tLetterCode]; tEndWordCheckLetter++; } In theory, if your sentences are made up mostly of upper and lower case characters then you will be only doing two tests for the majority of each character in the sentence, instead of doing sixteen tests for every character as before. That should give you a bit of a speed up (especially seeing as this test logic appears twice in that function). You could also try turning all that symbol test stuff into a 'case' statement. Regards Mario mario@sidhe.co.nz www.sidhe.co.nz