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

Add files via upload
This commit is contained in:
Mikhail Abramov 2019-09-30 22:24:58 +04:00 committed by GitHub
commit 03477fb0be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,6 +12,8 @@ int middleY;
int extentX; int extentX;
int extentY; int extentY;
bool gameIsStarted = false;
struct Button { struct Button {
RECT coords; RECT coords;
const char* text; const char* text;
@ -138,32 +140,35 @@ void drawMenu()
txSleep(50); txSleep(50);
while (!GetAsyncKeyState('Q')) { while (!GetAsyncKeyState('Q')) {
if (In(txMousePos(), buttonPlay.coords) && txMouseButtons() & 1) { if (!gameIsStarted) {
while (txMouseButtons() & 1) { if (In(txMousePos(), buttonPlay.coords) && txMouseButtons() & 1) {
txSleep(10); while (txMouseButtons() & 1) {
txSleep(10);
}
loadingAnimation(2, 3);
txSleep(50);
//txMessageBox("Çàïóñê èãðû ïîêà ÷òî íå ðàáîòàåò!", "Îøèáêà");
mainFunc();
} }
if (In(txMousePos(), buttonExit.coords) && txMouseButtons() & 1) {
while (txMouseButtons() & 1) {
txSleep(10);
}
loadingAnimation(15, 3); break;
txSleep(50);
//txMessageBox("Çàïóñê èãðû ïîêà ÷òî íå ðàáîòàåò!", "Îøèáêà");
mainFunc();
}
if (In(txMousePos(), buttonExit.coords) && txMouseButtons() & 1) {
while (txMouseButtons() & 1) {
txSleep(10);
} }
if (In(txMousePos(), buttonSets.coords) && txMouseButtons() & 1) {
while(txMouseButtons() & 1) {
txSleep(10);
}
break; txSetColor(TX_BLACK, 3);
} txSetFillColor(MY_BISQUE);
if (In(txMousePos(), buttonSets.coords) && txMouseButtons() & 1) {
while(txMouseButtons() & 1) { txRectangle(middleX - 200, middleY - 100, middleX + 200, middleY + 100);
txSleep(10); //code
} }
txSetColor(TX_BLACK, 3);
txSetFillColor(MY_BISQUE);
txRectangle(middleX - 200, middleY - 100, middleX + 200, middleY + 100);
} }
txSleep(10); txSleep(10);
@ -191,7 +196,53 @@ void loadingAnimation(int delay, int speed)
void mainFunc() void mainFunc()
{ {
txBitBlt(txDC(), extentX - 60, 0, 60, 60, block); gameIsStarted = true;
txBitBlt(txDC(), extentX - 60, 60, 60, 60, quest);
RECT blockBut = {
extentX - 60, 0, extentX, 60
};
RECT questBut = {
extentX - 60, 60, extentX, 120
};
bool clickedBlock = false;
bool clickedQuest = false;
while(!GetAsyncKeyState('Q'))
{
background(TX_WHITE);
txBitBlt(txDC(), extentX - 60, 0, 60, 60, block);
txBitBlt(txDC(), extentX - 60, 60, 60, 60, quest);
//block "block"
if (In(txMousePos(), blockBut) && txMouseButtons() & 1) {
clickedBlock = true;
}
if (txMouseButtons() & 1 && clickedBlock) {
txBitBlt(txDC(), txMouseX() - 30, txMouseY() - 30, 60, 60, block);
if (!(txMouseButtons() & 1)) {
txBitBlt(txDC(), txMouseX() - 30, txMouseY() - 30, 60, 60, block);
clickedBlock = false;
}
}
//block "quest"
if (In(txMousePos(), questBut) && txMouseButtons() & 1) {
clickedQuest = true;
}
if (txMouseButtons() & 1 && clickedQuest) {
txBitBlt(txDC(), txMouseX() - 30, txMouseY() - 30, 60, 60, quest);
if (!(txMouseButtons() & 1)) {
txBitBlt(txDC(), txMouseX() - 30, txMouseY() - 30, 60, 60, quest);
clickedQuest = false;
}
}
txSleep(10);
}
} }