From a60f1fbbf0ee7cb69f6829f3a72352cbd1948003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9?= <50486086+DarkCat09@users.noreply.github.com> Date: Fri, 20 Sep 2019 15:08:09 +0300 Subject: [PATCH] Add files via upload Edited main file. --- FallSimulation.cpp | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/FallSimulation.cpp b/FallSimulation.cpp index ba4fdad..e857987 100644 --- a/FallSimulation.cpp +++ b/FallSimulation.cpp @@ -1 +1,77 @@ #include +#include + +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; + } + } +} +