void MoveShar ()
    {
    int x = 100, y = 100;
    int x1 = 1000, y1 = 700;
    int x2 = 500, y2 = 400;
    int x3 = 800, y3 = 400;
    int vx = 3, vy = 0;
    int vx1 = -3, vy1 = 0;
    int vx2 = 0, vy2 = 3;
    int vx3 = 0, vy3 = -3;
    int Xpr = 600, Ypr = 400;
    int Xpr1 = 400, Ypr1 = 600;
    int Xpr2 = 1200, Ypr2 = 450;
    int Xpr3 = 100, Ypr3 = 600;
    int Xpr4 = 300, Ypr4 = 300;
    double dt = 1;
    double v = 3, v1 = 3, v2 = 3, v3 = 3;
    double Diametr = 20;

    while (!GetAsyncKeyState(VK_ESCAPE))
        {
        if (!GetAsyncKeyState (VK_SPACE))
            {
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            }

        dt = dt + 0.001;
        Score (dt, 750, 50);
        txSetColor (TX_LIGHTRED);
        txSetFillColor (TX_LIGHTRED);
        txCircle (x, y, Diametr);
        txSetColor (TX_LIGHTGREEN);
        txSetFillColor (TX_LIGHTGREEN);
        txCircle (x1, y1, Diametr);
        txSetColor (TX_LIGHTBLUE);
        txSetFillColor (TX_LIGHTBLUE);
        txCircle (x2, y2, Diametr);
        txSetColor (TX_LIGHTMAGENTA);
        txSetFillColor (TX_LIGHTMAGENTA);
        txCircle (x3, y3, Diametr);
        Prepyatstvie (Xpr, Ypr);
        Prepyatstvie (Xpr1, Ypr1);
        Prepyatstvie (Xpr2, Ypr2);
        Prepyatstvie (Xpr3, Ypr3);
        Prepyatstvie (Xpr4, Ypr4);

        Sharik (&x, &y, &vx, &vy, &v, &dt, &Xpr, &Ypr, &Xpr1, &Ypr1, &Xpr2, &Ypr2, &Xpr3, &Ypr3, &Xpr4, &Ypr4);
        Sharik1 (&x1, &y1, &vx1, &vy1, &v1, &dt, &Xpr, &Ypr, &Xpr1, &Ypr1, &Xpr2, &Ypr2, &Xpr3, &Ypr3, &Xpr4, &Ypr4);
        Sharik2 (&x2, &y2, &vx2, &vy2, &v2, &dt, &Xpr, &Ypr, &Xpr1, &Ypr1, &Xpr2, &Ypr2, &Xpr3, &Ypr3, &Xpr4, &Ypr4);
        Sharik3 (&x3, &y3, &vx3, &vy3, &v3, &dt, &Xpr, &Ypr, &Xpr1, &Ypr1, &Xpr2, &Ypr2, &Xpr3, &Ypr3, &Xpr4, &Ypr4);
        //Chit (&v1);

        txSleep (3);
        }
    }
void print_palochka (palochka Main)
    {

    txSetFillColor (TX_GREEN);
    txSetColor     (TX_GREEN);
    txCircle (Main.x1, Main.y1, r);
    txCircle (Main.x2, Main.y2, r);
    txLine   (Main.x1, Main.y1, Main.x2, Main.y2);

    //txLine   (Main.x1, Main.y1, Main.x1 + Main.vx1*40, Main.y1 + Main.vy1*40);
    //txLine   (Main.x2, Main.y2, Main.x2 + Main.vx2*40, Main.y2 + Main.vy2*40);


    }
Esempio n. 3
0
void Circle3D (double x1, double y1, double z1, double r)
    {
    double x1_old = x1, y1_old = y1, z1_old = z1;

    y1 = z1_old * sin (A) + y1_old * cos (A);
    z1 = z1_old * cos (A) - y1_old * sin (A);

    y1_old = y1;
    z1_old = z1;

    y1 = x1_old * sin (B) + y1_old * cos (B);
    x1 = x1_old * cos (B) - y1_old * sin (B);

    x1_old = x1;

    z1 = x1_old * sin (C) + z1_old * cos (C);
    x1 = x1_old * cos (C) - z1_old * sin (C);

    x1 *= ZoomX;
    y1 *= ZoomY;
    z1 *= ZoomZ;

    x1 += xGlob;
    y1 += yGlob;
    z1 += zGlob;

    double zmin = -100;

    txCircle (x1/(z1 - zmin) + XWindow / 2, YWindow / 2 - y1/(z1 - zmin), r/(z1 - zmin));

    x1_old = x1;
    y1_old = y1;
    z1_old = z1;
    }
