<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Игра с кнопкой]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=9017&amp;type=atom" />
	<updated>2013-12-17T16:22:20Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=9017</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Игра с кнопкой]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78221#p78221" />
			<content type="html"><![CDATA[<p>Думаю, что самый простенький пример, с &quot;гонением&quot; в одну сторону:<br /></p><div class="codebox"><pre><code>
Global r := 222
        , step := 12
        , angle := 225
        , hButton
        , IsEnable
 
CoordMode, Mouse, Client
OnMessage(0x200, &quot;WM_MOUSEMOVE&quot;)  
OnMessage(0x100, &quot;KEYDOWN&quot;), OnMessage(0x104, &quot;KEYDOWN&quot;)
OnMessage(0x101, &quot;KEYDOWN&quot;), OnMessage(0x105, &quot;KEYDOWN&quot;)
 
Gui, -DPIScale
Gui, Font, s22
Gui, Add, Button, vButton gButton hwndhButton w44 h44, % Chr(0x2639)
MoveCircle(angle) 
Gui, Show, w488 h488  
Return

KEYDOWN(w,l,m,h)   {  
    Static IsDown
    
    If ((m = 0x100 || m = 0x104) &amp;&amp; !IsDown ) 
        IsDown := 1  
    Else If (m = 0x101 || m = 0x105)
    {
        IsDown := 0 
        GuiControl, , Button, % (IsEnable := !IsEnable) ? Chr(0x263a) : Chr(0x2639) 
        ToolTip
    }  
} 

WM_MOUSEMOVE(w,l,m,h)   {  
    If (!IsEnable &amp;&amp; h = hButton) 
        UnderMouse() 
} 

UnderMouse()   {
    MouseGetPos, , , , hwnd, 2
    If (hwnd = hButton)
        MoveCircle(angle += step) 
}

MoveCircle(_angle) {    
    angle := _angle &gt; 360 ? Mod(_angle, 360) : _angle
    a := 0.0174532888888889 * angle
    GuiControl, Move, Button, % &quot;x&quot; Round(r+r*cos(a)) 
                                . &quot; y&quot; Round(r+r*sin(a))  
    UnderMouse() 
}

Button:
    If IsEnable
        ToolTip Button click 
    Return
</code></pre></div><p>Написано для собственного понимания получения координат на окружности, исходя из радиуса и градуса.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-12-17T16:22:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78221#p78221</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Игра с кнопкой]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78111#p78111" />
			<content type="html"><![CDATA[<p>Используйте команду <em>ControlMove</em> для сторонних приложений или <em>GUIControl, Move</em> для AutoHotkey GUI.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2013-12-14T14:22:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78111#p78111</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Игра с кнопкой]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=78110#p78110" />
			<content type="html"><![CDATA[<p>Может вы видели такие игры, к примеру &quot;поймай монету&quot;. Когда наводишь на эту монету мышкой и монета как бы убегает. В итоге её не поймать. Собственно мне нужно сделать такое с кнопкой.</p><p>Чтобы при наведении мышью на кнопку она меняла свои координаты по кругу, не давая нажать на неё. А если на клавиатуре нажать любую клавишу, то кнопка прекращает свои перемещения и становится доступной.</p>]]></content>
			<author>
				<name><![CDATA[Qweasd123]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31279</uri>
			</author>
			<updated>2013-12-14T13:54:03Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=78110#p78110</id>
		</entry>
</feed>
