public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            const double aligned_pos = 0.58;

            base.Draw (gr, area_width, area_height, rtl);

            gr.SetPangoLargeFontSize ();
            gr.DrawTextAlignedRight (aligned_pos, DrawAreaY + 0.2, number_a.ToString ());
            gr.DrawTextAlignedRight (aligned_pos, DrawAreaY + 0.3, number_b.ToString ());
            gr.DrawTextAlignedRight (aligned_pos, DrawAreaY + 0.4, number_c.ToString ());

            gr.MoveTo (DrawAreaX + 0.2, DrawAreaY + 0.5);
            gr.LineTo (DrawAreaX + 0.5, DrawAreaY + 0.5);
            gr.Stroke ();

            gr.DrawTextAlignedRight (aligned_pos, DrawAreaY + 0.55, total.ToString ());

            gr.MoveTo (DrawAreaX + 0.2, DrawAreaY + 0.25);
            gr.ShowPangoText ((Answer.Draw == true) ? oper1.ToString () : "?");

            gr.MoveTo (DrawAreaX + 0.2, DrawAreaY + 0.35);
            gr.ShowPangoText ((Answer.Draw == true) ?  oper2.ToString () : "?");
        }
        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double operand_y = DrawAreaY + 0.2;
            const double operand_space = 0.1;
            const double aligned_pos = 0.58;

            base.Draw (gr, area_width, area_height, rtl);

            gr.SetPangoLargeFontSize ();
            for (int i = 0; i < operands.Length - 1; i++)
            {
                gr.DrawTextAlignedRight (aligned_pos, operand_y, operands[i].ToString ());
                gr.MoveTo (DrawAreaX + 0.2, operand_y + 0.03);

                switch (operation) {
                case Operation.Addition:
                    gr.ShowPangoText ("+");
                    break;
                case Operation.Subtraction:
                    gr.ShowPangoText ("-");
                    break;
                case Operation.Multiplication:
                    gr.ShowPangoText ("*");
                    break;
                }

                operand_y += operand_space;
            }

            gr.DrawTextAlignedRight (aligned_pos, operand_y, operands[operands.Length - 1].ToString ());

            operand_y += 0.08;
            gr.MoveTo (DrawAreaX + 0.2, operand_y);
            gr.LineTo (DrawAreaX + 0.5, operand_y);
            gr.Stroke ();

            if (Answer.Draw) {
                gr.DrawTextAlignedRight (aligned_pos, operand_y + 0.03, Answer.Correct);
            }
        }
示例#3
0
        void DrawColumnBarGraphic(CairoContextEx gr, double x, double y)
        {
            const double area_w = 0.85, area_h = 0.28;
            const double bar_w = 0.05, bar_h = area_h - 0.02;
            const double space_x = 0.08;

            gr.LineWidth = 0.005;

            // Draw X reference values
            gr.SetPangoFontSize (smaller_font);
            gr.DrawTextAlignedRight (x + 0.05, y, "100");
            gr.DrawTextAlignedRight (x + 0.05, y + area_h - 0.02, "0");

            x += 0.06;

            // Axis
            gr.MoveTo (x, y);
            gr.LineTo (x, y + area_h);
            gr.LineTo (x + area_w, y + area_h);
            gr.Stroke ();

            x = x + space_x;
            DrawBar (gr, x, y + area_h, bar_w, bar_h, session.History.TotalScore);
            gr.DrawTextCentered (x + bar_w / 2, y + area_h + 0.03, Translations.GetString ("Total"));

            x = x + space_x * 2;

            if (session.History.LogicPlayed > 0)
                DrawBar (gr, x, y + area_h, bar_w, bar_h, session.History.LogicScore);

            gr.DrawTextCentered (x + bar_w / 2, y + area_h + 0.03, Translations.GetString ("Logic"));

            x = x + space_x * 2;

            if (session.History.MathPlayed > 0)
                DrawBar (gr, x, y + area_h, bar_w, bar_h, session.History.MathScore);

            gr.DrawTextCentered (x + bar_w / 2, y + area_h + 0.03, Translations.GetString ("Calculation"));

            x = x + space_x * 2;

            if (session.History.MemoryPlayed > 0)
                DrawBar (gr, x, y + area_h, bar_w, bar_h, session.History.MemoryScore);

            gr.DrawTextCentered (x + bar_w / 2, y + area_h + 0.03, Translations.GetString ("Memory"));

            x = x + space_x * 2;

            if (session.History.VerbalPlayed > 0)
                DrawBar (gr, x, y + area_h, bar_w, bar_h, session.History.VerbalScore);

            gr.DrawTextCentered (x + bar_w / 2, y + area_h + 0.03, Translations.GetString ("Verbal"));
        }
示例#4
0
        public override void Draw(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            const double fraction_size = 0.17;
            double x =  0.5  - (fractions_num * fraction_size / 2), y = DrawAreaY + 0.3;
            const double offset_x = 0.12;

            base.Draw (gr, area_width, area_height, rtl);

            gr.SetPangoLargeFontSize ();

            for (int i = 0; i < fractions_num; i++)
            {
                // Numerator
                gr.DrawTextAlignedRight (x + offset_x, y, fractions[i].Numerator.ToString ());

                // Sign
                gr.MoveTo (x, y + 0.04);
                switch (fractions[i].Operation) {
                case Operation.Addition:
                    gr.ShowPangoText ("+");
                    break;
                case Operation.Subtraction:
                    gr.ShowPangoText ("-");
                    break;
                }
                gr.Stroke ();

                // Line
                gr.MoveTo (x + 0.05, y + 0.08);
                gr.LineTo (x + offset_x + 0.02,  y + 0.08);
                gr.Stroke ();

                // Denominator
                gr.DrawTextAlignedRight (x + offset_x, y + 0.1, fractions[i].Denominator.ToString ());

                x += fraction_size;
            }
        }
        void DrawGrid(CairoContextEx cr, double x, double y)
        {
            // Draw Axis
            cr.MoveTo (x, y);
            cr.LineTo (x, y + grid_height);
            cr.LineTo (x + grid_width, y + grid_height);
            cr.Stroke ();

            cr.Save ();
            cr.Color = axis_color;
            cr.LineWidth = 0.001;

            for (double line_y = y; line_y < grid_height + y; line_y += grid_height / 10) {
                cr.MoveTo (x, line_y);
                cr.LineTo (x + grid_width, line_y);
                cr.Stroke ();
            }

            cr.Restore ();

            // Draw score scale
            int pos = 100;
            for (double line_y = y; line_y < grid_height + y; line_y += grid_height / 10) {
                cr.DrawTextAlignedRight (x- 0.01, line_y, String.Format ("{0}", pos));
                pos -= 10;
            }
        }