Merge pull request #6 from IngCenter/DarkCat09-patch-1
Add files via upload
This commit is contained in:
commit
e98aa634fd
3 changed files with 76 additions and 10 deletions
|
@ -9,8 +9,17 @@ int middleY;
|
|||
int extentX;
|
||||
int extentY;
|
||||
|
||||
struct Button {
|
||||
RECT coords;
|
||||
const char* text;
|
||||
HDC picture;
|
||||
};
|
||||
|
||||
void background(COLORREF color);
|
||||
void drawMenu();
|
||||
void drawButton(Button but);
|
||||
void loadingAnimation(int delay);
|
||||
void mainFunc();
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -25,6 +34,9 @@ int main()
|
|||
|
||||
txBegin();
|
||||
|
||||
txSleep(50);
|
||||
loadingAnimation(10);
|
||||
txSleep(1000);
|
||||
drawMenu();
|
||||
|
||||
txEnd();
|
||||
|
@ -38,34 +50,60 @@ void background(COLORREF color)
|
|||
txClear();
|
||||
}
|
||||
|
||||
void drawButton(Button but)
|
||||
{
|
||||
//drawing button
|
||||
txRectangle(but.coords.left,
|
||||
but.coords.top,
|
||||
but.coords.right,
|
||||
but.coords.bottom);
|
||||
|
||||
//drawing text
|
||||
txDrawText (but.coords.left,
|
||||
but.coords.top,
|
||||
but.coords.right,
|
||||
but.coords.bottom,
|
||||
but.text);
|
||||
}
|
||||
|
||||
void drawMenu()
|
||||
{
|
||||
RECT buttonPlay {
|
||||
middleX - 100, extentY / 3 - 50,
|
||||
middleX + 100, extentY / 3 + 50
|
||||
//button "Play"
|
||||
Button buttonPlay = {
|
||||
{
|
||||
middleX - 100, extentY / 3 - 50,
|
||||
middleX + 100, extentY / 3 + 50
|
||||
}, "Play"
|
||||
};
|
||||
|
||||
RECT buttonExit {
|
||||
middleX - 100, extentY / 2 - 50,
|
||||
middleX + 100, extentY / 2 + 50
|
||||
//button "Exit"
|
||||
Button buttonExit = {
|
||||
{
|
||||
middleX - 100, extentY / 2 - 50,
|
||||
middleX + 100, extentY / 2 + 50
|
||||
}, "Exit"
|
||||
};
|
||||
|
||||
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);
|
||||
drawButton(buttonPlay);
|
||||
drawButton(buttonExit);
|
||||
|
||||
txSleep(50);
|
||||
|
||||
while (!GetAsyncKeyState('Q')) {
|
||||
if (In(txMousePos(), buttonPlay) && txMouseButtons() & 1) {
|
||||
if (In(txMousePos(), buttonPlay.coords) && txMouseButtons() & 1) {
|
||||
while (txMouseButtons() & 1) {
|
||||
txSleep(10);
|
||||
}
|
||||
|
||||
loadingAnimation(18);
|
||||
txSleep(50);
|
||||
mainFunc();
|
||||
txMessageBox("Çàïóñê èãðû ïîêà ÷òî íå ðàáîòàåò!", "Îøèáêà");
|
||||
}
|
||||
if (In(txMousePos(), buttonExit) && txMouseButtons() & 1) {
|
||||
if (In(txMousePos(), buttonExit.coords) && txMouseButtons() & 1) {
|
||||
while (txMouseButtons() & 1) {
|
||||
txSleep(10);
|
||||
}
|
||||
|
@ -75,3 +113,31 @@ void drawMenu()
|
|||
}
|
||||
}
|
||||
|
||||
void loadingAnimation(int delay)
|
||||
{
|
||||
background(TX_WHITE);
|
||||
|
||||
for (int circle_radius = 0;
|
||||
circle_radius * circle_radius < extentX * extentX + extentY * extentY;
|
||||
circle_radius += 3) {
|
||||
|
||||
txSetColor(TX_BLACK, 2);
|
||||
txSetFillColor(TX_BLACK);
|
||||
|
||||
txCircle(0, 0, circle_radius);
|
||||
|
||||
txSleep(delay);
|
||||
}
|
||||
|
||||
background(TX_WHITE);
|
||||
}
|
||||
|
||||
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, 60, 60, 60, quest);
|
||||
}
|
||||
|
||||
|
|
BIN
pictures/block.bmp
Normal file
BIN
pictures/block.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
pictures/question.bmp
Normal file
BIN
pictures/question.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
Loading…
Add table
Reference in a new issue