示例#1
0
void Kot ()
    {

    HDC Kot  = txLoadImage ("Image//Кот.bmp");

    double x = random (XWindow / 2 + 300, XWindow / 2 - 300), y = random (YWindow / 2 - 300, YWindow / 2 + 300);
    double a = random (-300, 300), b = random (-300, 300);

    while (!GetAsyncKeyState (VK_ESCAPE))
        {
        txBegin ();
        txSetFillColor (TX_WHITE);
        txClear ();
        if (GetAsyncKeyState('A')) x-=2;
        if (GetAsyncKeyState('D')) x+=2;
        if (GetAsyncKeyState('W')) y-=2;
        if (GetAsyncKeyState('S')) y+=2;
        txTransparentBlt (txDC (), x, y, 92, 41, Kot, 0, 0, TX_WHITE);
        if (abs (x - x + a) > 35 + 10)txBitBlt (txDC (), x + a, y + b, 38, 20, Kot, 113, 10);
        if (x < 0) x = XWindow;
        if (x > XWindow) x = 0;
        if (y < 0) y = YWindow;
        if (y > YWindow) y = 0;

        txEnd ();
        }
    txDeleteDC (Kot);
    }
示例#2
0
void kart (CBall *Mol, HDC Molek)
    {
    txSetColor (RGB (random (25, 225), random (25, 225), random (25, 225)));
    txSetFillColor (RGB (random (25, 225), random (25, 225), random (25, 225)));
    //txCircle (Mol->x, Mol->y, Mol->rad);
    txTransparentBlt (txDC (), Mol->x - Mol->rad, Mol->y - Mol->rad, Mol->rad * 2, Mol->rad * 2, Molek, 0, 0, TX_WHITE);
    }
示例#3
0
void DrawKarta (int x0, int y0, int dx, int dy, char map [MASSLAYER][MASSSIZE][MASSSIZE], int layer, HDC FoodIMG, HDC WallIMG, HDC DoorIMG, HDC FloorIMG, HDC KnifIMG)
    {

    for (int y = 0; y < MASSSIZE; y++ )
        for (int x = 0; x < MASSSIZE; x++ )
            {
            if (map [layer][y][x] == SPACE) txBitBlt(txDC(), x0 + x * dx, y0 + y * dy, x0 + x * dx + SIZEB, y0 + y * dy + SIZEB, FloorIMG, 0, 0);
            if (map [layer][y][x] == WALL)  txBitBlt(txDC(), x0 + x * dx, y0 + y * dy, x0 + x * dx + SIZEB, y0 + y * dy + SIZEB, WallIMG, 0, 0);
            if (map [layer][y][x] == WIN)   block (x0 + x * dx, y0 + y * dy, TX_LIGHTBLUE);
			if (map [layer][y][x] == KNIFE) txBitBlt(txDC(), x0 + x * dx, y0 + y * dy, x0 + x * dx + SIZEB, y0 + y * dy + SIZEB, KnifIMG, 0, 0);
			if (map [layer][y][x] == NYAM)  txBitBlt(txDC(), x0 + x * dx, y0 + y * dy, x0 + x * dx + SIZEB, y0 + y * dy + SIZEB, FoodIMG, 0, 0);

            if (map [layer][y][x] == 'w'  ||
                map [layer][y][x] == 'v'  ||
                map [layer][y][x] == 'y'  ||
                map [layer][y][x] == 'z') txBitBlt(txDC(), x0 + x * dx, y0 + y * dy, x0 + x * dx + SIZEB, y0 + y * dy + SIZEB, FloorIMG, 0, 0);




            if (map [layer][y][x] == 'A' ||
                map [layer][y][x] == 'B' ||
                map [layer][y][x] == 'C')  txBitBlt(txDC(), x0 + x * dx, y0 + y * dy, x0 + x * dx + SIZEB, y0 + y * dy + SIZEB, DoorIMG, 0, 0);
            
            }
    }
