import GUI
var slider : array 1 .. 3 of int
var Red, Green, Blue : int
var font : int := Font.New ("Ariel:16")
var clr : int
setscreen ("graphics:280;350,title:Thoughtful Color Mixer")
Red := 255 div 2
Green := 255 div 2
Blue := 255 div 2
proc add_clr
clr := RGB.AddColor (Red / 255, Green / 255, Blue / 255)
end add_clr
proc draw
drawfillbox (10, 300, 260, 340, clr)
end draw
proc values
drawfillbox (135, 230, 190, 250, white)
drawfillbox (135, 130, 190, 150, white)
drawfillbox (135, 30, 190, 50, white)
Font.Draw (intstr (Red), 135, 230, font, black)
Font.Draw (intstr (Green), 135, 130, font, black)
Font.Draw (intstr (Blue), 135, 30, font, black)
end values
procedure RedMoved (value : int)
Red := value
values
add_clr
draw
end RedMoved
procedure GreenMoved (value : int)
Green := value
values
add_clr
draw
end GreenMoved
procedure BlueMoved (value : int)
Blue := value
values
add_clr
draw
end BlueMoved
slider (1) := GUI.CreateHorizontalSlider (10, 210, 255,
0, 255, 255 div 2, RedMoved)
slider (2) := GUI.CreateHorizontalSlider (10, 110, 255,
0, 255, 255 div 2, GreenMoved)
slider (3) := GUI.CreateHorizontalSlider (10, 10, 255,
0, 255, 255 div 2, BlueMoved)
values
loop
exit when GUI.ProcessEvent
end loop
|