Post by bluatigro on Apr 26, 2018 13:26:58 GMT
use the folowing if you need sprites in you program
if you need more sub's ask
if you need more sub's ask
''bluatigro 26 apr 2018
''sprite module
[sprite]
global sprite.width , sprite.height
return
sub sprite.clear w , h
#m "fill white"
#m "goto 0 " ; h
#m "size 1"
#m "down"
#m "color black"
#m "backcolor black"
#m "boxfilled " ; w ; " " ; h * 2
#m "up"
sprite.width = w
sprite.height = h
end sub
sub sprite.triangle x1 , y1 , x2 , y2 , x3 , y3 , clr$
if y1 = y2 then y1 = y1 - 1e-10
if y2 = y3 then y3 = y3 + 1e-10
if y1 > y3 then
h = y1
y1 = y3
y3 = h
h = x1
x1 = x3
x3 = h
end if
if y1 > y2 then
h = y1
y1 = y2
y2 = h
h = x1
x1 = x2
x2 = h
end if
if y2 > y3 then
h = y2
y2 = y3
y3 = h
h = x2
x2 = x3
x3 = h
end if
for i = y1 to y3
a = x1 + ( x3 - x1 ) * (i-y1) / ( y3 - y1 )
if i < y2 then
b = x1 + ( x2 - x1 ) * (i-y1) / ( y2 - y1 )
else
b = x2 + ( x3 - x2 ) * (i-y2) / ( y3 - y2 )
end if
call sprite.line a , i + sprite.height _
, b , i + sprite.height , clr$ , 1
call sprite.line a , i , b , i , "black" , 1
next i
#m "flush"
end sub
sub sprite.rectangle x1,y1,x2,y2,clr$
#m "goto " ; x1 ; " " ; y1
#m "size 1"
#m "color black"
#m "backcolor black"
#m "down"
#m "boxfilled " ; x2 ; " " ; y2
#m "up"
#m "goto " ; x1 ; " " ; y1 + sprite.height
#m "color " ; clr$
#m "backcolor " ; clr$
#m "down"
#m "boxfilled " ; x2 ; " " ; y2 + 60
#m "up"
end sub
sub sprite.ellipse x,y,dx,dy,clr$,bclr$,size
#m "goto " ; x ; " " ; y
#m "size " ; size
#m "down"
#m "color black"
#m "backcolor black"
#m "ellipsefilled " ; dx ; " " ; dy
#m "up"
#m "goto " ; x ; " " ; y + sprite.height
#m "down"
#m "color " ; clr$
#m "backcolor " ; bclr$
#m "ellipsefilled " ; dx ; " " ; dy
#m "up"
end sub
sub sprite.pie x,y,dx,dy,a,b,clr$,bclr$,size
#m "goto " ; x ; " " ; y
#m "size " ; size
#m "down"
#m "color black"
#m "backcolor black"
#m "piefilled " ; dx ; " " ; dy _
; " " ; a ; " " ; b
#m "up"
#m "goto " ; x ; " " ; y + sprite.height
#m "down"
#m "color " ; clr$
#m "backcolor " ; bclr$
#m "piefilled " ; dx ; " " ; dy _
; " " ; a ; " " ; b
#m "up"
end sub
sub sprite.line x1,y1 , x2,y2 , clr$ , size
#m "color black"
#m "size " ; size
#m "down"
#m "line " ; x1 ; " " ; y1 _
; " " ; x2 ; " " ; y2
#m "up"
#m "color " ; clr$
#m "down"
#m "line " ; x1 ; " " ; y1 + sprite.height _
; " " ; x2 ; " " ; y2 + sprite.height
#m "up"
end sub
sub sprite.getbmp bmp$
#m "getbmp " ; bmp$ ; " 0 0 " _
; sprite.width ; " " ; sprite.height * 2
end sub