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,12 +140,13 @@ void drawMenu()
txSleep(50); txSleep(50);
while (!GetAsyncKeyState('Q')) { while (!GetAsyncKeyState('Q')) {
if (!gameIsStarted) {
if (In(txMousePos(), buttonPlay.coords) && txMouseButtons() & 1) { if (In(txMousePos(), buttonPlay.coords) && txMouseButtons() & 1) {
while (txMouseButtons() & 1) { while (txMouseButtons() & 1) {
txSleep(10); txSleep(10);
} }
loadingAnimation(15, 3); loadingAnimation(2, 3);
txSleep(50); txSleep(50);
//txMessageBox("Çàïóñê èãðû ïîêà ÷òî íå ðàáîòàåò!", "Îøèáêà"); //txMessageBox("Çàïóñê èãðû ïîêà ÷òî íå ðàáîòàåò!", "Îøèáêà");
mainFunc(); mainFunc();
@ -164,6 +167,8 @@ void drawMenu()
txSetFillColor(MY_BISQUE); txSetFillColor(MY_BISQUE);
txRectangle(middleX - 200, middleY - 100, middleX + 200, middleY + 100); txRectangle(middleX - 200, middleY - 100, middleX + 200, middleY + 100);
//code
}
} }
txSleep(10); txSleep(10);
@ -191,7 +196,53 @@ void loadingAnimation(int delay, int speed)
void mainFunc() void mainFunc()
{ {
gameIsStarted = true;
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, 0, 60, 60, block);
txBitBlt(txDC(), extentX - 60, 60, 60, 60, quest); 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);
}
} }