Works with Textput library.
https://autohotkey.com//boards/viewtopi ... =6&t=27796
Code: Select all
; ======================================================================================================================
; Name: Tiny Memory
; Purpose: A Little Memory Game
; Needed: TextPut.ahk download at https://autohotkey.com//boards/viewtopic.php?f=6&t=27796
; Tested with: AHK 1.1.24.03 (A32/U32/U64)
; Tested on: Win 7 (x64)
;
; Credit: SpeedMaster
;
; ======================================================================================================================
#include textput.ahk
#maxthreads 3
object:=[]
range:="A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J"
sort, range, D, Random
object:=StrSplit(range, ",")
w_card:="100"
h_card:="100"
w_mask:="110"
h_mask:="110"
A:="cgreen backgroundA20025 borderred s70 0x201"
B:="background0050EF bordermagenta s70 0x201"
C:="background1BA1E2 bordergreen s70 0x201"
D:="background008A00 bordergoldenrod s70 0x201"
E:="background60A917 borderaqua s70 0x201"
F:="background6A00FF borderindigo s70 0x201"
G:="backgroundA4C400 borderviolet s70 0x201"
H:="backgroundD80073 borderLightCoral s70 0x201"
I:="backgroundFA6800 borderCadetBlue s70 0x201"
J:="background825A2C bordergreen s70 0x201"
maskparam:="background0000ff"
for k, val in object
t%a_index%:= % %val%
X:=20, Y:=20, Row:=1, Col:=1, Ix:=1
Loop,Parse,range,`,
{
param:=t%a_index%
textput(X,Y , w_card,h_card, "gMainProcedure %param% ", A_LoopField)
X:=X+115, Col:=Col+1
If (Col>5)
Row:=Row+1, Col:=1, Y:=Y+115, X:=20
}
X:=15, Y:=20, Row:=1, Col:=1, Ix:=1
Loop,Parse,range,`,
{
textput(X,Y , w_mask,h_mask, " %maskparam% ","")
X:=X+115, Col:=Col+1
If (Col>5)
Row:=Row+1, Col:=1, Y:=Y+115, X:=15
}
textput(345,480,250,25, "0x200 center s10 corange @lucida handwriting@", "Tiny Memory by SpeedMaster")
textput("xs",480,60,25, "0x200 center s10 greload cGreen italic underline @lucida console@", "RELOAD")
;Gui, Add, Button, Default xs yp gscramble, RELOAD
gui, +resize
gui, color, black
gui, show, w600 h520
settimer, flip, 1300, on
return
mainprocedure:
if flip1=
{
RegExMatch(A_GuiControl, "\d+", outa)
textputhide(outa+20) ;hide first mask
flip1:=a_guicontrol
}
else
if flip2=
{
RegExMatch(A_GuiControl, "\d+", outb)
textputhide(outb+20) ;hide second mask
flip2:=a_guicontrol
}
;settimer, flip, 1500, on
flip:
guicontrolget, flip1char,, %flip1% ; extract first letter card
guicontrolget, flip2char,, %flip2% ; extract second letter card
sleep, 1200
RegExMatch(flip1, "\d+", f1)
RegExMatch(flip2, "\d+", f2)
if % flip1char!=flip2char
{
textputshow(f1+20) ;if not correct show first mask
textputshow(f2+20) ;if not correct show second mask
}
flip1=
flip2=
return
reload:
reload
return
guiclose:
esc::
exitapp
return