Jump to content
Sign in to follow this  
xan

Smartphones code

Recommended Posts

xan

A simple code make in Autoit

  files   https://www.4shared.com/get/TixvzsqSce/code.html

#include<includes.au3>

$gui = GUICreate("",680,720,-1,-1,$WS_POPUP)
       GUISetBkColor(0x7E7E7E)
       GUISetState()
$cod = GUICtrlCreateLabel("Code:", 0, 630,680,30,$SS_CENTER)
       GUICtrlSetFont(-1,20,800)
       GUICtrlSetState(-1, $GUI_DISABLE )
$bext= GUICtrlCreateButton("SAIR",240,670,200,40)
       GUICtrlSetBkColor(-1, $COR_PRETO)
       GUICtrlSetColor(-1, $COR_BRANCO)
       GUICtrlSetFont(-1,20,800)
Local $bt[3][3], $btpos[3][3][2], $x = 1, $y = 0, $ncode = 9,$foto[6],$clk
        _GDIPlus_Startup()
$ref  = _GDIPlus_GraphicsCreateFromHWND($gui)
For $i = 0 To 2
    For $j = 0 to 2
        If $i < 2 Then $foto[$i*3+$j] = _GDIPlus_ImageLoadFromFile($i*3+$j & ".png")
        $btpos[$i][$j][$y] = $i * 220 + 5
        $btpos[$i][$j][$x] = $j * 220 + 45
        $bt[$i][$j] = GUICtrlCreatePic("6.bmp",$btpos[$i][$j][$x],$btpos[$i][$j][$y],150,150)
    Next
Next

Local $msg = GUIGetMsg()
While 1
    $msg = GUIGetMsg()
    If $msg = -3 Or $msg = $bext Then Exit
    If _IsPressed(1) Then
        If Not $clk Then
            bot()
            $clk = 1
        EndIf
    Else
        $clk = 0
    EndIf
WEnd

