
maestro
Active Members-
Posts
76 -
Joined
-
Last visited
Everything posted by maestro
-
Bad flickering with GDI+ on refresh
maestro replied to maestro's topic in AutoIt General Help and Support
Awesome works perfect Thanks UEZ And for any one who many be interested, here's my new noflicker(thanks to UEZ) snake game: Snake Download. Ilmaestro. -
Bad flickering with GDI+ on refresh
maestro replied to maestro's topic in AutoIt General Help and Support
Still getting bad flashing, Here's my GUI creation section: $gdigui = GUICreate("<Snake> Score: "&$GUI_title, $guisize + 1, $guisize + 1, -1, -1,-1, $WS_EX_LAYERED) _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($gdigui) $hPen_On = _GDIPlus_PenCreate(0xFFFF0000, 1, 5) $hPen_Off = _GDIPlus_PenCreate(0xFF0000FF, 1, 5) $hPen_Think = _GDIPlus_PenCreate(0xFF00FF00, 1, 5) $Snake_Brush = _GDIPlus_BrushCreateSolid(0xFFFF0000) $Food_Brush = _GDIPlus_BrushCreateSolid(0xFF0000FF) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($guisize, $guisize, $hGraphic) $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2) _GDIPlus_GraphicsClear($hBackbuffer, 0xFFF0F0F0) GUISetState(@SW_SHOW) And Here's my redraw section: _GDIPlus_GraphicsClear($hBackbuffer, 0xFFF0F0F0) ;clears it just befor redrawing so it can draw with high accuracy _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $guisize, $guisize) _GDIPlus_GraphicsDrawLine($hGraphic,$iX* ($guisize / $resolution),$iY* ($guisize / $resolution),$FoodX* ($guisize / $resolution) + ($guisize / $resolution)/2,$FoodY* ($guisize / $resolution) + ($guisize / $resolution)/2,$hPen_Think) For $Y = 0 To $resolution-1 For $X = 0 To $resolution-1 If $array[$X][$Y] > 0 And $array[$X][$Y] < $value $array[$X][$Y] += 1 $solid_Cnt += 1 _GDIPlus_GraphicsFillRect($hBackbuffer, $X* ($guisize / $resolution),$Y* ($guisize / $resolution),($guisize / $resolution),($guisize / $resolution),$Snake_Brush) ElseIf $array[$X][$Y] = -100 Then _GDIPlus_GraphicsFillRect($hBackbuffer, $X* ($guisize / $resolution),$Y* ($guisize / $resolution),($guisize / $resolution),($guisize / $resolution),$Food_Brush) Else $array[$X][$Y] = 0 EndIf Next Next _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $guisize, $guisize) Thanks, Ilmaestro. -
Bad flickering with GDI+ on refresh
maestro replied to maestro's topic in AutoIt General Help and Support
Thanks for the Reply UEZ, however could you break down your example so I understand what is going on in it. I have just started playing around with GDI and am still un-sure of what alot of the stuff actually does. Also I have been doing the GDI clean up on exit, however why is it actually necessary? Oh and in what section of the script should i add this back buffer thing into, before of after the graphic gets cleared. Thanks, Ilmaestro. -
Hi, I am currently working on a project with GDI+ and am experiencing terrible flickering on upon refreshing the window, I have seen scripts that use GDI+ at high frame rate without flickering. I have looked through these scripts and am still unable to figure out what it is that keeps the GDI from flickering. This is one of the projects I am working on that is having this problem, its not so noticeable at a low score but as the snake gets bigger it flickers really bad. Snake game: Snake.exe Download Also if any one has any suggestions on how I could improve the game let me know. If size is an issue, its a quick fix this is how every thing scales: Global $guisize = 500 Global $resolution = 50 $resolution is how many squares across and down, and size is in px across and down. Thanks, Ilmaestro.
-
Cool thanks, Couldn't find an exact example but found some things that will work.
-
Thanks a tone, works great. I thought I was getting close Thanks, Ilmaestro.
-
Hey, is it possible to use GDI+ to "Skew" an image, i know you can load up an image that is a perfect rectangle, but I want to be able to create the image but at a skewed angle so for example the height of the right corner is not the same as the height of the left corner, or the length of one side is longer/shorter then other sides. Basically I've built a cube with GDI+ and I want to be able to apply textures to the sides by stretching images over them based on the corner points. Thanks, Ilmaestro.
-
Dunno if this will work for you, but you could make it create a box in the middle of the screen then expand out through a loop until it finds the pixel color your looking for. basically you would have a loop and then the pixel search, the x and y and height and width would be relative to the increment and the total image size. So you would need to calculate the pixel search box each time but it would allow you to "Focus" on a specific spot of the window before looking at a different spot. If you need it to be faster, make the iterations jump more then 1 pixel. Good luck, Ilmaestro.
-
Hi, this may be a strange request but I was wondering if its possible to make a transparent GUI have visible GDI. So far I have been able to make the GUI transparent but the drawn GDI is also transparent, when I set the GUI transparency to 10 then i can see the GUI and the GUI picture but its faint, is there any way to only show GDI drawings over everything else without showing the GUI? This is what I have so far. #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> #include <Process.au3> OnAutoItExitRegister("_OnExit") ;GUI SIZING Global $guisize = 1000 Global $resolution = 25 $gdigui = GUICreate("", $guisize + 1, $guisize + 1, 0, 0,-1, $WS_EX_LAYERED) GUISetBkColor(0x000000,$gdigui) GUISetState(@SW_SHOW) _WinAPI_SetLayeredWindowAttributes($gdigui, 0x000000,50) _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($gdigui) $hPen_On = _GDIPlus_PenCreate(0xFFFF0000, 1, 5) $hPen_Off = _GDIPlus_PenCreate(0xFF0000FF, 1, 5) _GDIPlus_GraphicsClear($hGraphic) ;clears it just befor redrawing so it can draw with high accuracy While 1 For $iY = 0 To $resolution-1 For $iX = 0 To $resolution-1 For $Y = 0 To $resolution-1 For $X = 0 To $resolution-1 If $X = $iX Or $Y = $iY Then Else $hPen_Think = _GDIPlus_PenCreate(0xFF&Hex(Random(0,376926741,1),6), 1, 5) _GDIPlus_GraphicsDrawLine($hGraphic,$iX* ($guisize / $resolution) + ($guisize / $resolution)/2,$iY* ($guisize / $resolution) + ($guisize / $resolution)/2,$X* ($guisize / $resolution) + ($guisize / $resolution)/2,$Y* ($guisize / $resolution) + ($guisize / $resolution)/2,$hPen_Think) _GDIPlus_PenDispose($hPen_Think) EndIf Next Next Next Next WEnd Func _OnExit() ;cleans up gdi on exit. _GDIPlus_PenDispose($hPen_On) _GDIPlus_PenDispose($hPen_Off) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>_OnExit Thanks, Ilmaestro.
-
Hi, thanks for the reply, I had a look through the topic, I could understand the theory behind it, however. I tried the example scripts shown, and it seemed the 2nd example was allot slower, now I'm not sure if it was supposed to be that way or not, that being said, its hard for me to see the purpose behind the dll call method when the basic au3 example was faster. I'll restate my question to try and clarify anything that may be misleading people. Is there any way to use the computers graphics processor to speed up the script, and if there isn't, is there any other way I can speed up the "getpixelcolor" function. (I would also like to state, THIS IS NOT FOR GAME PURPOSES, I am not making a bot or anything along thous lines. This will be used to modify the stream of a webcam[ each pixel in the camera display window needs to be scanned and kept up to date real time ].) And again, thank you Zedna for the reply, however I'm not sure that's what I'm looking for unless there is some sort of demonstration that can actually show me the speed increase on it or something along thous lines. Thanks, Ilmaestro.
-
Hi, I don't know if this topic has been covered or not,I personally couldn't find anything on it. Anyways, I am wondering if it is possible to use the GPU of the computer to help in processing. Right now I am working on an application that is a resource hog, and there's no other way around it for my needs, so i was wondering is there is any way to use the graphics processor to help speed up the program so I can do these calculations faster. (Right now I'm doing pixelgetcolor, and incrementing it in a 2d array, I changed it to windows basic so it would speed up, this helped quite a bit and increased its speed by around 90% however its still to slow.{ i need it to be real time, or very close}) If any one has any tips / advice, I would be more then happy to hear it.
-
The link didn't work for me, do you know any other good examples. Also, I have been able to convert an image to line binary, with all the info stored in a 2d array ( 1 or 0 ) with this information, I was wondering if you could give me a tip on how to process this for line detection, I dont seem to be making much progress after this point. Thanks, Ilmaestro.
-
OK so there are a couple ways you could do it, first off you could do a really basic one that just manually clicks the url, then enters the 0 then sends the enter key stroke. Another more discrete way would be to inject it directly into the url using a memory injection (would be probably hardest way). look up _IE in the help file, you can also make it do some cool stuff using the: #include <IE.au3> Thanks, Ilmaestro.
-
Block Keyboard but reciieve input
maestro replied to Arterie's topic in AutoIt General Help and Support
You could always use a "IF" statement, and do something like: If WinActive("title of your program window here") Then ;turn off block key input... Else ;block key input... EndIf Thanks, Ilmaestro. -
Can you not just stick the script in the "start-up" folder? and if this doesn't work, you can always write a registry key for it. Here is the 2 common ones: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run] [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run] Thanks, Ilmaestro.
-
there is always a way, however whats is the purpose, because there may be a better way to do what ever your trying to accomplish. Thanks, Ilmaestro.
-
Thanks anyways for your time jchd. This topic is still open to any one else who might have other possible solutions to the problem. Thanks, Ilmaestro.
-
Hi, thanks for the replys thus far. I guess im having trouble understanding Hough transforms, and there limitations. I have a high end i7 processor wich is almost always idol, so if there is a way to use more resources to give faster results, ide be more then happy to do that, as i have the 5870 graphics hard so my gpu is quite good as well. I have come up with some ideas to get realtime 2d arrays that i can store the values of the media, however Im having trouble implimenting the hough, would you be able to give me an example of code, or a more indepth description of the inner workings / theory behind one. ( it can be a slow example, I just want to see the mechanics of it, i had trouble following your "P Q" example. Thanks, Ilmaestro.
-
Well for now I was just going to use it for lines, and I was going to use it on web cam input. I have seen some videos that demonstrate real time line detection. And as far as my purpose behind it, its just more for my understanding / research at this point then it is for anything specific. (later down the road might try facial recognition) Thanks, Ilmaestro.
-
So lately I have been interested in Hough transformation, and am wondering first off if any one has been successful in making one in autoit, and secondly if any one knows of any good real time method changing live media to binary so I can run the calculation on the media so i would be able to display real-time output that highlights the lines / shapes i am making it look for. I found one thread a while back that demonstrates a script that can clone the appearance of windows using user32.dll and gdi32.dll dll calls, but I don't fully understand the mechanics behind it, and am unsure if this method would work or not for my purposes. Thanks, Ilmaestro.
-
Hi, so I am making a game, and so far have used sprites as the characters saved as .gif files with transparency, this works however when the character moves on screen, the transparency flickers, and changes between transparent and gray. I was looking around for alternatives, and a friend suggested GDI+ after looking into it I found very little in the way of tutorials etc. I did find a Mario game that used it, and it seemed quite well done, however it was far to complicated for me to follow. If some one can give other possible solutions, or simple GDI+ examples, i would be most thankful. Basically I just need to make a stick man, and be able to control the joints with GDI+, or what I am currently doing ( with little success) is just deleting and loading other images to show different stances. Thanks, Ilmaestro.
-
Is autoit able to read this (image) text?
maestro replied to Iforgotmyoldone's topic in AutoIt General Help and Support
First off, don't bump within 24 hours, and don't triple+ post, just edit the previous. So after reading your post: You are trying to read the image to get text back. Now the pictures you have supplied seem to be of a game, I am not sure the purpose of the program you are trying to make, however I suggest you read over THIS. Now back to the problem at hand,I take it you want to read the pictures "on the fly"( as soon as they pop up ). Anyways, if the text in the pictures changes when in any sort of program that it may be running from, there is always the option of using the Memory-Reading style of getting the information. This would give you real time data that can be stored as variables and used in any way you wish. For example, if you wanted to , you could display a GUI with all the data arranged in any way you wish. This would be 100% accurate(if done properly!) and constantly up to date. Best of luck, maestro. -
Multi-Origin vectors/triangles
maestro replied to maestro's topic in AutoIt General Help and Support
Hey, that's a really cool user interface, but can you simplify it, taking out the section i would need, I don't need the GUI or anything just the math section of it and explain it a little better. Thanks for the reply. -
Hi, I'm trying to make a graph calculator sort of thing that can take 2 points on a grid and find out what direction origin 2 is from origin 1. For example, you have a point at 50,50 and another point at -10,70 (this should be somewhere between 270 and 360 for this example) is there any way to have it fill into the graph, origin 2 is "X"degrees from origin 1. No I know you can take origin2 X and subtract it from origin1 X, and do the same for the Y's, but then you are always getting a -90 to 90 value, what I am looking for is something that can say for example if you wanted 210deg it would give you 210 rather then 30deg. Thanks, Ilmaestro.
-
So Problem !!!SOLVED!!! For anyone else having the same problem as I am, the Memgetbase UDF only works on 32bit OS. So for anyone using a 64bit OS, There is still hope out there!!! I Right clicked the script, and if you are on a 64bit os, click the (run script x86) And it should work! Here is code to get the value from CE tutorial 8. include <NomadMemory.au3> ;Global $hMemoryOpen,$hMemory,$FinalAddress,$Value ;This line most likely wont be needed Dim $Offset[5] = [0, Dec("C"), Dec(14), 0, Dec(18)] $hMemoryOpen = _OpenMemory("Tutorial.exe") $FinalAddress = _GetFinalAddress($hMemoryOpen,"60C20") $Value = _ReadFromPointer($FinalAddress,$hMemoryOpen,$Offset) MsgBox(0,"Data","Address: " & $Value[0] & @CRLF & "Value: " & $Value[1]) _MemoryClose($hMemoryOpen) Func _OpenMemory($sProcess) $aOpen = _MemoryOpen(ProcessExists($sProcess)) If $aOpen = 0 Then Switch @error Case 1 MsgBox(0, "Error", "Error opening Process: Process ID is invalid.") Case 2 MsgBox(0, "Error", "Error opening Process: Failed to open Kernel32.dll.") Case 3 MsgBox(0, "Error", "Error opening " & $aOpen & ".") EndSwitch Exit EndIf Return $aOpen EndFunc Func _GetFinalAddress($hMemory, $xStaticOffset) Local $iStaticOffset, $iBaseAddress $iBaseAddress = _MemoryGetBaseAddress($hMemory, 1) If $iBaseAddress = 0 Then Switch @error Case 1 MsgBox(0, "Error", "Error getting Base Address: Invalid Handle to open Process.") Case 2 MsgBox(0, "Error", "Error getting Base Address: Failed to find correct allocation Address.") Case 3 MsgBox(0, "Error", "Error getting Base Address: Failed to read from the specified Process.") EndSwitch Exit EndIf Return "0x" & Hex($iBaseAddress + Dec($xStaticOffset)) EndFunc Func _ReadFromPointer($xFinalAddress,$hMemory,$aOffset,$sType = "dword") Local $aRead $aRead = _MemoryPointerRead($xFinalAddress, $hMemory, $aOffset, $sType) If $aRead = 0 Then Switch @error Case 1 MsgBox(0, "Error", "Error reading Pointer: The specified Offset isn't an Array") Case 2 MsgBox(0, "Error", "Error reading Pointer: Invalid Handle to open Process.") Case 3 MsgBox(0, "Error", "Error reading Pointer: Type is not a String") Case 4 MsgBox(0, "Error", "Error reading Pointer: Type is unsupported or unknown") Case 5 MsgBox(0, "Error", "Error reading Pointer: Failed to allocate the memory needed for the DllStructure") Case 6 MsgBox(0, "Error", "Error reading Pointer: Failed to allocate the memory needed for " & $sType) Case 7 MsgBox(0, "Error", "Error reading Pointer: Failed to read from the specified Process") EndSwitch Exit Else Return $aRead EndIf EndFunc Thanks to Darkjohn20 for helping me through this what appeared to be impossible problem. I would alos like to thank majidemo for his assistance as well. Thanks, Ilmaestro.