PDA

View Full Version : Problem with Text...



IlovePascal
19-02-2007, 11:26 PM
Hello, I have tried to write on the screen in my game by following Nehe's 13th tutorial.
It did work, but it doesn't write what it's supposed to! lol

I have spent 4h on this and can't figure it out.

Please have a look here http://www.uploadtemple.com/view.php/1171926771.zip.
The executable Writer.exe is the way it should work (code straight from Nehe's tutorial) and if you compile and run PaperWars3D.pas, you should see my problem.

And whatever the problem is, it is most certainly either in Writer.pas or PaperWars3D.pas. I believe it might have to do with the procedure BuildFont, but I don't know.

Thanks very much to those who will give their time :wink:

grudzio
20-02-2007, 12:02 AM
In glPrint procedure (writer.pas) when you use glCallLists, cast the string to PChar.


glCallLists(length(text),GL_UNSIGNED_BYTE,Pchar(te xt));

IlovePascal
20-02-2007, 11:51 PM
Fantastic! :wink:

It's interesting though, I remember now that when I tried to compile the code from Nehe's tutorial, the compiler stoped on that line, so I changed pchar(text) to @text and it worked perfectly. Then when I copied bits of it into my game, I left it as @text, and the result was that it didn't write what I wanted. Now that I put it back to pchar(text), it compiles fine and works perfectly... I have no idea why!

DGL-luke
21-02-2007, 02:56 PM
it would have worked with "@text[1]" :)