Func bot()
    Local $xy[2],$l,$c=1, $n = 9, $code,$nmsg, $msg = GUIGetMsg()
    $xy[0] = 9
    $xy[1] = 9
    If $msg = -3 Or $msg = $bext Then Exit
    For $j = 0 To 2
        For $i = 0 to 2
            If $msg = $bt[$i][$j] Then
                $xy[$l] = $i
                $xy[$c] = $j
                _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$i][$j][$x],$btpos[$i][$j][$y],150,150)
                While _IsPressed(1)
                    $msg = GUIGetMsg(1)
                    Select
                        case $xy[$c] < 2 And $msg[3] > $btpos[$xy[$l]][$xy[$c]][$x] + 260 And $msg[4] <= $btpos[$xy[$l]][$xy[$c]][$y] + 110 and $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y]
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]][$xy[$c]+1][$x],$btpos[$xy[$l]][$xy[$c]+1][$y],150,150)            ; ->
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[1],$btpos[$xy[$l]][$xy[$c]][$x]+143,$btpos[$xy[$l]][$xy[$c]][$y]+55,80,40)
                            $xy[$c] += 1
                        case  $xy[$l] < 2 And  $xy[$c] < 2 And $msg[3] > $btpos[$xy[$l]][$xy[$c]][$x] + 260 And $msg[4] <= $btpos[$xy[$l]][$xy[$c]][$y] + 410 and $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y] + 260
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]+1][$xy[$c]+1][$x],$btpos[$xy[$l]+1][$xy[$c]+1][$y],150,150)      ; ->  v
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[3],$btpos[$xy[$l]][$xy[$c]][$x]+113,$btpos[$xy[$l]][$xy[$c]][$y]+120,142,132)
                            $xy[$c] += 1
                            $xy[$l] += 1
                        case  $xy[$l] > 0 And  $xy[$c] < 2 And $msg[3] > $btpos[$xy[$l]][$xy[$c]][$x] + 260 And $msg[4] <= $btpos[$xy[$l]][$xy[$c]][$y] - 110 and $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y] - 260
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]-1][$xy[$c]+1][$x],$btpos[$xy[$l]-1][$xy[$c]+1][$y],150,150)       ; ->  ^
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[4],$btpos[$xy[$l]][$xy[$c]][$x]+113,$btpos[$xy[$l]][$xy[$c]][$y]-100,142,132)
                            $xy[$c] += 1
                            $xy[$l] -= 1
                        case $xy[$c] > 0 And $msg[3] And $msg[3] <= $btpos[$xy[$l]][$xy[$c]][$x] - 110 And $msg[4] <= $btpos[$xy[$l]][$xy[$c]][$y] + 110 and $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y]
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]][$xy[$c]-1][$x],$btpos[$xy[$l]][$xy[$c]-1][$y],150,150)        ; <-
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[1],$btpos[$xy[$l]][$xy[$c]][$x]-76,$btpos[$xy[$l]][$xy[$c]][$y]+55,80,40)
                            $xy[$c] -= 1
                        case  $xy[$l] < 2 And  $xy[$c] > 0 And $msg[3] And $msg[3] <= $btpos[$xy[$l]][$xy[$c]][$x] - 110 And $msg[4] <= $btpos[$xy[$l]][$xy[$c]][$y] + 410 and $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y] + 260
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]+1][$xy[$c]-1][$x],$btpos[$xy[$l]+1][$xy[$c]-1][$y],150,150)        ; <- v
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[4],$btpos[$xy[$l]][$xy[$c]][$x]-108,$btpos[$xy[$l]][$xy[$c]][$y]+120,142,132)
                            $xy[$c] -= 1
                            $xy[$l] += 1
                        case  $xy[$l] > 0 And  $xy[$c] > 0 And $msg[3] And $msg[3] <= $btpos[$xy[$l]][$xy[$c]][$x] - 110 And $msg[4] <= $btpos[$xy[$l]][$xy[$c]][$y] - 110 and $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y] - 260
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]-1][$xy[$c]-1][$x],$btpos[$xy[$l]-1][$xy[$c]-1][$y],150,150)  ; ^ <-
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[3],$btpos[$xy[$l]][$xy[$c]][$x]-108,$btpos[$xy[$l]][$xy[$c]][$y]-100,142,132)
                            $xy[$c] -= 1
                            $xy[$l] -= 1
                        case  $xy[$l] < 2 And $msg[3] >= $btpos[$xy[$l]][$xy[$c]][$x] And $msg[3] < $btpos[$xy[$l]][$xy[$c]][$x] + 110 And $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y] + 260 and $msg[4] < $btpos[$xy[$l]][$xy[$c]][$y] + 330
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]+1][$xy[$c]][$x],$btpos[$xy[$l]+1][$xy[$c]][$y],150,150)   ; v
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[2],$btpos[$xy[$l]][$xy[$c]][$x]+55,$btpos[$xy[$l]][$xy[$c]][$y]+145,40,80)
                            $xy[$l] += 1
                        case  $xy[$l] > 0 And $msg[3] >= $btpos[$xy[$l]][$xy[$c]][$x] And $msg[3] < $btpos[$xy[$l]][$xy[$c]][$x] + 110 And $msg[4] < $btpos[$xy[$l]][$xy[$c]][$y] - 110 and $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y] - 330
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]-1][$xy[$c]][$x],$btpos[$xy[$l]-1][$xy[$c]][$y],150,150)  ; ^
                            _GDIPlus_GraphicsDrawImageRect($ref,$foto[2],$btpos[$xy[$l]][$xy[$c]][$x]+55,$btpos[$xy[$l]][$xy[$c]][$y]-75,40,80)
                            $xy[$l] -= 1
                    EndSelect
                     If   $n <> $xy[0]*3+$xy[1] Then
                         $n  = $xy[0]*3+$xy[1]
                      $code &= $xy[0]*3+$xy[1]
                      GUICtrlSetData($cod, "Code: " & $code)
                EndIf
                WEnd
                $nmsg = 1
            EndIf
        Next
    Next
    If $ncode = 9 And $nmsg Then
        $ncode = $code
        $code = 9
        GUICtrlSetData($cod, "Code: " )
        Beep(1200,400)
    ElseIf $code = $ncode Then
        GUISetBkColor($COR_VERDE)
        Beep()
        GUISetBkColor(0x7E7E7E)
    ElseIf $nmsg Then
        Beep(100,400)
    EndIf
    $nmsg = 0
    If $xy[0] <> 9 Or $xy[1] <> 9 Then
        GUICtrlSetPos($cod, 0,   0, 700, 600 )
        GUICtrlSetPos($cod, 0, 610, 640, 80)
    EndIf
EndFunc

 

Share this post


Link to post
Share on other sites
JLogan3o13

@xan Typically if you are going to post in the Examples forum, you should have runnable code as opposed to non-working code and then a link to a third party site (especially one as pop-up and ad-ware ridden as 4shared) to download the needed files. Also, some explanation of what the code does would be helpful.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
VIP

Not know before sharing, he tried to run the code yet? :yawn: 

I had to take one moment to run it :sweating:

hghjd.png

Code_Screen_Pattern.zip

  • Like 1

Regards,
 

Share this post


Link to post
Share on other sites
xan

Thank you for simplifying this post.

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  

×