Exemplo n.º 1
0
        public override void Render()
        {
            Vector2 pos = ScaleVec2(0.22f, 0.01f);

            DrawShadow(new Rectangle((int)pos.X - 5, (int)pos.Y - 5, 155, 24));

            FontRenderer.Render(Fonts.White, "CP", pos, Color.White);
            pos.X += 25f;
            FontRenderer.Render(Fonts.White, String.Format("{0}/{1}", Race.Current.NextCheckpoint, Race.Current.ConfigFile.Checkpoints.Count), pos, Color.White);
            pos.X += 45f;
            FontRenderer.Render(Fonts.White, "LAP", pos, Color.White);
            pos.X += 35f;
            FontRenderer.Render(Fonts.White, String.Format("{0}/{1}", Race.Current.CurrentLap, Race.Current.ConfigFile.LapCount), pos, Color.White);

            pos = ScaleVec2(0.22f, 0.054f);

            DrawShadow(new Rectangle((int)pos.X - 5, (int)pos.Y - 5, 155, 24));
            FontRenderer.Render(Fonts.White, "WASTED", pos, Color.White);

            pos.X += 65f;
            FontRenderer.Render(Fonts.White, Race.Current.NbrDeadOpponents + "/" + Race.Current.NbrOpponents, pos, Color.White);

            pos.X += 240;
            DrawShadow(new Rectangle((int)pos.X - 5, (int)pos.Y - 5, 140, 24));
            FontRenderer.Render(Fonts.White, Race.Current.NbrDeadPeds + "/" + Race.Current.Peds.Count, pos, Color.White);

            pos.X += 80;
            FontRenderer.Render(Fonts.White, "KILLS", pos, Color.White);
        }
Exemplo n.º 2
0
        public override void Render()
        {
            Rectangle rect = CenterRectX(0, 0.182f, 0.087f);

            DrawShadow(rect);

            TimeSpan ts    = TimeSpan.FromSeconds(Race.Current.RaceTime.TimeRemaining);
            float    nudge = ts.Minutes < 10 ? 13 * FontScale : 0;

            FontRenderer.Render(Fonts.Timer,
                                String.Format("{0}/{1}", (int)ts.Minutes, ts.Seconds.ToString("00")), new Vector2(rect.X + 5 + nudge, rect.Y + 7), Color.White, FontScale);
        }
Exemplo n.º 3
0
        public override void Render()
        {
            GameEngine.SpriteBatch.Draw(_speedoTexture, ScaleRect(x, y, 0.145f, 0.16f), Color.White);

            DrawShadow(ScaleRect(x + 0.06f, y + 0.112f, 0.03f, 0.057f));

            FontRenderer.RenderGear(_chassis.Motor.Gearbox.CurrentGear + 1, ScaleVec2(x + 0.065f, y + 0.118f), Color.White, FontScale * 2);

            DrawShadow(ScaleRect(x + 0.1f, y + 0.112f, 0.068f, 0.057f));
            FontRenderer.Render(Fonts.Speedo, ((int)_chassis.Speed).ToString("000"), ScaleVec2(x + 0.102f, y + 0.118f), Color.White, FontScale);

            float rpmFactor = _chassis.Motor.Rpm / _chassis.Motor.RedlineRpm;
            float rotation  = (float)(rpmFactor * 4f) + 0.5f;

            GameEngine.SpriteBatch.Draw(_speedoLineTexture, ScaleVec2(x + 0.07f, y + 0.09f),
                                        null, Color.White, rotation, Vector2.Zero, ScaleVec2(0.0037f, 0.075f), SpriteEffects.None, 0);
        }
Exemplo n.º 4
0
    private void RefreshPreview(object objectParam)
    {
        var    refreshPreviewParams = objectParam as FontRendererParams;
        var    tableRenderer        = new FontRenderer(refreshPreviewParams);
        string preview = tableRenderer.Render();

        // Do this on the main thread!
        Gtk.Application.Invoke(delegate {
            previewimage.File        = preview;
            labelWidth.LabelProp     = previewimage.Pixbuf.Width.ToString();
            labelHeight.LabelProp    = previewimage.Pixbuf.Height.ToString();
            labelCellSize.LabelProp  = tableRenderer.CellSize.ToString();
            outputframe.Sensitive    = true;
            generatebutton.Sensitive = true;
            this.GdkWindow.Cursor    = new Gdk.Cursor(Gdk.CursorType.Arrow);
        }
                               );
    }
