Sign in to follow this  
Followers 0
Uriziel01

Controls blinking, help needed :\

9 posts in this topic

Hi all ! I'm creating some game, and I'm using there a GuiCtrlSetPos() function to move my Graphic controls. But I having highly blinking also, is tehre any other function that i can use insteed of this ? Or is there any way to may the blinking less visible? :\

1) I cant change color of boxes (player declare them)

2)I cant make them move less, because this is game and all elements have to move smoothly and fast

3)I dont want to use GDI+

Can somebody help me :\

p.s-I include screenshot from ALPHA release, with moving boxes marked with Yellow color .

Posted Image


Share this post


Link to post
Share on other sites



ControlSetPos()

Share this post


Link to post
Share on other sites

Try to use ControlMove() instead, or use something like this:

#include <GuiConstantsEx.au3>

$GUI = GUICreate("Test Script", 300, 200)

$Label = GUICtrlCreateLabel("Label", 20, 40, 60, 20)

GUISetState(@SW_SHOW, $GUI)

While 1
    $nMsg = GUIGetMsg()
    
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    
    _GUICtrlSetPos($GUI, $Label, 20, 30, 60, 20)
    ;GUICtrlSetPos($Label, 20, 30, 60, 20) ;Just to compare
WEnd

Func _GUICtrlSetPos($hWnd, $iCtrlID, $iLeft, $iTop, $iWidth, $iHeight)
    Local $aOld_Pos = ControlGetPos($hWnd, "", $iCtrlID)
    If Not IsArray($aOld_Pos) Then Return GUICtrlSetPos($iCtrlID, $iLeft, $iTop, $iWidth, $iHeight)
    
    If $iLeft <> $aOld_Pos[0] Or $iTop <> $aOld_Pos[1] Or $iWidth <> $aOld_Pos[2] Or $iHeight <> $aOld_Pos[3] Then _
        Return GUICtrlSetPos($iCtrlID, $iLeft, $iTop, $iWidth, $iHeight)
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

ControlSetPos()

There is now such function as far as i remember/checked :)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Oops. That's what happens when you stay up till 1 AM running on cappuccino.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I have checked ControlMove() and it works ! But now im having other problem, when I move using this function control to new coordinates, I have 2 copies of the control, one on old coordinates and one one new. How to fix it ? :)

Posted Image

Edited by Uriziel01

Share this post


Link to post
Share on other sites

Is this some bug i new BETA ? Even in simple script function controlMove is making a copy of control before moving it !

CODE:

#include <GUIConstants.au3>
$child=GUICreate("My Draw")
$a=GuiCtrlCreateGraphic(20, 50, 100,100)
GUICtrlSetBkColor(-1,0xffffff)
GUICtrlSetColor(-1,0)
GuiSetState()
local $X
Do
    $msg = GUIGetMsg()
sleep(55)
$X+=1
ControlMove("My Draw","",$a,$X,100)
Until $msg=$GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites

Is this some bug i new BETA ? Even in simple script function controlMove is making a copy of control before moving it !

I am not sure what is the problem, but it's somehow Graphic-specific. You can use Label instead...

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hChild = GUICreate("My Draw")
GUISetBkColor(0)

$Graphic = GUICtrlCreateLabel("", 20, 50, 100, 100, -1, $WS_EX_CLIENTEDGE+$WS_EX_DLGMODALFRAME)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetColor(-1, 0)
GuiSetState()

Dim $x

While GUIGetMsg() <> $GUI_EVENT_CLOSE
    Sleep(10)
    $x += 0.2
    
    ControlMove($hChild, "", $Graphic, $x, 100)
WEnd

If you still want to use Graphic control, my previous function (_GUICtrlSetPos()) works here, but the flickering is still there...


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Your prevoius script gives me nothing, Im already checking is there a move or not. :P Is there a good idea to create a ticket for this as a bug ? :P

p.s-Thx for all responses :)

Edited by Uriziel01

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0