int main ()
{
    int n = 0;

    SortingAlgorithm sortAlgArray[SORT_ALG_ARRAY_SIZE] =
    {
        SortingAlgorithm (         bubbleSort, { 12, 205,  90}, n++, Mode (0, 2)),
        SortingAlgorithm (      selectionSort, {205,  12,  90}, n++, Mode (0, 2)),
        SortingAlgorithm (      insertionSort, { 12,  90, 205}, n++, Mode (0, 2)),
        SortingAlgorithm (binaryInsertionSort, {112,  90, 155}, n++, Mode (0, 2))
    };

    Button buttonArray[BUTTON_ARRAY_SIZE] =
    {
        Button (Point (  0,   0),   0,  0, "BubbleSort"         ),
        Button (Point (  0,   0),   0,  0, "SelectionSort"      ),
        Button (Point (  0,   0),   0,  0, "InsertionSort"      ),
        Button (Point (  0,   0),   0,  0, "BinaryInsertionSort"),
        Button (Point (130, 405), 140, 30, "Now watching:"      ),
        Button (Point (  4, 367),  56, 26, "Play/Stop"          )
    };

    distributeButtons (buttonArray, BUTTON_ARRAY_SIZE, 4, Point (654, 140), Point (954, 440));

    Mode mode     = Mode(COMPS, 3),
    updateGraphic = Mode(    1, 2);

    _txWindowStyle &= ~WS_CAPTION;
    txCreateWindow (WIDTH, HEIGHT);
    txTextCursor (false);

    HDC background = txLoadImage ("sortTube.bmp");
    assert (background);

    while (!GetAsyncKeyState (VK_ESCAPE))
    {
        txBegin ();
        txBitBlt (txDC (), 0, 0, 960, 480, background);
        txClearConsole ();

        calculations (sortAlgArray, SORT_ALG_ARRAY_SIZE, buttonArray, BUTTON_ARRAY_SIZE, &mode, &updateGraphic);

        //rendering    (sortAlgArray, SORT_ALG_ARRAY_SIZE, buttonArray, BUTTON_ARRAY_SIZE,  mode);

        txEnd ();
        txSleep (1000/30);
    }

    txDeleteDC (background);

    return 0;
}
示例#5
0
void All_Vrag(CBall Ball[], HDC vrag, int dt, int sz)
    {
    int i = 1;

    while (i < sz)
        {
        txTransparentBlt (txDC (), Ball[i].x - Ball[i].rad, Ball[i].y - Ball[i].rad, 68, 74, vrag, 0, 0, TX_WHITE);
        i++;
        }

    i = 1;

    while (i < sz)
        {
        Ogranich_Comp (&Ball[i], dt);
        i++;
        }
    }
示例#6
0
void Snaryad_polnost (CBall* sn1, CBall* sn2, CBall* sn3, CBall* sn4, CBall* snbig1, CBall* snbig2, CBall* snBIGG, HDC snaryad1, HDC snaryad2, HDC snaryad3, const CBall Ball[], int dt)
    {
    snaryadi (*&sn1, Ball[0], dt);
    snaryadi (*&sn2, Ball[0], dt);
    snaryadi (*&sn3, Ball[0], dt);
    snaryadi (*&sn4, Ball[0], dt);
    snaryadi (*&snbig1, Ball[0], dt);
    snaryadi (*&snbig2, Ball[0], dt);
    snaryadi (*&snBIGG, Ball[0], dt);

    if (Dist (*snbig1, *snbig2) <= snbig1->rad + snbig2->rad)
        {
        txTransparentBlt (txDC(), snBIGG->x - snBIGG->rad, snBIGG->y - snBIGG->rad, 80, 80, snaryad3, 0, 0);
        }                                                                                                 //dddd
    else
        {
        if (Dist (*sn1, *sn2) <= sn1->rad + sn2->rad)
            {
            txTransparentBlt (txDC(), snbig1->x - snbig1->rad, snbig1->y - snbig1->rad, 40, 40, snaryad2, 0, 0);
            }
        else
            {
            txTransparentBlt (txDC(), sn1->x - sn1->rad, sn1->y - sn1->rad, 19, 20, snaryad1, 0, 0);
            txTransparentBlt (txDC(), sn2->x - sn2->rad, sn2->y - sn2->rad, 19, 20, snaryad1, 0, 0);
            }
        if (Dist (*sn3, *sn4) <= sn3->rad + sn4->rad)
            {
            txTransparentBlt (txDC(), snbig2->x - snbig2->rad, snbig2->y - snbig2->rad, 40, 40, snaryad2, 0, 0);
            }
        else
            {
            txTransparentBlt (txDC(), sn3->x - sn3->rad, sn3->y - sn3->rad, 19, 20, snaryad1, 0, 0);
            txTransparentBlt (txDC(), sn4->x - sn4->rad, sn4->y - sn4->rad, 19, 20, snaryad1, 0, 0);
            }
        }
    }
