PDA

View Full Version : trouble with simple text example



edexter
18-10-2007, 12:47 PM
I was able to compile the example that comes with phoenix but when I try to use that as an example for a simplier program I get stuck.. with this it seems to freeze on my screen.. I am just trying to print text at a certain location.





program Fonts2;

{$APPTYPE CONSOLE}
{$IFDEF FPC}
{$mode objfpc}{$H+}
{$ENDIF}


uses
ClASSES, SysUtils,

dglOpenGL,

phxBase,
phxScreen,
phxTypes,crt,
phxFonts;

var Screen: TPHXScreen;
Fonts : TPHXFontList;
xxend : char;
begin
// Create the window
Screen:= TPHXScreen.getInstance;

// Open the window
if not Screen.Open('Dexters Font Demo', -1, -1, 800, 600) then Exit;

Fonts := TPHXFontList.Create;

Fonts.LoadFont('Font1.phxfnt');
Fonts.LoadFont('Font2.phxfnt');
//repeat
repeat
//Timer.Update;
// Clear the window
Screen.Clear();

Fonts[0].TextOut(4,4,'test');
Fonts[0].TextOut(4,4,'test');
//repeat
//until (Screen.Visible = False);
// xxend := readkey();
until (Screen.Visible = False);
Fonts.Free;
end.

Andreaz
18-10-2007, 04:01 PM
dont forget to flip the screen in the game loop




repeat
Screen.Clear;
// Render
Screen.Flip;
until Screen.Visible = false;

edexter
19-10-2007, 02:58 PM
Now that I know it is important I will make sure I use it (compiles fine now)... This seems to work alot better on my machine than sdl. Realy nice a little work to use .fon though.. thanks alot..