Exemplo n.º 5
0
        public static void Main(string[] args)
        {
            var file   = File.OpenRead("ARIAL.TTF");
            var reader = new FontReader();

            Font font;

            try
            {
                font = reader.Read(file);
            }
            catch (Exception ex)
            {
                throw;
            }

            var renderer = new FontRenderer(font);

            FontImage img;

            try
            {
                img = renderer.Render('b');
            }
            catch (Exception ex)
            {
                throw;
            }

            try
            {
                var ppm = img.Render();
                File.WriteAllBytes("out.ppm", ppm);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 6
0
        private void DrawCompassOrtho()
        {
            PushMatrixes();

            double size = 40;

            double vw = DC.ViewWidth;
            double vh = DC.ViewHeight;

            double cx = size / 2 + 24;
            double cy = size / 2 + 40;

            double left   = -cx;
            double right  = vw - cx;
            double top    = cy;
            double bottom = -(vh - cy);

            double arrowLen = 10;
            double arrowW2  = 5;

            Matrix4d prjm = Matrix4d.CreateOrthographicOffCenter(left, right, bottom, top, 100, 10000);

            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadMatrix(ref prjm);

            GL.MatrixMode(MatrixMode.Modelview);
            Vector3d lookAt = Vector3d.Zero;
            Vector3d eye    = -DC.ViewDir * 300;

            Matrix4d mdlm = Matrix4d.LookAt(eye, lookAt, DC.UpVector);

            GL.LoadMatrix(ref mdlm);

            Vector3d p0;
            Vector3d p1;

            GL.LineWidth(2);

            p0 = Vector3d.UnitX * -size;
            p1 = Vector3d.UnitX * size;
            DrawArrow(DC.GetPen(DrawTools.PEN_AXIS_X), p0, p1, ArrowTypes.CROSS, ArrowPos.END, arrowLen, arrowW2);

            p0 = Vector3d.UnitY * -size;
            p1 = Vector3d.UnitY * size;
            DrawArrow(DC.GetPen(DrawTools.PEN_AXIS_Y), p0, p1, ArrowTypes.CROSS, ArrowPos.END, arrowLen, arrowW2);

            p0 = Vector3d.UnitZ * -size;
            p1 = Vector3d.UnitZ * size;
            DrawArrow(DC.GetPen(DrawTools.PEN_AXIS_Z), p0, p1, ArrowTypes.CROSS, ArrowPos.END, arrowLen, arrowW2);

            GL.LineWidth(1);

            FontTex tex;

            Vector3d xv = CadMath.Normal(DC.ViewDir, DC.UpVector);
            Vector3d yv = CadMath.Normal(DC.ViewDir, DC.UpVector);
            double   fs = 0.6;

            tex = mFontFaceW.CreateTexture("X");
            p1  = Vector3d.UnitX * size;
            GL.Color4(DC.GetBrush(DrawTools.BRUSH_COMPASS_LABEL_X).Color4());
            mFontRenderer.Render(tex, p1, xv * tex.ImgW * fs, DC.UpVector * tex.ImgH * fs);

            tex = mFontFaceW.CreateTexture("Y");
            p1  = Vector3d.UnitY * size;
            GL.Color4(DC.GetBrush(DrawTools.BRUSH_COMPASS_LABEL_Y).Color4());
            mFontRenderer.Render(tex, p1, xv * tex.ImgW * fs, DC.UpVector * tex.ImgH * fs);

            tex = mFontFaceW.CreateTexture("Z");
            p1  = Vector3d.UnitZ * size;
            GL.Color4(DC.GetBrush(DrawTools.BRUSH_COMPASS_LABEL_Z).Color4());
            mFontRenderer.Render(tex, p1, xv * tex.ImgW * fs, DC.UpVector * tex.ImgH * fs);

            PopMatrixes();
        }