Since I came to this forum, I'm working on one right now. The GUI version isn't working correctly... I dunno what the problem is, and I may work on it later, but not right now... Here's the GUI version...
Code: Select all
import GUI
%var picID:array 1..5 of int
var a1,a2,a3,a4:string:="ZEND"
var picID1,picID2,picID3,picID4,picID5,Butt_Sub,count,wrong:int
var Butt_exit,q1,q2,q3,q4,fontID,t1:int
wrong:=0
count:=1
fontID:=Font.New("Times New Roman:12x6")
procedure submit
if a1="ZEND"
then
end if
if a1 not="ZEND"
then
if a1="QWERTY" or a1="qwerty" or a1="Qwerty"
then
count:=2
else
wrong+=1
end if
end if
if a2 not="ZEND"
then
if a2="QWERTY" or a2="qwerty" or a2="Qwerty"
then
count:=3
else
wrong+=1
end if
end if
if a3 not="ZEND"
then
if a3="QWERTY" or a3="qwerty" or a3="Qwerty"
then
count:=4
else
wrong+=1
end if
end if
if a4 not="ZEND"
then
if a4="QWERTY" or a4="qwerty" or a4="Qwerty"
then
count:=5
else
wrong+=1
end if
end if
end submit
procedure t2(text:string)
if a1="ZEND"
then
a1:=text
elsif a1 not="ZEND" and a2="ZEND"
then
a2:=text
elsif a2 not="ZEND" and a3="ZEND"
then
a3:=text
elsif a3 not="ZEND" and a4="ZEND"
then
a4:=text
end if
end t2
procedure exitq
GUI.Quit
end exitq
procedure NoHang
Draw.Line(maxx div 2-15,maxy div 2+12,maxx div 2+30,maxy div 2+12,brightred)
Draw.Line(maxx div 2+30,maxy div 2+12,maxx div 2+30,maxy div 2+140,brightred)
Draw.Line(maxx div 2+30,maxy div 2+140,maxx div 2,maxy div 2+140,brightred)
Draw.Line(maxx div 2,maxy div 2+140,maxx div 2,maxy div 2+115,brightred)
end NoHang
procedure HeadHang
Draw.Oval(maxx div 2,maxy div 2+100,15,15,brightred)
end HeadHang
procedure TorsoHang
Draw.Line(maxx div 2,maxy div 2+85,maxx div 2,maxy div 2+45,brightred)
end TorsoHang
procedure LegRightHang
Draw.Line(maxx div 2,maxy div 2+45,maxx div 2+14,maxy div 2+12,brightred)
end LegRightHang
procedure LegLeftHang
Draw.Line(maxx div 2,maxy div 2+45,maxx div 2-14,maxy div 2+12,brightred)
end LegLeftHang
View.Set("nobuttonbar,title:Hangman")
GUI.SetBackgroundColour(gray)
% Draw.Line(maxx div 2-15,maxy div 2+12,maxx div 2+30,maxy div 2+12,brightred)
% Draw.Line(maxx div 2+30,maxy div 2+12,maxx div 2+30,maxy div 2+140,brightred)
% Draw.Line(maxx div 2+30,maxy div 2+140,maxx div 2,maxy div 2+140,brightred)
% Draw.Line(maxx div 2,maxy div 2+140,maxx div 2,maxy div 2+115,brightred)
% Draw.Oval(maxx div 2,maxy div 2+100,15,15,brightred)
% Draw.Line(maxx div 2,maxy div 2+85,maxx div 2,maxy div 2+45,brightred)
% Draw.Line(maxx div 2,maxy div 2+45,maxx div 2+14,maxy div 2+12,brightred)
% Draw.Line(maxx div 2,maxy div 2+45,maxx div 2-14,maxy div 2+12,brightred)
if wrong=0
then
NoHang
put"0 Wrong"
end if
if wrong=1
then
HeadHang
put"1 Wrong"
end if
if wrong=2
then
TorsoHang
put"2 Wrong"
end if
if wrong=3
then
LegRightHang
put "3 Wrong"
end if
if wrong=4
then
LegLeftHang
put"All Wrong"
end if
if count=1
then
q1:=GUI.CreateLabel(200,maxy div 2-100,"Q__R_TY - Common type of Keyboard")
elsif count=2
then
q2:=GUI.CreateLabel(200,maxy div 2-100,"Q__R_TY - Common type of Keyboard")
elsif count=3
then
q3:=GUI.CreateLabel(200,maxy div 2-100,"Q__R_TY - Common type of Keyboard")
elsif count=4
then
q4:=GUI.CreateLabel(200,maxy div 2-100,"Q__R_TY - Common type of Keyboard")
end if
t1:=GUI.CreateTextFieldFull(200,maxy div 2-150,200,"",t2,GUI.INDENT,fontID,0)
Butt_Sub:=GUI.CreateButtonFull(200,maxy div 2-180,0,"Submit",submit,0,"S",true)
%exit when wrong<5 and count=5
Butt_exit:=GUI.CreateButtonFull(maxx-50,0,0,"Exit",exitq,0,"E",false)
loop
exit when GUI.ProcessEvent
end loop
[code]
[color=#888888][size=85]Archived topic from Iceteks, old topic ID:3283, old post ID:26968[/size][/color]