Merge pull request #7 from IngCenter/DarkCat09-patch-1

Add files via upload
This commit is contained in:
Mikhail Abramov 2019-09-27 20:56:28 +04:00 committed by GitHub
commit b28b4bbe6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 14 deletions

View file

@ -3,6 +3,9 @@
using namespace std; using namespace std;
const COLORREF MY_LIGHTBLUE = RGB(75, 127, 196);
const COLORREF MY_BISQUE = RGB(255, 214, 89);
int middleX; int middleX;
int middleY; int middleY;
@ -15,15 +18,30 @@ struct Button {
HDC picture; HDC picture;
}; };
HDC block;
HDC quest;
HDC orange_but;
HDC green_but;
HDC blue_but;
HDC purple_but;
void background(COLORREF color); void background(COLORREF color);
void drawMenu(); void drawMenu();
void drawButton(Button but); void drawButton(Button but, bool picture);
void loadingAnimation(int delay); void loadingAnimation(int delay, int speed);
void mainFunc(); void mainFunc();
int main() int main()
{ {
txCreateWindow(1300, 600); txCreateWindow(1300, 600);
block = txLoadImage("pictures\\block.bmp");
quest = txLoadImage("pictures\\question.bmp");
orange_but = txLoadImage("pictures\\orange_but.bmp");
green_but = txLoadImage("pictures\\green_but.bmp");
blue_but = txLoadImage("pictures\\blue_but.bmp");
purple_but = txLoadImage("pictures\\purple_but.bmp");
middleX = txGetExtentX() / 2; middleX = txGetExtentX() / 2;
middleY = txGetExtentY() / 2; middleY = txGetExtentY() / 2;
extentX = txGetExtentX(); extentX = txGetExtentX();
@ -34,13 +52,27 @@ int main()
txBegin(); txBegin();
txSleep(50);
loadingAnimation(10);
txSleep(1000); txSleep(1000);
txSetColor(MY_LIGHTBLUE, 2);
txSetFillColor(TX_WHITE);
txRectangle(0, 0, extentX, extentY);
txSetColor(MY_LIGHTBLUE, 2);
txSetFillColor(MY_LIGHTBLUE);
txRectangle(0, 0, extentX, 50);
txSetColor(TX_BLACK, 3);
txSetFillColor(TX_WHITE);
txDrawText(0, 0, extentX, 50, "Êîíñòðóêòîð óðîâíåé èãðû FallSimulation");
drawMenu(); drawMenu();
txEnd(); txEnd();
txDeleteDC(block);
txDeleteDC(quest);
txDisableAutoPause(); txDisableAutoPause();
} }
@ -50,7 +82,7 @@ void background(COLORREF color)
txClear(); txClear();
} }
void drawButton(Button but) void drawButton(Button but, bool picture)
{ {
//drawing button //drawing button
txRectangle(but.coords.left, txRectangle(but.coords.left,
@ -84,11 +116,24 @@ void drawMenu()
}, "Exit" }, "Exit"
}; };
//button "Settings"
Button buttonSets = {
{
extentX - 100, 0,
extentX , 50
}, "Settings"
};
txSetColor(TX_BLACK, 3); txSetColor(TX_BLACK, 3);
txSetFillColor(TX_WHITE); txSetFillColor(TX_WHITE);
drawButton(buttonPlay); drawButton(buttonPlay, true);
drawButton(buttonExit); drawButton(buttonExit, true);
txSetColor(TX_BLACK, 3);
txSetFillColor(TX_TRANSPARENT);
drawButton(buttonSets, false);
txSleep(50); txSleep(50);
@ -98,10 +143,10 @@ void drawMenu()
txSleep(10); txSleep(10);
} }
loadingAnimation(18); loadingAnimation(15, 3);
txSleep(50); txSleep(50);
//txMessageBox("Çàïóñê èãðû ïîêà ÷òî íå ðàáîòàåò!", "Îøèáêà");
mainFunc(); mainFunc();
txMessageBox("Çàïóñê èãðû ïîêà ÷òî íå ðàáîòàåò!", "Îøèáêà");
} }
if (In(txMousePos(), buttonExit.coords) && txMouseButtons() & 1) { if (In(txMousePos(), buttonExit.coords) && txMouseButtons() & 1) {
while (txMouseButtons() & 1) { while (txMouseButtons() & 1) {
@ -110,16 +155,28 @@ void drawMenu()
break; break;
} }
if (In(txMousePos(), buttonSets.coords) && txMouseButtons() & 1) {
while(txMouseButtons() & 1) {
txSleep(10);
}
txSetColor(TX_BLACK, 3);
txSetFillColor(MY_BISQUE);
txRectangle(middleX - 200, middleY - 100, middleX + 200, middleY + 100);
}
txSleep(10);
} }
} }
void loadingAnimation(int delay) void loadingAnimation(int delay, int speed)
{ {
background(TX_WHITE); background(TX_WHITE);
for (int circle_radius = 0; for (int circle_radius = 0;
circle_radius * circle_radius < extentX * extentX + extentY * extentY; circle_radius * circle_radius < extentX * extentX + extentY * extentY;
circle_radius += 3) { circle_radius += speed) {
txSetColor(TX_BLACK, 2); txSetColor(TX_BLACK, 2);
txSetFillColor(TX_BLACK); txSetFillColor(TX_BLACK);
@ -134,9 +191,6 @@ void loadingAnimation(int delay)
void mainFunc() void mainFunc()
{ {
HDC block = txLoadImage("pictures\\block.bmp");
HDC quest = txLoadImage("pictures\\question.bmp");
txBitBlt(txDC(), extentX - 60, 0, 60, 60, block); txBitBlt(txDC(), extentX - 60, 0, 60, 60, block);
txBitBlt(txDC(), extentX - 60, 60, 60, 60, quest); txBitBlt(txDC(), extentX - 60, 60, 60, 60, quest);
} }

BIN
pictures/blue-but.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
pictures/green-but.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
pictures/orange-but.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
pictures/purple-but.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB