From: Michael H. <mh...@us...> - 2000-10-14 19:39:19
|
Update of /cvsroot/pythianproject/PythianProject/Source/GameEngine In directory slayer.i.sourceforge.net:/tmp/cvs-serv17897 Modified Files: GameGrEngState.pas GrEngState.pas Log Message: text demo Index: GameGrEngState.pas =================================================================== RCS file: /cvsroot/pythianproject/PythianProject/Source/GameEngine/GameGrEngState.pas,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** GameGrEngState.pas 2000/09/04 17:51:55 1.8 --- GameGrEngState.pas 2000/10/14 19:39:16 1.9 *************** *** 3,7 **** interface ! uses GrEngState, Sky; type --- 3,7 ---- interface ! uses GrEngState, Sky, Graphics; type *************** *** 18,24 **** --- 18,32 ---- procedure SetFogStartMultiplier(const Value: Single); protected + txtFont :integer; + txtBaseList :integer; + procedure InitFog; procedure LoadSkyBox; procedure Paint; override; + + // test code + procedure InitTest; virtual; + procedure PaintTest; virtual; + procedure FinalizeTest; virtual; public procedure Finalize; override; *************** *** 34,38 **** uses ModelInstances, OpenGL, Points, Geometry, StdInit, TerrainEng, SysUtils, ! Windows, Trace; { TGameGrEngSate } --- 42,46 ---- uses ModelInstances, OpenGL, Points, Geometry, StdInit, TerrainEng, SysUtils, ! Trace, Windows, glfd; { TGameGrEngSate } *************** *** 44,50 **** --- 52,64 ---- FSkybox.Free; + FinalizeTest; + inherited; end; + procedure TGameGraphicsEngine.FinalizeTest; + begin + end; + procedure TGameGraphicsEngine.InitFog; begin *************** *** 97,103 **** --- 111,129 ---- LoadSkyBox; + InitTest; end; end; + procedure TGameGraphicsEngine.InitTest; + begin + // put code to init tests here + glfInit; + txtfont := glfLoadFont('arial1.glf'); + glfSetAnchorPoint(GLF_LEFT_UP); + glfConsoleClear; + glfPrintString('Test Line 1'); + glfPrintString('Test Line 2'); + end; + procedure TGameGraphicsEngine.LoadSkyBox; begin *************** *** 148,151 **** --- 174,212 ---- teFinishFrame; + + PaintTest; + end; + + procedure TGameGraphicsEngine.PaintTest; + begin + // put paint code here for tests + + // reinit the matrices + glClear(GL_DEPTH_BUFFER_BIT); // don't know why we need this, but we do + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; + glMatrixMode(GL_PROJECTION); + glPushMatrix; + glLoadIdentity; + + glColor3f(1.0,1.0,1.0); // has no effect :( + + + // change co-ordinate system to 1:1 pixel mapping + glScalef(2.0 / Window.Width, -2.0 / Window.Height, 1.0); + glTranslatef(-(window.width / 2), -(window.height/2), 0); + + // offset it from the top by 10px to make it look nicer + glTranslatef(0,10,0); + // need this: scale it - otherwise text will be 1x1 pixels! + glScalef(20,20,0); + // need this: flip matrix because GLF is expecting OpenGL default + // co-ordinates and we have changed them. Otherwise text will be + // upside down + glScalef(1,-1,1); + // finally draw the text + glfDrawSolidString('Pythian Project 2000'); + // and restore to default + glPopMatrix; end; Index: GrEngState.pas =================================================================== RCS file: /cvsroot/pythianproject/PythianProject/Source/GameEngine/GrEngState.pas,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** GrEngState.pas 2000/09/04 17:51:55 1.6 --- GrEngState.pas 2000/10/14 19:39:16 1.7 *************** *** 43,47 **** if Result then begin ! FFilterMode := GL_NEAREST; FFrames := 0; --- 43,47 ---- if Result then begin ! FFilterMode := GL_LINEAR; FFrames := 0; |