From b0b003ea0479bd7491805fa2e3b38481cdd00ae2 Mon Sep 17 00:00:00 2001 From: AnfimovS <31889055+AnfimovS@users.noreply.github.com> Date: Tue, 27 Feb 2018 16:02:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BC=D0=B5=D1=80=20=D0=BC?= =?UTF-8?q?=D1=83=D0=BB=D1=8C=D1=82=D0=B0=20=D1=81=20=D1=82=D0=B0=D0=B9?= =?UTF-8?q?=D0=BC=D0=B5=D1=80=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Examples/timer.cpp | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 WindowsFormsApplication1/WindowsFormsApplication1/Examples/timer.cpp diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/Examples/timer.cpp b/WindowsFormsApplication1/WindowsFormsApplication1/Examples/timer.cpp new file mode 100644 index 0000000..45772b9 --- /dev/null +++ b/WindowsFormsApplication1/WindowsFormsApplication1/Examples/timer.cpp @@ -0,0 +1,45 @@ + +#include "TXLib.h" + +int main() +{ + txCreateWindow(800, 600); + + HDC texture = txLoadImage("Personaj.bmp"); + + double textureX = 50; + double textureY = 50; + double angle = 0; + double BeginTime = 3; + double EndTime = 10; + double Time = 0; + + while (!GetAsyncKeyState(VK_ESCAPE)) + { + txBegin(); + txSetColor(TX_WHITE); + txSetFillColor(TX_RED); + txRectangle(0, 0, txGetExtentX(), txGetExtentY()); + + if ((Time >= BeginTime) && (Time <= EndTime)) + { + angle++; + textureX = 500 + 200 * cos (angle / 10); + textureY = 300 + 200 * sin (angle / 10); + + txTransparentBlt(txDC(), textureX, textureY, 55, 86, texture, 0, 0, RGB(0, 255, 255)); + } + + txSleep(100); + Time = Time + 0.1; + + char str[100]; + sprintf(str, "%f", Time); + txTextOut(100, 100, str); + txEnd(); + } + + txDeleteDC(texture); + + return 0; +}