Sign in to follow this  
Followers 0
AlmarM

Few questions

5 posts in this topic

Hi!

A few questions about this:

#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.

Share this post


Link to post
Share on other sites



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".

Share this post


Link to post
Share on other sites

#4 ·  Posted (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

:D

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
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.

 

Share this post


Link to post
Share on other sites

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.

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