示例#7
0
void MoveShar ()
    {
    CBall Ball [6] = {{750, 400, 0, 0, 25, 3}};

    CBall sn1 = {0,    0,   5, 5, 8};
    CBall sn2 = {1500, 0,   5, 5, 8};
    CBall sn3 = {1500, 800, 5, 5, 8};
    CBall sn4 = {0,    800, 5, 5, 8};

    CBall snbig1 = {sn1.x, sn2.y, 5, 5, 16};
    CBall snbig2 = {sn3.x, sn4.y, 5, 5, 16};

    CBall snBIGG = {snbig1.x, snbig2.y, 5, 5, 32};

    double t = 0;
    double dt = 1;

    int N = 6;
    int i = 1;

    HDC vrag = txLoadImage ("vrag.bmp");
    HDC igrok = txLoadImage ("igrok.bmp");
    HDC fon = txLoadImage ("fon1.bmp");
    HDC snaryad1 = txLoadImage ("снаряд20.bmp");
    HDC snaryad2 = txLoadImage ("снаряд40.bmp");
    HDC snaryad3 = txLoadImage ("снаряд80.bmp");

    while (!GetAsyncKeyState(VK_ESCAPE))
        {
        txSetFillColor (TX_BLACK);
        txClear ();

        txBitBlt (txDC (), 0, 0, 1500, 800, fon, 0, 0);

        txTransparentBlt (txDC (), Ball[0].x - Ball[0].rad, Ball[0].y - Ball[0].rad, 50, 50, igrok, 0, 0, TX_WHITE);
        Upravlenie (&Ball[0], dt);

        //----------------Mass------------------
        while (i < N)
            {
            Ball[i].x = random (20, 1480);
            Ball[i].y = random (20, 780);
            Ball[i].vx = random (1.5, 3.5);
            Ball[i].vy = random (1.5, 3.5);
            Ball[i].rad = 30;
            i++;
            }

        All_Vrag (Ball, vrag, dt, N);

        i = 1;

        while (i < N)
        {
            if (Dist (Ball[i], Ball[0]) <= Ball[i].rad + Ball[0].rad)
                {
                txMessageBox ("Вы съедены!!!", "Поражение", 0);
                break;
                }
            i++;
        }

        //--------------Chit------------------------
        if (GetAsyncKeyState ('L'))
        {
        Stena (&Ball[0]);
        }
        else
            {
            if (Ball[0].x + Ball[0].rad > 1500 ||
                Ball[0].x - Ball[0].rad < 0    ||
                Ball[0].y + Ball[0].rad > 800  ||
                Ball[0].y - Ball[0].rad < 0    )
                {
                txMessageBox ("Вы задохнулись!!!", "Поражение", 0);
                break;
                }
            }

        //-----------Snaryadi-----------------------
        Snaryad_polnost (&sn1, &sn2, &sn3, &sn4, &snbig1, &snbig2, &snBIGG, snaryad1, snaryad2, snaryad3, &Ball[0], dt);

        if (Dist (sn1, Ball[0]) <= sn1.rad + Ball[0].rad ||
            Dist (sn2, Ball[0]) <= sn2.rad + Ball[0].rad ||
            Dist (sn3, Ball[0]) <= sn3.rad + Ball[0].rad ||
            Dist (sn4, Ball[0]) <= sn4.rad + Ball[0].rad ||
            Dist (snbig1, Ball[0]) <= snbig1.rad + Ball[0].rad ||
            Dist (snbig2, Ball[0]) <= snbig2.rad + Ball[0].rad ||
            Dist (snBIGG, Ball[0]) <= snBIGG.rad + Ball[0].rad )
                {
                txMessageBox ("Вы сгорели!!!", "Поражение", 0);
                break;
                }

        //-------------Pobeda------------
        t += 0.005;
        Score (t, 750, 20);

        if (t > 20)
            {
            txMessageBox ("Победа!!!", "Победа", 0);
            break;
            }
        //-------------------------------
        txSleep (0);
        }
    txDeleteDC (vrag);
    txDeleteDC (igrok);
    txDeleteDC (fon);
    txDeleteDC (snaryad1);
    txDeleteDC (snaryad2);
    txDeleteDC (snaryad3);
    }
