myspacee Posted April 13, 2009 Share Posted April 13, 2009 I need help to build a script to write with my joypad.Idea is stolen from 'texter'that make possible a lot of possibilities:have some idea to how build script, but have low skill in coding.Now i post some (bad) GDI code to start :[need fix for flickering please]expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #Include <GDIPlus.au3> #Include <Misc.au3> ;----------------------------------------------var Global $gui, $guiPos, $pic, $picPos Global $f_sx_commander = 0 Local $msg $dll = DllOpen("user32.dll") ;---------------------------------------------- GUI $gui = GUICreate("whatistexter", 512, 256) $pic = GUICreate("", 512, 256, 0, @DesktopHeight - (@desktopheight - 360), $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $gui) GUICtrlCreatePic(@ScriptDir & "\wallpaper.bmp", 0, 0, 0, 0) WinSetOnTop("whatistexter", "", 1) GUISetState(@SW_SHOW, $pic) $picPos = WinGetPos($pic) $guiPos = WinGetPos($gui) ;---------------------------------------------- hotkey HotKeySet("{ESC}", "main") $picPos = WinGetPos($pic) $guiPos = WinGetPos($gui) ;---------------------------------------------- MAIN Do $msg = GUIGetMsg() ;---------------------------------------------- left If _IsPressed("64", $dll) Then ;~ MsgBox(0,"_IsPressed", " Numeric keypad 4 key");left my_left_square(675,850,25) ElseIf _IsPressed("66", $dll) Then ;~ MsgBox(0,"_IsPressed", " Numeric keypad 6 key");right my_left_square(825,850,25) ElseIf _IsPressed("62", $dll) Then ;~ MsgBox(0,"_IsPressed", " Numeric keypad 2 key");down my_left_square(750,925,25) ElseIf _IsPressed("68", $dll) Then ;~ MsgBox(0,"_IsPressed", " Numeric keypad 8 key");up my_left_square(750,780,25) ElseIf _IsPressed("67", $dll) Then ;~ MsgBox(0,"_IsPressed", " Numeric keypad 4 key");left-up my_left_square(675,800,25) ElseIf _IsPressed("69", $dll) Then ;~ MsgBox(0,"_IsPressed", " Numeric keypad 6 key");right-up my_left_square(825,800,25) ElseIf _IsPressed("61", $dll) Then ;~ MsgBox(0,"_IsPressed", " Numeric keypad 2 key");left-down my_left_square(675,925,25) ElseIf _IsPressed("63", $dll) Then ;~ MsgBox(0,"_IsPressed", " Numeric keypad 8 key");right-down my_left_square(825,925,25) Else my_left_square(750,850,25) EndIf ;---------------------------------------------- right If _IsPressed("41", $dll) Then my_left_square(450,850,25);a ElseIf _IsPressed("44", $dll) Then my_left_square(600,850,25);d ElseIf _IsPressed("58", $dll) Then my_left_square(525,925,25);x ElseIf _IsPressed("57", $dll) Then my_left_square(525,780,25);w ElseIf _IsPressed("51", $dll) Then my_left_square(450,800,25);q ElseIf _IsPressed("45", $dll) Then my_left_square(600,800,25);e ElseIf _IsPressed("5A", $dll) Then my_left_square(450,925,25);z ElseIf _IsPressed("43", $dll) Then my_left_square(600,925,25);c Else my_left_square(525,850,25) EndIf Sleep(10) Until $msg = $GUI_EVENT_CLOSE Func main() Exit EndFunc ;==>main func my_left_square($start_x, $start_y, $mylenght) _GDIPlus_Startup () $hDC = _WinAPI_GetWindowDC(0) $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC) $Color = 0xFF000000 $hPen = _GDIPlus_PenCreate($Color,2) _GDIPlus_GraphicsDrawLine($hGraphic, $start_x , $start_y, $start_x + $mylenght, $start_y, $hPen);oriz UP _GDIPlus_GraphicsDrawLine($hGraphic, $start_x + $mylenght, $start_y, $start_x + $mylenght, $start_y + $mylenght, $hPen);right _GDIPlus_GraphicsDrawLine($hGraphic, $start_x , $start_y + $mylenght, $start_x + $mylenght, $start_y + $mylenght, $hPen);oriz down _GDIPlus_GraphicsDrawLine($hGraphic, $start_x , $start_y, $start_x, $start_y + $mylenght, $hPen);left $Color += Hex(2) _GDIPlus_PenSetColor($hPen, $Color) Sleep(25) _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE+$RDW_ALLCHILDREN) _WinAPI_ReleaseDC(0, $hDC) _GDIPlus_Shutdown() $f_sx_commander = 0 EndFuncNext step is to study and add some joystick UDF see in example forum.Anyone want to partecipate and help me to realize this handy tool ?Thank you for your time,m. Link to comment Share on other sites More sharing options...
Zedna Posted April 13, 2009 Share Posted April 13, 2009 Search for my posts containing "flickering" ... It's using WM_PAINT and hidden memory DC Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
myspacee Posted April 14, 2009 Author Share Posted April 14, 2009 thank you for reply, i'm reading... Anyone find 'Texter' idea interesting ? m. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now