Esempio n. 4
0
void DrawMan()
    {
    txSetColor (TX_YELLOW);
    txSetFillColor (TX_YELLOW);
    txLine   (385, 135, 385, 120);
    txLine   (385, 135, 375, 150);
    txLine   (385, 135, 395, 150);
    txLine   (385, 125, 375, 135);
    txLine   (385, 125, 400, 120);
    txCircle (385, 115, 6);
    }
Esempio n. 5
0
void Manometr (int davlenie, int x, int y, COLORREF Color, const char * tekst)
    {
    txSetFillColor (TX_GREEN);
    txSetColor (TX_GREEN, 7);
    txRectangle (x + 25, y + 140, x - 25, y + 90);
    txSetFillColor (Color);
    txCircle (x, y, 95);

    char text [10] = "";
    sprintf (text, "%d", davlenie);
    txSelectFont ("Arial", 60, 17, false, false, true, false, 0);
    txTextOut (x - 40, y - 15, text);
    txSelectFont ("Arial", 30, 8, false, false, true, false, 0);
    txTextOut (x - 85, y - 40, tekst);
    }
Esempio n. 6
0
void Dvig_and_draw (C_Ball b [], int N)
{
    for (int i = 0; i < N; i++)
    {
        b[i].x += b[i].vx;
        b[i].y += b[i].vy;
    }

    for (int i = 0; i < N; i++)
    {
        if (b[i].x + b[i].r >= XWindow)
        {
            b[i].vx = -b[i].vx;
            b[i].x = XWindow - b[i].r;
            b[i].Red = 255;
        }
        if (b[i].x - b[i].r <= 0)
        {
            b[i].vx = -b[i].vx;
            b[i].x = b[i].r;
            b[i].Red = 255;
        }

        if (b[i].y + b[i].r >= YWindow)
        {
            b[i].vy = -b[i].vy;
            b[i].y = YWindow - b[i].r;
            b[i].Red = 255;
        }
        if (b[i].y - b[i].r <= 0)
        {
            b[i].vy = -b[i].vy;
            b[i].y = b[i].r;
            b[i].Red = 255;
        }

        if (b[i].Red - Dist (0, 0, b[i].vx, b[i].vy) / 3 > 0) b[i].Red -= Dist (0, 0, b[i].vx, b[i].vy) / 3;
        b[i].color = RGB (b[i].Red, 0, 255 - b[i].Red);

        txSetColor (b[i].color);
        txSetFillColor (b[i].color);
        txCircle (b[i].x, b[i].y, b[i].r);
    }

    Ottalkiv (N, b);
}
void DrawShar (int x, int y, int Diametr, COLORREF color)
    {
    txSetColor (color);
    txSetFillColor (color);
    txCircle (x, y, Diametr);
    }
Esempio n. 8
0
    void Draw ()
    {
        Point* now = vertexList;

        if (now && !now -> next)
        {
            if (now == lastVertex)
                {
                    txSetColor (CHOOSED_VERTEX_COLOR);
                    txSetFillColor (CHOOSED_VERTEX_COLOR);
                }
                else
                {
                    txSetColor (VERTEX_COLOR);
                    txSetFillColor (VERTEX_COLOR);
                }

                txCircle (now -> x, now -> y, radius);

            return;
        }

        while (now)
        {
            if (now -> prev)
            {
                txSetColor (MAIN_LINE_COLOR, radius * 2);
                txSetFillColor (MAIN_LINE_COLOR);
                txLine (now -> prev -> x, now -> prev -> y, now -> x, now -> y);

                txSetColor (CENTER_LINE_COLOR, 1);
                txSetFillColor (CENTER_LINE_COLOR);
                txLine (now -> prev -> x, now -> prev -> y, now -> x, now -> y);

                if (now == lastVertex)
                {
                    txSetColor (CHOOSED_VERTEX_COLOR);
                    txSetFillColor (CHOOSED_VERTEX_COLOR);
                }
                else
                {
                    txSetColor (VERTEX_COLOR);
                    txSetFillColor (VERTEX_COLOR);
                }

                txCircle (now -> x, now -> y, radius);

                if (now -> prev == lastVertex)
                {
                    txSetColor (CHOOSED_VERTEX_COLOR);
                    txSetFillColor (CHOOSED_VERTEX_COLOR);
                }
                else
                {
                    txSetColor (VERTEX_COLOR);
                    txSetFillColor (VERTEX_COLOR);
                }

                txCircle (now -> prev -> x, now -> prev -> y, radius);
            }

            now = now -> next;
        }
    }
