import GUI
% Change window to 500x500
setscreen ("graphics")
var winID1 : int := Window.Open ("position:100;100, graphics:700;500")
%Declaration section
var choice : int
var colour1 : int
var xcoord : int
var ycoord : int
var xcoord2 : int
var ycoord2 : int
var key : string (1)
%Fonts
var font1, font2 : int
%Buttons
var draw1, draw2, quit1 : int := 0
%Background
drawfillbox (1, 1, 699, 499, black)
%Procedures Title, pauseProgram...
proc title
font1 := Font.New ("BERNARD:60:")
assert font1 > 0
Font.Draw ("Microsoft Paint", 153, 430, font1, brightred)
Font.Free (font1)
end title
proc pauseProgram
font2 := Font.New ("KARINE:18:bold")
assert font2 > 0
Font.Draw ("Press any key to continue..", 1, 110, font2, brightblue)
Font.Free (font2)
locate (26, 1)
getch (key)
end pauseProgram
proc intro
title
font2 := Font.New ("KARINE:18:bold")
assert font2 > 0
Font.Draw ("This program will help you draw either a rectangle or a circle.", 1, 270, font2, brightgreen)
Font.Free (font2)
pauseProgram
end intro
proc shapeChoice
font2 := Font.New ("KARINE:18:bold")
assert font2 > 0
Font.Draw ("What do you want to do?", 1, 300, font2, brightblue)
Font.Free (font2)
end shapeChoice
%First Page
%------------------------------------------------
intro
%------------------------------------------------
%Stars that clean screen
proc starsClean1
for x : 0 .. 720 by 5
Draw.FillStar (-50 + x, -3, 50 + x, 100, yellow)
Draw.FillStar (-50 + x, 50, 50 + x, 150, yellow)
Draw.FillStar (-50 + x, 100, 50 + x, 200, yellow)
Draw.FillStar (-50 + x, 150, 50 + x, 250, yellow)
Draw.FillStar (-50 + x, 200, 50 + x, 300, yellow)
Draw.FillStar (-50 + x, 250, 50 + x, 350, yellow)
Draw.FillStar (-50 + x, 300, 50 + x, 400, yellow)
Draw.FillStar (-50 + x, 350, 50 + x, 450, yellow)
Draw.FillStar (-50 + x, 400, 50 + x, 503, yellow)
delay (25)
Draw.FillStar (-50 + x, -3, 50 + x, 100, 42)
Draw.FillStar (-50 + x, 50, 50 + x, 150, 42)
Draw.FillStar (-50 + x, 100, 50 + x, 200, 42)
Draw.FillStar (-50 + x, 150, 50 + x, 250, 42)
Draw.FillStar (-50 + x, 200, 50 + x, 300, 42)
Draw.FillStar (-50 + x, 250, 50 + x, 350, 42)
Draw.FillStar (-50 + x, 300, 50 + x, 400, 42)
Draw.FillStar (-50 + x, 350, 50 + x, 450, 42)
Draw.FillStar (-50 + x, 400, 50 + x, 503, 42)
end for
end starsClean1
%Stars clean
%------------------------------------------------
starsClean1
%------------------------------------------------
%mainMenu proc
proc mainMenu
title
shapeChoice
GUI.Show (draw1)
GUI.Show (draw2)
GUI.Show (quit1)
end mainMenu
%Stars that clean screen
proc starsClean2
for decreasing x : 820 .. 0 by 5
Draw.FillStar (-100 + x, -3, 0 + x, 100, yellow)
Draw.FillStar (-100 + x, 50, 0 + x, 150, yellow)
Draw.FillStar (-100 + x, 100, 0 + x, 200, yellow)
Draw.FillStar (-100 + x, 150, 0 + x, 250, yellow)
Draw.FillStar (-100 + x, 200, 0 + x, 300, yellow)
Draw.FillStar (-100 + x, 250, 0 + x, 350, yellow)
Draw.FillStar (-100 + x, 300, 0 + x, 400, yellow)
Draw.FillStar (-100 + x, 350, 0 + x, 450, yellow)
Draw.FillStar (-100 + x, 400, 0 + x, 503, yellow)
delay (25)
Draw.FillStar (-100 + x, -3, 0 + x, 100, 4)
Draw.FillStar (-100 + x, 50, 0 + x, 150, 4)
Draw.FillStar (-100 + x, 100, 0 + x, 200, 4)
Draw.FillStar (-100 + x, 150, 0 + x, 250, 4)
Draw.FillStar (-100 + x, 200, 0 + x, 300, 4)
Draw.FillStar (-100 + x, 250, 0 + x, 350, 4)
Draw.FillStar (-100 + x, 300, 0 + x, 400, 4)
Draw.FillStar (-100 + x, 350, 0 + x, 450, 4)
Draw.FillStar (-100 + x, 400, 0 + x, 503, 4)
end for
end starsClean2
proc colour4
for x : 1 .. 999999
font2 := Font.New ("KARINE:18:bold")
assert font2 > 0
Font.Draw ("Chose an option above using the numbers: ", 1, 130, font2, brightgreen)
Font.Free (font2)
locate (23, 50)
get choice
if choice = 1 then
colour1 := 55
exit
elsif choice = 2 then
colour1 := 12
exit
elsif choice = 3 then
colour1 := 47
exit
elsif choice = 4 then
colour1 := 14
exit
elsif choice = 5 then
colour1 := black
exit
elsif choice = 6 then
starsClean1
mainMenu
exit
else
font2 := Font.New ("KARINE:18:bold")
assert font2 > 0
Font.Draw ("I gave you all the options and you still get it wrong. Try again!", 1, 100, font2, brightgreen)
Font.Free (font2)
locate (23, 50)
get choice
end if
end for
end colour4
proc colour3
font2 := Font.New ("KARINE:18:bold")
assert font2 > 0
Font.Draw ("What colour do you want your shape to be?", 1, 270, font2, brightgreen)
Font.Draw ("1. Blue", 1, 250, font2, brightblue)
Font.Draw ("2. Red", 1, 230, font2, brightred)
Font.Draw ("3. Green", 1, 210, font2, brightgreen)
Font.Draw ("4. Yellow", 1, 190, font2, yellow)
Font.Draw ("5. Black", 1, 170, font2, black)
Font.Draw ("6. Go back to Main Menu", 1, 150, font2, 42)
Font.Free (font2)
end colour3
%Proc Colour2
proc colour2
GUI.Hide (draw1)
GUI.Hide (draw2)
GUI.Hide (quit1)
starsClean2
title
colour3
colour4
end colour2
%Instructions
proc instructionscircle
end instructionscircle
%Close Windows
procedure closeWindows
GUI.CloseWindow (winID1)
end closeWindows
%Main menu
draw1 := GUI.CreateButtonFull (180, 150, 0, "Draw a Rectangle", colour2, 0, '^F', false)
draw2 := GUI.CreateButtonFull (300, 150, 0, "Draw a Circle", colour2, 0, '^S', false)
quit1 := GUI.CreateButtonFull (400, 150, 0, "Quit", GUI.Quit, 0, KEY_ESC, false)
%------------------------------------------------
mainMenu
%------------------------------------------------
%setWindows
loop
exit when GUI.ProcessEvent
end loop
closeWindows
|