Arfur9 Posted September 28, 2012 Posted September 28, 2012 (edited) I'm trying to do a hidden objects game and I have a problem were for a split second as the image changes I get a white area as the image hides/shows, is there anyway to stop this? this is the code I'm messing with expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Sound.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Form1", 800, 600, -1, -1) $img="Backgroundalley.jpg" $door ="door.jpg" $dooropen = "dooropen.jpg" $Pic1 = GUICtrlCreatePic($img, 0, 0, 800, 600) GUICtrlSetState($Pic1, $GUI_DISABLE) Local $aSound = _SoundOpen("machineClose.mp3") $Pic3 = GUICtrlCreatePic($dooropen, 142, 6, 299, 540) GUICtrlSetTip(-1, "Door") GUICtrlSetOnEvent(-1, "Pic2Click") GUICtrlSetState($Pic3,$GUI_HIDE) $Pic2 = GUICtrlCreatePic($door, 142, 6, 299, 540) GUICtrlSetTip(-1, "Door") GUICtrlSetOnEvent(-1, "Pic1Click") GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "mainClose") While 1 Sleep(100) WEnd Func mainClose() $ExitDialog = MsgBox(36, "Are You Sure?", "Are you sure you want to exit?") If $ExitDialog = 6 Then Exit Else Return EndIf EndFunc ;==>mainClose Func Pic1Click() Sleep( 111) GUICtrlSetState($Pic2, $GUI_HIDE) GUICtrlSetState($Pic3, $GUI_SHOW) ;_SoundPlay($aSound, 1) Return EndFunc Func Pic2Click() GUICtrlSetState($Pic3, $GUI_HIDE) Sleep( 1) GUICtrlSetState($Pic2, $GUI_SHOW) ;_SoundPlay($aSound, 1) Return EndFunc I've attached the images and filegame.zip Edited September 28, 2012 by Arfur9 My 3D Work
Colyn1337 Posted September 28, 2012 Posted September 28, 2012 In your pic1click function try doing the show command before the hide... In your second function you have a sleep(). Even tho you've put "1" there, it's actually going to sleep for 1000. Hope this helps.
czardas Posted September 28, 2012 Posted September 28, 2012 (edited) When you create your GUI, try using the Windows style $WS_EX_COMPOSITED. See if that stops the flickering. Edited September 28, 2012 by czardas FireFox 1 operator64 ArrayWorkshop
Arfur9 Posted September 29, 2012 Author Posted September 29, 2012 Thanks czardas that did the trick oh the sleep () was my vain attempt at stopping it amd wasn't really doing anything useful thanks for the help guys My 3D Work
czardas Posted September 30, 2012 Posted September 30, 2012 Cool! It's a trick I picked up off ProgAndy. operator64 ArrayWorkshop
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