Esempio n. 9
0
void MoveShar ()
    {
    double x = 100, y = 100;
    double vx = 0, vy = 0;
    double dt = 1;
    int Xpr = 600, Ypr = 400;
    int Xpr1 = 400, Ypr1 = 600;
    int Xpr2 = 1200, Ypr2 = 450;
    int Xpr3 = 100, Ypr3 = 600;
    int Xpr4 = 300, Ypr4 = 300;
    double v = 3;
    double Diametr = 20;
    double Heart = 5;

    while (!GetAsyncKeyState(VK_ESCAPE))
        {
        txSetColor (RGB(random (0, +255), random (0, +255), random (0, +255)));
        txSetFillColor (RGB(random (0, +255), random (0, +255), random (0, +255)));
        txCircle (x, y, Diametr);
        Prepyatstvie (Xpr, Ypr);
        Prepyatstvie (Xpr1, Ypr1);
        Prepyatstvie (Xpr2, Ypr2);
        Prepyatstvie (Xpr3, Ypr3);
        Prepyatstvie (Xpr4, Ypr4);
        Score (dt, 750, 50);
        Score (Heart, 550, 50);

        dt = dt + 0.001;
        x = x + vx * dt;
        y = y + vy * dt;

        if (x < 0)
            {
            vy = -10000;
            vx = -10000;
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            text ("Game Over!", 100, 200);
            }
        if (x > 1500)
            {
            vy = 10000;
            vx = 10000;
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            text ("Game Over!", 100, 200);
            }
        if (y > 800)
            {
            vy = 10000;
            vx = 10000;
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            text ("Game Over!", 100, 200);
            }
        if (y < 0)
            {
            vy = -10000;
            vx = -10000;
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            text ("Game Over!", 100, 200);
            }

        if (GetAsyncKeyState(VK_UP))
            {
            vx = 0;
            vy = -v;
            }
        if (GetAsyncKeyState(VK_LEFT))
            {
            vy = 0;
            vx = -v;
            }
        if (GetAsyncKeyState(VK_DOWN))
            {
            vx = 0;
            vy = v;
            }
        if (GetAsyncKeyState(VK_RIGHT))
            {
            vy = 0;
            vx = v;
            }

        if (-20 < Xpr - x and Xpr - x < 20 and -50 < Ypr - y and Ypr - y < 50)
            {
            Heart = Heart - 1;
            }
        if (-20 < Xpr3 - x and Xpr3 - x < 20 and -50 < Ypr3 - y and Ypr3 - y < 50)
            {
            Heart = Heart - 1;
            }
        if (-20 < Xpr2 - x and Xpr2 - x < 20 and -50 < Ypr2 - y and Ypr2 - y < 50)
            {
            Heart = Heart - 1;
            }
        if (-20 < Xpr1 - x and Xpr1 - x < 20 and -50 < Ypr1 - y and Ypr1 - y < 50)
            {
            Heart = Heart - 1;
            }
        if (-20 < Xpr4 - x and Xpr4 - x < 20 and -50 < Ypr4 - y and Ypr4 - y < 50)
            {
            Heart = Heart - 1;
            }

        if (GetAsyncKeyState (VK_SPACE))
            {
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            }
        if (GetAsyncKeyState ('L'))
            {
            v = 1;
            }

        if (Heart < 0)
            {
            vx = 0;
            vy = 0;
            txSetFillColor (TX_BLACK);
            txFloodFill (1600, 100);
            txClear ();
            text ("Game over!", 100, 200);
            }
        if (dt > 3)
            {
            Heart = Heart + 0.002;
            }

        txSleep (2);
        }
    }
Esempio n. 10
0
void circle (Stack* stk)
{
int x = stk->pop (), y = stk->pop (), r = stk->pop ();
txCircle (x, y, r);
}