Esempio n. 1
0
        protected void RenderBoxText(Viewport2D viewport, Coordinate boxStart, Coordinate boxEnd)
        {
            if (!Sledge.Settings.View.DrawBoxText)
            {
                return;
            }

            var widthText  = (Math.Round(boxEnd.X - boxStart.X, 1)).ToString("#.##");
            var heightText = (Math.Round(boxEnd.Y - boxStart.Y, 1)).ToString("#.##");

            var wid = _printer.Measure(widthText, _printerFont, new RectangleF(0, 0, viewport.Width, viewport.Height));
            var hei = _printer.Measure(heightText, _printerFont, new RectangleF(0, 0, viewport.Width, viewport.Height));

            boxStart = viewport.WorldToScreen(boxStart);
            boxEnd   = viewport.WorldToScreen(boxEnd);

            var cx = (float)(boxStart.X + (boxEnd.X - boxStart.X) / 2);
            var cy = (float)(boxStart.Y + (boxEnd.Y - boxStart.Y) / 2);

            var wrect = new RectangleF(cx - wid.BoundingBox.Width / 2, viewport.Height - (float)boxEnd.Y - _printerFont.Height - 18, wid.BoundingBox.Width * 1.2f, wid.BoundingBox.Height);
            var hrect = new RectangleF((float)boxEnd.X + 18, viewport.Height - cy - hei.BoundingBox.Height * 0.75f, hei.BoundingBox.Width * 1.2f, hei.BoundingBox.Height);

            GL.Disable(EnableCap.CullFace);

            _printer.Begin();
            _printer.Print(widthText, _printerFont, BoxColour, wrect);
            _printer.Print(heightText, _printerFont, BoxColour, hrect);
            _printer.End();

            GL.Enable(EnableCap.CullFace);
        }
Esempio n. 2
0
        private void DrawStringInScreenCoord(OpenTK.Graphics.TextPrinter printer, string text, Font font, Color c, float x, float y)
        {
            printer.Begin();

            GL.PushMatrix();
            GL.Translate(x, y, 0);

            printer.Print(text, font, c);

            GL.PopMatrix();

            printer.End();
        }
Esempio n. 3
0
 protected override void OnRenderFrame(FrameEventArgs e)
 {
     Settings.NumOfObjects = 0;
     GL.Clear(ClearBufferMask.DepthBufferBit);
     base.OnRenderFrame(e);
     cam.UpdateXZ();
     Frustum.CalculateFrustum();
     world.Render();
     Light.Disable();
     text.Begin();
     text.Print("Sprite get count: " + carinfo.getsprites, font, Color.White);
     text.End();
     Light.Enable();
     SwapBuffers();
 }
Esempio n. 4
0
        private void DrawStringInWorldCoord(OpenTK.Graphics.TextPrinter printer, string text, Font font, Color c, float x, float y)
        {
            printer.Begin();

            //GL.PopMatrix();
            //GL.Translate(x, y, 0);
            // GL.MatrixMode(MatrixMode.Modelview);

            //  OpenTK.Matrix4 lookat = OpenTK.Matrix4.LookAt(0, 5, 5, 0, 0, 0, 0, 1, 0);
            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadIdentity();
            GL.Rotate(angle, 0.0f, 1.0f, 0.0f);

            printer.Print(text, font, c);


            //GL.PushMatrix();

            printer.End();
        }