public GraphicsController(Map world, Action updateWorldHandler)
 {
     this.CursorVisible      = false;
     this.gameWorld          = world;
     this.updateWorldHandler = updateWorldHandler;
     this.cameraService      = new CameraService();
     this.textDrawingService = new TextDrawingService();
     this.fpsCounter         = new FpsCounter();
     this.drawingService     = new DrawingService(this.cameraService, this.textDrawingService);
     this.vehicleFinder      = new VehicleFinder();
     TexturesLoader.InitTextures();
 }
Beispiel #2
0
 public DrawingService(CameraService camServ, TextDrawingService textServ)
 {
     this.cameraService = camServ;
     this.textDrawingService = textServ;
 }
Beispiel #3
0
        internal void DisplayText(List <int> texturesID, string textToDisplay, Point dispCoord, CameraService camServ)
        {
            double translation = 0;

            GL.PushMatrix();
            GL.Translate(camServ.CameraPosition.X - Constants.XCoordTranslationOfStatsBox, Math.Abs(camServ.CameraDistance) - 1,
                         camServ.CameraPosition.Y - Constants.YCoordTranslationOfStatsBox);
            foreach (char character in textToDisplay)
            {
                GL.Enable(EnableCap.Texture2D);
                GL.BindTexture(TextureTarget.Texture2D, texturesID[Convert.ToInt32(character)]);
                GL.Begin(PrimitiveType.Quads);
                GL.Color3(Color.White);
                GL.TexCoord2(0, 0);
                GL.Vertex3(0 + translation + dispCoord.X, 0.0f, 0 + dispCoord.Y);

                GL.TexCoord2(1, 0);
                GL.Vertex3(Constants.DisplayedCharSize + translation + dispCoord.X, 0.0f, 0 + dispCoord.Y);

                GL.TexCoord2(1, 1);
                GL.Vertex3(Constants.DisplayedCharSize + translation + dispCoord.X, 0.0f, Constants.DisplayedCharSize + dispCoord.Y);

                GL.TexCoord2(0, 1);
                GL.Vertex3(0 + translation + dispCoord.X, 0.0f, Constants.DisplayedCharSize + dispCoord.Y);

                translation += Constants.DistanceBetweenChars;

                GL.End();
                GL.BindTexture(TextureTarget.Texture2D, 0);
                GL.Disable(EnableCap.Texture2D);
            }
            GL.PopMatrix();
        }