![]() |
TX Library Help – Version: 00173a, Revision: 171
PROJECT_BRIEF=
|
Работа с Мышью! | |
POINT | txMousePos () tx_nodiscard |
Возвращает позицию Мыши! | |
double | txMouseX () tx_nodiscard |
Возвращает X-Координату Мыши! | |
double | txMouseY () tx_nodiscard |
Возвращает Y-Координату Мыши! | |
unsigned | txMouseButtons () tx_nodiscard |
Возвращает состояние Кнопок Мыши! | |
Mouse & | txCatchMouse (bool shouldEat=true) |
Ловит Мышь! |
POINT txMousePos | ( | ) |
Возвращает позицию Мыши!
RECT area = { 100, 100, 110, 110 }; while (txMouseButtons() != 1) { if (In (txMousePos(), area)) txTextOut (100, 100, "http://vk.com/TiShtoTamDelaesh?!"); txSleep (0); }
double txMouseX | ( | ) |
Возвращает X-Координату Мыши!
while (txMouseButtons() != 1) { txCircle (txMouseX(), txMouseY(), 20); txSleep (0); }
double txMouseY | ( | ) |
Возвращает Y-Координату Мыши!
while (txMouseButtons() != 1) { txCircle (txMouseX(), txMouseY(), 20); txSleep (0); }
unsigned txMouseButtons | ( | ) |
Возвращает состояние Кнопок Мыши!
В возвращаемом значении выставленный в единицу 1-й (младший) бит означает нажатую левую Кнопку Мыши!, 2-й -- правую Кнопку.
Например, возвращенное число 3 (двоичное 11) означает одновременное нажатие левой и правой Кнопок.
0
. GetAsyncKeyState()
с аргументами VK_LBUTTON
, VK_RBUTTON
или VK_MBUTTON
. Старший бит 16-битового слова (битовая маска 0x8000
) покажет состояние соответствующей Кнопки Мыши! (см. пример).while (txMouseButtons() != 3) { if (txMouseButtons() & 1) txCircle (txMouseX(), txMouseY(), 20); if (txMouseButtons() & 2) txLine (txMouseX(), txMouseY(), 0, 0); if (GetAsyncKeyState (VK_LBUTTON) & 0x8000) printf ("VK_LBUTTON "); txSleep (0); }
Mouse& txCatchMouse | ( | bool | shouldEat = true | ) |
Ловит Мышь!
shouldEat | To eat, or not to eat: that is the question. |
=^..^=
void CatsLife() { try { while (true) { Mouse mouse = txCatchMouse(); Eat (mouse); txSleep(); } } catch (Mouse& mouse) { Eat (mouse); // Just do eat (R). Anyway } }