AlmarM Posted February 9, 2010 Share Posted February 9, 2010 Hi! A few questions about this: expandcollapse popup#include <GUIConstantsEx.au3> #include <Misc.au3> Global $y = 10 $GUI = GUICreate("Example", 500, 500) $Test1 = GUICtrlCreateGraphic(10, 10, 15, 100) GUICtrlSetGraphic($Test1, $GUI_GR_COLOR, 0xFF00FF, 0xFFFF00) GUICtrlSetGraphic($Test1, $GUI_GR_RECT, 10, 10, 15, 100) GUICtrlSetGraphic($Test1, $GUI_GR_CLOSE) GUICtrlSetGraphic($Test1, $GUI_GR_REFRESH) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit EndSwitch If (_IsPressed(26) Or _IsPressed(57)) Then $y -= 2 GUICtrlSetPos($Test1, 10, $y) EndIf If (_IsPressed(28) Or _IsPressed(53)) Then $y += 2 GUICtrlSetPos($Test1, 10, $y) EndIf Update() WEnd Func Update() GUICtrlSetGraphic($Test1, $GUI_GR_REFRESH) EndFunc *Use 'w, up, s, down' to control.* Q1: If you press W or S, you hear an anoyying sound because you are trying to typ W or S within a GUI. Any way to fix this? Q2: Because of the Update() function being executed so much, any way to stop making it flicker? (Mayby without a Sleep function) Q3: Is it me, or does my graphic moves realy fast something? (Try clicking in the GUI while moving it.) Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
FinalVersion Posted February 9, 2010 Share Posted February 9, 2010 Not to nit pick or anything, you should only use Arrows. Because when you hold a letter it pauses then speeds up. ( Don't know how else to explain that better ) [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 9, 2010 Share Posted February 9, 2010 A3: The answer is right there in the helpfile for GuiGetMsg():This function automatically idles the CPU when required so that it can be safely used in tight loops without hogging all the CPU.So when nothing happen it does a Sleep(10) or something like that, but when something do happen it ends lightning fast.Easiest way to fix would obviously be to move over to OnEventMode, where YOU are in control of "sleeping". .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
bogQ Posted February 9, 2010 Share Posted February 9, 2010 (edited) Q1 had the same problem on au3irr, when you use win that have any element on it it will make sound solution is to focuse on new gui that hold main gui like child that dont have any elements, and to reset focus on it every time when he lose focus or To make hotkey for every key that you use in it on empty func when main win is in focus or to make one trans 0 $WS_POPUP win over the main and change its position and state along with main win or to make it parent Q2 If (_IsPressed(26) Or _IsPressed(57)) Then $y -= 2 GUICtrlSetPos($Test1, 10, $y) Update() EndIf If (_IsPressed(28) Or _IsPressed(53)) Then $y += 2 GUICtrlSetPos($Test1, 10, $y) Update() EndIf Edited February 9, 2010 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
AlmarM Posted February 9, 2010 Author Share Posted February 9, 2010 Thanks everybody! I will try all giving answers ^^ Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. 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