示例#8
0
int DvigChel_1 (int x, int y)
{
     int time_end     = clock();

     Point_t loc      = {x, y};

     Score_t score    = {0};

     Chel_t chel      = {&loc, SPEED};

     Reaction_t react = {&loc, &score};

     PointEN_t locEN  = {291, 195, 5, 5};

     PointEN_t locEN2 = {500, 500, 1, 1};

     PointEN_t locEN3 = {400, 550, 4, 4};

     int time         = 0;

     int counter      = -2;

     int counteren    = 0;

     DrawLevel();

     HDC Cover        = txLoadImage ("Resourses\\Images\\Cover.bmp");

     txPlaySound ("Resourses\\Music\\track_1.wav", SND_ASYNC);

     DrawArbuz (386, 59);
     DrawArbuz (449, 269);
     DrawArbuz (95, 402);
     DrawArbuz (345, 449);
     DrawArbuz (723, 491);
     DrawArbuz (703, 294);

     while (1)
     {
        txBegin();

        DrawTimeTable();

        Interface      (&score, &time, &time_end);

        DrawWalls_1();

        Bonus (&score);

        txSetColor     (TX_YELLOW);
        txSetFillColor (TX_YELLOW);
        txRectangle    (locEN.x - 13, locEN.y - 13, locEN.x + 13, locEN.y + 13);

        MoveEnemy (&locEN);

        counteren++;

        if (counteren % 12 < 5) DrawEnemy_1 (&locEN);

        else
            if (counteren % 12 < 9) DrawEnemy_2 (&locEN);

            else DrawEnemy_3 (&locEN);

        if ((loc.x < locEN.x + 14) &&
            (loc.x > locEN.x - 12) &&
            (loc.y < locEN.y + 13) &&
            (loc.y > locEN.y - 12)) return 0;

        txSetColor     (TX_YELLOW);
        txSetFillColor (TX_YELLOW);
        txRectangle    (locEN2.x - 13, locEN2.y - 13, locEN2.x + 13, locEN2.y + 13);

        MoveEnemy (&locEN2);

        counteren++;

        if (counteren % 12 < 5) DrawEnemy_1 (&locEN2);

        else
            if (counteren % 12 < 9) DrawEnemy_2 (&locEN2);

            else DrawEnemy_3 (&locEN2);

        if ((loc.x < locEN2.x + 14) &&
            (loc.x > locEN2.x - 12) &&
            (loc.y < locEN2.y + 13) &&
            (loc.y > locEN2.y - 12)) return 0;

        txSetColor     (TX_YELLOW);
        txSetFillColor (TX_YELLOW);
        txRectangle    (locEN3.x - 13, locEN3.y - 13, locEN3.x + 13, locEN3.y + 13);

        MoveEnemy (&locEN3);

        counteren++;

        if (counteren % 12 < 5) DrawEnemy_1 (&locEN3);

        else
            if (counteren % 12 < 9) DrawEnemy_2 (&locEN3);

            else DrawEnemy_3 (&locEN3);

        if ((loc.x < locEN3.x + 14) &&
            (loc.x > locEN3.x - 12) &&
            (loc.y < locEN3.y + 13) &&
            (loc.y > locEN3.y - 12)) return 0;

        txTransparentBlt (txDC(), loc.x - 10, loc.y - 10, 21, 21, Cover, 0, 0, TX_WHITE);

        if (Controls (&react) == 1)   {DrawChel_1 (&loc); return 0;};

        if (ReactionEnd1 (&loc) == 1) 
                         {
                                if (score.points > 400) return score.points + 20 - time;
                         };
                         
        if (time > 40) return 0;

        counter++;

        if (counter > 2) counter = -2;

        if (counter < 0) DrawChel_1 (&loc);

           else DrawChel_2 (&loc);

		if (GetAsyncKeyState ('M')) sleep--;
		if (sleep < 0) sleep = 0;
        if (GetAsyncKeyState ('P')) sleep++;

        if (GetAsyncKeyState (VK_ESCAPE)) MenuInGame(&loc, 1);

        Sleep (sleep);
     }

     time_end = time;

     txDeleteDC (Cover);
}
示例#9
0
int main()
    {
    txCreateWindow(SX * 2, SY * 2);
    txTextCursor(false);
    SetWindowText(txWindow(), "Illusions");


    Illusions illus[ILLUSIONS] = {};

    HDC skins[ILLUSIONS] = {txLoadImage("WTF.bmp"),
                            txLoadImage("Cat.bmp"),
                            txLoadImage("Packman.bmp"),
                            txLoadImage("Spiral.bmp"),
                            txLoadImage("Sphere.bmp"),
                            txLoadImage("Figure.bmp"),
                            txLoadImage("DINOSOWER.bmp"),
                            txLoadImage("Packman2.bmp"),
                            txLoadImage("Cab.bmp"),
                            txLoadImage("Cab2.bmp"),
                            txLoadImage("Head.bmp"),
                            txLoadImage("6terna.bmp"),
                            txLoadImage("6terna4.bmp"),
                            txLoadImage("bike.bmp"),
                            txLoadImage("Ўарик.bmp"),
                            txLoadImage("fish.bmp"),
                            txLoadImage("kriper.bmp"),
                            txLoadImage("WTF2.bmp"),
                            txLoadImage("kub.bmp"),
                            txLoadImage("water.bmp"),
                            txLoadImage("serdce.bmp")};

    HDC transparent = txLoadImage("Transparent5.bmp");

    double x = -450, y = 25;

    for(int i = 0; i < ILLUSIONS; i++) illus[i].SetSkin(skins[i]);
    illus[0].show = true;

    while(!Key(27))
        {
        txBegin();
        txSetFillColor(TX_BLACK);
        txClear();

        for(int i = 0; i < ILLUSIONS; i++)
            {
            if(illus[i].show)
                {
                txBitBlt(txDC(), illus[i].x, illus[i].y, X_DEST * 2, Y_DEST * 2, illus[i].skin, 0, 0);
                if(Key('1'))
                    {
                    if(i > 0) illus[i].show = false, illus[i         - 1].show = true;
                    else      illus[i].show = false, illus[ILLUSIONS - 1].show = true;
                    }
                if(Key('2'))
                    {
                    if(i < ILLUSIONS - 1) illus[i].show = false, illus[i + 1].show = true;
                    else                  illus[i].show = false, illus[    0].show = true;
                    }

                while(Key('1') || Key('2')) txSleep (1);
                }
            }

        if(Key(VK_LEFT )) x -= 0.25;
        if(Key(VK_RIGHT)) x += 0.25;
        if(Key(VK_UP   )) y--;
        if(Key(VK_DOWN )) y++;

        txTransparentBlt(txDC(), x, y, X_DEST * 4, Y_DEST * 2, transparent, 0, 0, TX_WHITE);

        txEnd();
        }

    txDeleteDC(transparent);

    return 0;
    }