Skip to main content
gamedev.net
🔒 Locked

Font problem

Started by OldRod Oct 9, 2001 at 2:29 PM 1 replies 400+ views
Original Post
OldRod
OldRod
Ok, let me set up what I''ve done so far. I took SimpleLand and removed all the code except enough to make it spawn the terrain and allow movement. Compiled and ran, it worked fine. Added my own landscape file and it still runs. Now, I''m attempting to use a custom font to write on the screen. Here''s how I''m going about it: 1 - At the top of simpleland.c I added: PR_FONT *LocFont; 2 - In Main() I added the following immediately after CreateCharacter(): PR_GoStartPath (); chdir("fonts"); LocFont = PR_LoadFont("Tempus.pft"); PR_SetFontSpacing(1); PR_SetFontDepth(PR_Globals.PR_CurrentCamera->nearclip + 1); PR_SetFont(LocFont); PR_SetFontScale(0.5f); PR_SetFontColor(255,255,255); 3 - In the while loop that reads the keyboard (near the end), I added: sprintf(buf,"Test text"); PR_FontPrint(50,50,buf); The text doesn''t show up. I commented these lines out and used PR_printf instead. The text appears, so I know the code is executing, but I don''t have the custom font of course. I tried the Tempus.pft font file out in the Playground example (replacing hud.pft with mine) and the font shows up, so I know the font file is ok. So, what am I doing wrong? Why won''t my font show up in my code? Anyone?
jevdsnny
jevdsnny
I think PR_FontPrint needs to be in the HUD callback routine. It is working ok for me there. I had a similar problem with PR_ShowOVerlay, wouldn''t show up in the while() polling loop, but when I moved it to the HUD callback, it worked.
OldRod
OldRod
I take it that you mean LS_RegisterHUDFunction()?

I used that and it worked. Thanks

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.