<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; Указатель направления Gdip_DrawLines]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=12356</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=12356&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Указатель направления Gdip_DrawLines».]]></description>
		<lastBuildDate>Wed, 25 Jan 2017 06:56:44 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Указатель направления Gdip_DrawLines]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=111530#p111530</link>
			<description><![CDATA[<p>Спасибо за подсказку реально стало легче.<br />С геометрией у меня не срослось поэтому координаты высчитывает так чтобы было похоже на направление.<br /></p><div class="codebox"><pre><code>SetWinDelay,0
SetBatchLines,-1
#Include gdip.ahk
gdipToken := Gdip_Startup()
Gui, 1: -Caption +E0x80000 +LastFound +OwnDialogs +HWNDlayer1 +ToolWindow +AlwaysOnTop
Gui, 1: Show, Na
WinSet, ExStyle, +0x80020
hbm := CreateDIBSection(A_ScreenWidth, A_ScreenHeight)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)
Gdip_SetInterpolationMode(G, 7)
Gdip_SetSmoothingMode(G, 5)

pPen := Gdip_CreatePen(0xfff000000, 10)
CoordMode, Mouse,Screen

PrevTime := A_TickCount
   OnExit, Exit
   hHookKeybd := DllCall(&quot;SetWindowsHookEx&quot;
      , Int, WH_MOUSE_LL := 14
      , Int, RegisterCallback(&quot;LowLevelMouseProc&quot;, &quot;Fast&quot;)
      , UInt, DllCall(&quot;GetModuleHandle&quot;, UInt, 0)
      , UInt, 0)
   Return
 
Exit:
   DllCall(&quot;UnhookWindowsHookEx&quot;, Uint, hHookKeybd)
   ExitApp
 
LowLevelMouseProc(nCode, wParam, lParam)
{
   global PrevTime
   Time := NumGet(lParam+0, 16)
   InactivityTime := Time - PrevTime
   if InactivityTime &gt; 10
   {
   
SetTimer, UpdateLayeredWindow, -1

      PrevTime := Time
   }
   Return DllCall(&quot;CallNextHookEx&quot;, UInt, 0, Int, nCode, UInt, wParam, UInt, lParam)
}
 

UpdateLayeredWindow:
Sleep 10
MouseGetPos, xm1,ym1,OutputVarWin

ym1 := (ym1-A_ScreenHeight/2)*1000
xm1 := (xm1-A_ScreenWidth/2)*1000

Gdip_GraphicsClear(G, 0x00ffffff)
Gdip_DrawLines(G, pPen , A_ScreenWidth/2 &quot;,&quot; A_ScreenHeight/2 &quot;|&quot; xm1 &quot;,&quot; ym1 )
UpdateLayeredWindow(layer1, hdc,0, 0, A_ScreenWidth, A_ScreenHeight,100)
Return


Escape::
Gdip_DeletePen(pPen) 
Gdip_DeletePen(pPenClear) 
Gdip_Shutdown(gdipToken)
ExitApp</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serge)]]></author>
			<pubDate>Wed, 25 Jan 2017 06:56:44 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=111530#p111530</guid>
		</item>
		<item>
			<title><![CDATA[Re: Указатель направления Gdip_DrawLines]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=111485#p111485</link>
			<description><![CDATA[<p><strong>serge</strong>, проблема в цикле без задержек (<em>Sleep</em>). Да ещё усугубляется командой <em>SetBatchLines,-1</em>. Лучше наверное установить мышиный хук, и по событию перемещения мышки уже производить действия. Про хук есть тема в Коллекции.</p><p>Вместо #Include gdip.ahk можно положить этот файл в папку с программой, он будет &quot;в библиотеке&quot;: <span class="bbu">C:\Program Files\AutoHotkey\Lib\Gdip.ahk</span>.</p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Tue, 24 Jan 2017 14:17:37 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=111485#p111485</guid>
		</item>
		<item>
			<title><![CDATA[Re: Указатель направления Gdip_DrawLines]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=111483#p111483</link>
			<description><![CDATA[<p>Как стирать шлейф сам разобрался.<br />Но заметил еще 1 проблему, этот скрипт ест 50% процессора.<br />Можно ли его как-нибудь оптимизировать?<br /></p><div class="codebox"><pre><code>SetWinDelay,0
SetBatchLines,-1
#Include gdip.ahk
Gdip_Startup()
Gui, 1: -Caption +E0x80000 +LastFound +OwnDialogs +HWNDlayer1 +ToolWindow +AlwaysOnTop
Gui, 1: Show, Na

hbm := CreateDIBSection(A_ScreenWidth, A_ScreenHeight)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)
Gdip_SetInterpolationMode(G, 7)
Gdip_SetSmoothingMode(G, 5)

pPen := Gdip_CreatePen(0xfff000000, 15)
CoordMode, Mouse,Screen
Loop 
{
MouseGetPos, xm1,ym1,OutputVarWin
ym1 := ym1*2-A_ScreenHeight/2
xm1 := xm1*2-A_ScreenWidth/2
Gdip_GraphicsClear(G, 0x00ffffff)
Gdip_DrawLines(G, pPen , A_ScreenWidth/2 &quot;,&quot; A_ScreenHeight/2 &quot;|&quot; xm1 &quot;,&quot; ym1 )
UpdateLayeredWindow(layer1, hdc,0, 0, A_ScreenWidth, A_ScreenHeight,100)
}
return

Escape::
Gdip_DeletePen(pPen) 
Gdip_DeletePen(pPenClear) 
ExitApp</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serge)]]></author>
			<pubDate>Tue, 24 Jan 2017 13:25:34 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=111483#p111483</guid>
		</item>
		<item>
			<title><![CDATA[Указатель направления Gdip_DrawLines]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=111463#p111463</link>
			<description><![CDATA[<p>Скрипт для онлайн игры <a href="http://diep.io/">diep.io</a>, при помощи gdip рисует на экране линию от цента к курсору.<br />Проблема в том что не получаеться полностью стереть старую линию, и в результате получаеться полупрозрачный белый шлейф.<br />Так же вопрос можно ли продлить эту линию до края экрана.<br /></p><div class="codebox"><pre><code>
SetWinDelay,0
SetBatchLines,-1
#Include gdip.ahk
Gdip_Startup()
Gui, 1: -Caption +E0x80000 +LastFound +OwnDialogs +HWNDlayer1 +ToolWindow +AlwaysOnTop
Gui, 1: Show, Na

hbm := CreateDIBSection(A_ScreenWidth, A_ScreenHeight)
hdc := CreateCompatibleDC()
obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc)
Gdip_SetInterpolationMode(G, 7)
Gdip_SetSmoothingMode(G, 5)

pPen := Gdip_CreatePen(0xfff000000, 15)
pPenClear := Gdip_CreatePen(0xfffffffff, 16)
CoordMode, Mouse,Screen
Loop 
{
Gdip_DrawLines(G, pPenClear , A_ScreenWidth/2 &quot;,&quot; A_ScreenHeight/2 &quot;|&quot; xm1 &quot;,&quot; ym1 )
MouseGetPos, xm1,ym1,OutputVarWin
Gdip_DrawLines(G, pPen , A_ScreenWidth/2 &quot;,&quot; A_ScreenHeight/2 &quot;|&quot; xm1 &quot;,&quot; ym1 )
UpdateLayeredWindow(layer1, hdc,0, 0, A_ScreenWidth, A_ScreenHeight,100)
}
return
Escape::
Gdip_DeletePen(pPen) 
Gdip_DeletePen(pPenClear) 
ExitApp
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serge)]]></author>
			<pubDate>Tue, 24 Jan 2017 07:10:06 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=111463#p111463</guid>
		</item>
	</channel>
</rss>
