Merge pull request #4 from IngCenter/DarkCat09-patch-2

Add files via upload
This commit is contained in:
Mikhail Abramov 2019-09-20 22:14:30 +03:00 committed by GitHub
commit bd6c0af022
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1 +1,77 @@
#include <TXLib.h> #include <TXLib.h>
#include <iostream>
using namespace std;
int middleX;
int middleY;
int extentX;
int extentY;
void background(COLORREF color);
void drawMenu();
int main()
{
txCreateWindow(1300, 600);
middleX = txGetExtentX() / 2;
middleY = txGetExtentY() / 2;
extentX = txGetExtentX();
extentY = txGetExtentY();
background(TX_WHITE);
txSleep(50);
txBegin();
drawMenu();
txEnd();
txDisableAutoPause();
}
void background(COLORREF color)
{
txSetFillColor(color);
txClear();
}
void drawMenu()
{
RECT buttonPlay {
middleX - 100, extentY / 3 - 50,
middleX + 100, extentY / 3 + 50
};
RECT buttonExit {
middleX - 100, extentY / 2 - 50,
middleX + 100, extentY / 2 + 50
};
txSetColor(TX_BLACK, 3);
txSetFillColor(TX_WHITE);
txRectangle(buttonPlay.right, buttonPlay.top, buttonPlay.left, buttonPlay.bottom);
txRectangle(buttonExit.right, buttonExit.top, buttonExit.left, buttonExit.bottom);
txSleep(50);
while (!GetAsyncKeyState('Q')) {
if (In(txMousePos(), buttonPlay) && txMouseButtons() & 1) {
while (txMouseButtons() & 1) {
txSleep(10);
}
txMessageBox("Çàïóñê èãðû ïîêà ÷òî íå ðàáîòàåò!", "Îøèáêà");
}
if (In(txMousePos(), buttonExit) && txMouseButtons() & 1) {
while (txMouseButtons() & 1) {
txSleep(10);
}
break;
}
}
}