Rem color selector
Rem selecting R,G,B values will produce the resulting color.
Rem for iPad only
gosub init_prog
loop1:
r=red/255
g=green/255
b=blue/255
fill color r,0,0
fill rect x(1)+2,yo-158 to x(1)+78,yo-62
fill color 0,g,0
fill rect x(2)+2,yo-158 to x(2)+78,yo-62
fill color 0,0,b
fill rect x(3)+2,yo-158 to x(3)+78,yo-62
fill color r,g,b
fill rect 100,10 to 640,200
loop2:
for i=0 to 17
for j=1 to 3
cc$=k$(j) & i
if button_pressed(cc$) then
i_oud=ind(j)
ind(j)=i
w$=255-15*i
w=w$
button cc$ title w$ at x(j)-20,yo+i*dy size 120,25
cc$= k$(j) & i_oud
w$=255-15*i_oud
button cc$ title w$ at x(j),yo+i_oud*dy size 80,25
if j=1 then red=w
if j=2 then green=w
if j=3 then blue=w
goto loop1
end if
next j
next i
goto loop2
end
init_prog:
option base 1
dim k$(3),x(3),ind(3)
k$(1)="R"
k$(2)="G"
k$(3)="B"
xo=100
dx=230
x(1)=xo
x(2)=xo+dx
x(3)=xo+dx+dx
ind(1)=9
ind(2)=9
ind(3)=9
yo=400
dy=30
graphics
draw color 0,0,0
fill color .8,.8,.8
fill rect 0,0 to screen_width(),screen_height()
red=120
green=120
blue=120
draw size 4
draw rect 98,8 to 642,202
for i=0 to 17
for j=1 to 3
cc$=k$(j) & i
w$=255-15*i
if i=9 then
button cc$ title w$ at x(j)-20,yo+i*dy size 120,25
else
button cc$ title w$ at x(j),yo+i*dy size 80,25
end if
next j
next i
draw font size 32
draw color 1,0,0
draw text "R" at x(1)+30,yo-40
draw color 0,1,0
draw text "G" at x(2)+30,yo-40
draw color 0,0,1
draw text "B" at x(3)+30,yo-40
draw color 0,0,0
for j=1 to 3
draw rect x(j),yo-160 to x(j)+80,yo-60
next j
return