Author |
Topic: Object Oriented Liberty BASIC? (Read 3299 times) |
|
bluatigro
Full Member
member is offline


Gender: 
Posts: 111
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #16 on: Jan 24th, 2015, 1:41pm » |
|
tryed Code:
''bluatigro 24 jan 2015
''sphere_test.bas
'include _fullscreen_init.bas
'include _math_init.bas
'include _color_init.bas
'include _sphere_init.bas
nomainwin
open "" for graphics as #m
#m "trapclose [quit]"
#m "fill " ; black$
for height = 0-winy/2 to winy/2
call sphere 0 , 0 , 0 , 50 , red$
next height
wait
[quit]
close #m
end
'include _math.bas
'include _color.bas
'include _sphere.bas
stil not working
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #17 on: Jan 24th, 2015, 2:28pm » |
|
on Jan 24th, 2015, 1:41pm, bluatigro wrote: This works perfectly for me:
_math_init.bas: Code:global pi , golden.ratio
pi = atn( 1 ) * 4
golden.ratio = ( sqr( 5 ) - 1 ) / 2
global true , false
true = not( false ) _color_init.bas: Code:global black$ , red$ , green$ , yellow$
global blue$ , magenta$ , cyan$ , white$
global gray$ , pink$ , purple$ , orange$
black$ = rgb$( 000 , 000 , 000 )
red$ = rgb$( 255 , 000 , 000 )
green$ = rgb$( 000 , 255 , 000 )
yellow$ = rgb$( 255 , 255 , 000 )
blue$ = rgb$( 000 , 000 , 255 )
magenta$ = rgb$( 255 , 000 , 255 )
cyan$ = rgb$( 000 , 255 , 255 )
white$ = rgb$( 255 , 255 , 255 )
gray$ = rgb$( 127 , 127 , 127 )
pink$ = rgb$( 255 , 127 , 127 )
purple$ = rgb$( 127 , 000 , 127 )
orange$ = rgb$( 255 , 127 , 000 ) _sphere_init.bas: Code:WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
global winx , winy
winx = WindowWidth
winy = WindowHeight
global height _math.bas: Code:function rad( deg )
rad = deg * pi / 180
end function _color.bas: Code:function rgb$( r , g , b )
r = r and 255
g = g and 255
b = b and 255
rgb$ = str$( r ); " " ; g * 256 ; " " ; b * 256 ^ 2
end function
function red( clr$ )
red = val( word$( clr$ , 1 ) )
end function
function green( clr$ )
green = val( word$( clr$ , 2 ) )
end function
function blue( clr$ )
blue = val( word$( clr$ , 3 ) )
end function
function klmix$( kl1$ , f , kl2$ )
r1 = red( kl1$ )
g1 = green( kl1$ )
b1 = blue( kl1$ )
r2 = red( kl2$ )
g2 = green( kl2$ )
b2 = blue( kl2$ )
r = r1 + f * ( r2 - r1 )
g = g1 + f * ( g2 - g1 )
b = b1 + f * ( b2 - b1 )
klmix$ = rgb$( r , g , b )
end function
function rainbow$( deg )
rainbow$ = rgb$( sin( rad( deg ) ) * 127 + 128 _
, sin( rad( deg + 120 ) ) * 127 + 128 _
, sin( rad( deg - 120 ) ) * 127 + 128 )
end function _sphere.bas: Code:sub sphere h$, x , y , z , d , clr$
if abs( height - y ) < d then
dd = sqr( d ^ 2 - ( height - y ) ^ 2 + .001 ) * 2
kl$ = klmix$( clr$ , .5 - ( height - y ) / d / 2 , black$ )
#h$ "goto " ; x + winx / 2 ;" "; winy / 2 - height - z / 4
#h$ "backcolor " ; kl$
#h$ "color " ; kl$
#h$ "down"
#h$ "ellipsefilled "; dd ;" "; dd / 4
#h$ "up"
end if
end sub Main Program: Code:''bluatigro 24 jan 2015
''sphere_test.bas
'include _math_init.bas
'include _color_init.bas
'include _sphere_init.bas
nomainwin
open "" for graphics as #m
#m "trapclose [quit]"
#m "fill " ; black$
for height = 0-winy/2 to winy/2
call sphere "#m", 0 , 0 , 0 , 50 , red$
next height
wait
[quit]
close #m
end
'include _math.bas
'include _color.bas
'include _sphere.bas
|
|
|
|
bluatigro
Full Member
member is offline


Gender: 
Posts: 111
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #18 on: Jan 29th, 2015, 08:44am » |
|
update : - _sphere.bas extended whit 'egg'
error ? : - i got the same as you - but i got a white screen whit nothing
_sphere.bas Code:
''bluatigro 29 jan 1015
''_sphere.bas
sub sphere x , y , z , d , clr$
if abs( height - y ) < d then
dd = sqr( d ^ 2 - ( height - y ) ^ 2 + .001 ) * 2
kl$ = color.mix$( clr$ , .5 - ( height - y ) / d / 2 , black$ )
#m "goto " ; x + winx / 2 ; " " ; winy / 2 - height - z / 4
#m "backcolor " ; kl$
#m "color" ; kl$
#m "down"
#m "ellipsefilled "; dd ;" "; dd / 4
#m "up"
end if
end sub
sub egg x1 , y1 , z1 , d1 , x2 , y2 , z2 , d2 , dm , kl$ , no
af = sqr( ( x1 - x2 ) ^ 2 _
+ ( y1 - y2 ) ^ 2 + ( z1 - z2 ) ^ 2 + 1 )
dx = ( x2 - x1 ) / af
dy = ( y2 - y1 ) / af
dz = ( z2 - z1 ) / af
dd = ( d2 - d1 ) / af
dh = ( d1 + d2 ) / 2
if no < 2 then no = af
if no > af then no = af
for i = 0 to af step af / no
call sphere x1 + dx * i _
, y1 + dy * i , z1 + dz * i _
, d1 + dd * i + sin( i * pi / af ) _
* ( dm - dh ) , kl$
next i
end sub
|
|
Logged
|
|
|
|
bluatigro
Full Member
member is offline


Gender: 
Posts: 111
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #19 on: Feb 6th, 2015, 10:17am » |
|
i tested the stuff in 1 file
i got a black screen whit nothing
Code:
''bluatigro 6 feb 2015
''sphere_test_2.bas
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
global winx , winy
winx = WindowWidth
winy = WindowHeight
global pi , golden.ratio
pi = atn( 1 ) * 4
golden.ratio = ( sqr( 5 ) - 1 ) / 2
global true , false
true = not( false )
global black$ , red$ , green$ , yellow$
global blue$ , magenta$ , cyan$ , white$
global gray$ , pink$ , purple$ , orange$
black$ = rgb$( 000 , 000 , 000 )
red$ = rgb$( 255 , 000 , 000 )
green$ = rgb$( 000 , 255 , 000 )
yellow$ = rgb$( 255 , 255 , 000 )
blue$ = rgb$( 000 , 000 , 255 )
magenta$ = rgb$( 255 , 000 , 255 )
cyan$ = rgb$( 000 , 255 , 255 )
white$ = rgb$( 255 , 255 , 255 )
gray$ = rgb$( 127 , 127 , 127 )
pink$ = rgb$( 255 , 127 , 127 )
purple$ = rgb$( 127 , 000 , 127 )
orange$ = rgb$( 255 , 127 , 000 )
global height
nomainwin
open "" for graphics as #m
#m "trapclose [quit]"
#m "fill " ; black$
for height = 0-winy/2 to winy/2
call sphere 0 , 0 , 0 , 50 , red$
next height
wait
[quit]
close #m
end
''math
function rad( deg )
rad = deg * pi / 180
end function
function range( l , h )
range = rnd(0) * ( h - l ) + l
end sub
function nr$( no , max )
nr$ = right$( "00000000" ; no , max )
end function
''color
function rgb$( r , g , b )
r = r and 255
g = g and 255
b = b and 255
rgb$ = str$( r ); " " ; g * 256 ; " " ; b * 256 ^ 2
end function
function color.red( clr$ )
color.red = val( word$( clr$ , 1 ) )
end function
function color.green( clr$ )
color.green = val( word$( clr$ , 2 ) )
end function
function color.blue( clr$ )
color.blue = val( word$( clr$ , 3 ) )
end function
function color.mix$( kl1$ , f , kl2$ )
r1 = color.red( kl1$ )
g1 = color.green( kl1$ )
b1 = color.blue( kl1$ )
r2 = color.red( kl2$ )
g2 = color.green( kl2$ )
b2 = color.blue( kl2$ )
r = r1 + f * ( r2 - r1 )
g = g1 + f * ( g2 - g1 )
b = b1 + f * ( b2 - b1 )
klmix$ = rgb$( r , g , b )
end function
function rainbow$( deg )
rainbow$ = rgb$( sin( rad( deg ) ) * 127 + 128 _
, sin( rad( deg + 120 ) ) * 127 + 128 _
, sin( rad( deg - 120 ) ) * 127 + 128 )
end function
''sphere
sub sphere x , y , z , d , clr$
if abs( height - y ) < d then
dd = sqr( d ^ 2 - ( height - y ) ^ 2 + .001 ) * 2
kl$ = color.mix$( clr$ , .5 - ( height - y ) / d / 2 , black$ )
#m "goto " ; x + winx / 2 ; " " ; winy / 2 - height - z / 4
#m "backcolor " ; kl$
#m "color" ; kl$
#m "down"
#m "ellipsefilled "; dd ;" "; dd / 4
#m "up"
end if
end sub
sub egg x1 , y1 , z1 , d1 , x2 , y2 , z2 , d2 , dm , kl$ , no
af = sqr( ( x1 - x2 ) ^ 2 _
+ ( y1 - y2 ) ^ 2 + ( z1 - z2 ) ^ 2 + 1 )
dx = ( x2 - x1 ) / af
dy = ( y2 - y1 ) / af
dz = ( z2 - z1 ) / af
dd = ( d2 - d1 ) / af
dh = ( d1 + d2 ) / 2
if no < 2 then no = af
if no > af then no = af
for i = 0 to af step af / no
call sphere x1 + dx * i _
, y1 + dy * i , z1 + dz * i _
, d1 + dd * i + sin( i * pi / af ) _
* ( dm - dh ) , kl$
next i
end sub
|
| « Last Edit: Feb 6th, 2015, 10:18am by bluatigro » |
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #20 on: Feb 6th, 2015, 11:01am » |
|
on Feb 6th, 2015, 10:17am, bluatigro wrote:| i got a black screen whit nothing |
|
Two mistakes:
Code:
klmix$ = rgb$( r , g , b )
should be:
color.mix$ = rgb$( r , g , b ) and:
Code:
#m "color" ; kl$
should be:
#m "color " ; kl$ Richard.
|
|
Logged
|
|
|
|
bluatigro
Full Member
member is offline


Gender: 
Posts: 111
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #21 on: Feb 6th, 2015, 12:36pm » |
|
@ richard : - i changed the include *.bas to
error : - i got a smal white screen
Code:
''bluatigro 6 feb 2015
''_color.bas
function rgb$( r , g , b )
''create a color-object$
r = r and 255
g = g and 255
b = b and 255
rgb$ = str$( r ); " " ; g * 256 ; " " ; b * 256 ^ 2
end function
function color.red( clr$ )
''get red part of color-object$
color.red = val( word$( clr$ , 1 ) )
end function
function color.green( clr )
''get green part of color-object$
color.green = val( word$( clr$ , 2 ) )
end function
function color.blue( clr$ )
''get blue part of color-object$
color.blue = val( word$( clr$ , 3 ) )
end function
function color.mix$( kl1$ , f , kl2$ )
''mix 2 color-object$ into 1 new
r1 = color.red( kl1$ )
g1 = color.green( kl1$ )
b1 = color.blue( kl1$ )
r2 = color.red( kl2$ )
g2 = color.green( kl2$ )
b2 = color.blue( kl2$ )
r = r1 + f * ( r2 - r1 )
g = g1 + f * ( g2 - g1 )
b = b1 + f * ( b2 - b1 )
color.mix$ = rgb$( r , g , b )
end function
function rainbow$( deg )
rainbow$ = rgb$( sin( rad( deg ) ) * 127 + 128 _
, sin( rad( deg + 120 ) ) * 127 + 128 _
, sin( rad( deg - 120 ) ) * 127 + 128 )
end function
Code:
''bluatigro 6 feb 2015
''_sphere.bas
sub sphere x , y , z , d , clr$
if abs( height - y ) < d then
dd = sqr( d ^ 2 - ( height - y ) ^ 2 + .001 ) * 2
kl$ = color.mix$( clr$ , .5 - ( height - y ) / d / 2 , black$ )
#m "goto " ; x + winx / 2 ; " " ; winy / 2 - height - z / 4
#m "backcolor " ; kl$
#m "color " ; kl$
#m "down"
#m "ellipsefilled "; dd ; " " ; dd / 4
#m "up"
end if
end sub
sub egg x1 , y1 , z1 , d1 , x2 , y2 , z2 , d2 , dm , kl$ , no
af = sqr( ( x1 - x2 ) ^ 2 _
+ ( y1 - y2 ) ^ 2 + ( z1 - z2 ) ^ 2 + 1 )
dx = ( x2 - x1 ) / af
dy = ( y2 - y1 ) / af
dz = ( z2 - z1 ) / af
dd = ( d2 - d1 ) / af
dh = ( d1 + d2 ) / 2
if no < 2 then no = af
if no > af then no = af
for i = 0 to af step af / no
call sphere x1 + dx * i _
, y1 + dy * i , z1 + dz * i _
, d1 + dd * i + sin( i * pi / af ) _
* ( dm - dh ) , kl$
next i
end sub
Code:
''bluatigro 6 feb 2015
''sphere_test_2.bas
'include _fullscreen_init.bas
'include _math_init.bas
'include _color_init.bas
global height
nomainwin
open "" for graphics as #m
#m "trapclose [quit]"
#m "fill " ; black$
for height = 0-winy/2 to winy/2
call sphere 0 , 0 , 0 , 50 , red$
next height
wait
[quit]
close #m
end
'include _math.bas
'include _color.bas
'include _sphere.bas
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #22 on: Feb 6th, 2015, 1:28pm » |
|
on Feb 6th, 2015, 12:36pm, bluatigro wrote:| error : - i got a smal white screen |
|
The beta version of LBB you have contains File... Insert and File... Compare so I suggest you replace each 'include directive with the file itself, and then compare the merged result with the working version.
Generally, I would recommend only using 'include with modules that have been thoroughly tested and are known to work. Otherwise it's too difficult to debug a program using includes.
Richard.
|
|
Logged
|
|
|
|
bluatigro
Full Member
member is offline


Gender: 
Posts: 111
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #23 on: Feb 8th, 2015, 09:05am » |
|
in the begining it was 1 file but i splitted it later because i want to write in parts so i dont have to write it twice or more i want to extend this farder whit more parts [ see 3d line cubes ] and i can only post 10K here
in the future my files wil be bigger if i dont use include
|
|
Logged
|
|
|
|
bluatigro
Full Member
member is offline


Gender: 
Posts: 111
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #24 on: Feb 8th, 2015, 10:03am » |
|
@ richard : - i tryed it
i got rid of al the errors
working Code:
''bluatigro 8 feb 2015
''sphere_test_3.bas
''bluatigro 8 feb 2015
''_fullscreen_init.bas
WindowWidth = DisplayWidth
WindowHeight = DisplayHeight
global winx , winy
winx = WindowWidth
winy = WindowHeight
''bluatigro 8 feb 2015
''_math_init.bas
global pi , golden.ratio
pi = atn( 1 ) * 4
golden.ratio = ( sqr( 5 ) - 1 ) / 2
global true , false
true = not( false )
''bluatigro 8 feb 2015
''_color_init.bas
global black$ , red$ , green$ , yellow$
global blue$ , magenta$ , cyan$ , white$
global gray$ , pink$ , purple$ , orange$
black$ = rgb$( 000 , 000 , 000 )
red$ = rgb$( 255 , 000 , 000 )
green$ = rgb$( 000 , 255 , 000 )
yellow$ = rgb$( 255 , 255 , 000 )
blue$ = rgb$( 000 , 000 , 255 )
magenta$ = rgb$( 255 , 000 , 255 )
cyan$ = rgb$( 000 , 255 , 255 )
white$ = rgb$( 255 , 255 , 255 )
gray$ = rgb$( 127 , 127 , 127 )
pink$ = rgb$( 255 , 127 , 127 )
purple$ = rgb$( 127 , 000 , 127 )
orange$ = rgb$( 255 , 127 , 000 )
global height
nomainwin
open "" for graphics as #m
#m "trapclose [quit]"
#m "fill " ; black$
for height = 0-winy/2 to winy/2
call sphere 0 , 0 , 0 , 50 , red$
next height
wait
[quit]
close #m
end
''bluatigro 8 feb 2015
''_math.bas
function rad( deg )
''calculate radians outof degrees
rad = deg * pi / 180
end function
function range( low , high )
''get a random double between low and high
range = rnd(0) * ( high - low ) + low
end sub
function nr$( no , max )
''format a number into a string
nr$ = right$( "0000000000" ; no , max )
end function
''bluatigro 8 feb 2015
''_color.bas
function rgb$( r , g , b )
''create a color-object$
r = r and 255
g = g and 255
b = b and 255
rgb$ = str$( r ); " " ; g * 256 ; " " ; b * 256 ^ 2
end function
function color.red( clr$ )
''get red part of color-object$
color.red = val( word$( clr$ , 1 ) )
end function
function color.green( clr$ )
''get green part of color-object$
color.green = val( word$( clr$ , 2 ) )
end function
function color.blue( clr$ )
''get blue part of color-object$
color.blue = val( word$( clr$ , 3 ) )
end function
function color.mix$( kl1$ , f , kl2$ )
''mix 2 color-object$ into 1 new
r1 = color.red( kl1$ )
g1 = color.green( kl1$ )
b1 = color.blue( kl1$ )
r2 = color.red( kl2$ )
g2 = color.green( kl2$ )
b2 = color.blue( kl2$ )
r = r1 + f * ( r2 - r1 )
g = g1 + f * ( g2 - g1 )
b = b1 + f * ( b2 - b1 )
color.mix$ = rgb$( r , g , b )
end function
function rainbow$( deg )
rainbow$ = rgb$( sin( rad( deg ) ) * 127 + 128 _
, sin( rad( deg + 120 ) ) * 127 + 128 _
, sin( rad( deg - 120 ) ) * 127 + 128 )
end function
''bluatigro 8 feb 2015
''_sphere.bas
sub sphere x , y , z , d , clr$
if abs( height - y ) < d then
dd = sqr( d ^ 2 - ( height - y ) ^ 2 + .001 ) * 2
kl$ = color.mix$( clr$ , .5 - ( height - y ) / d / 2 , black$ )
#m "goto " ; x + winx / 2 ; " " ; winy / 2 - height - z / 4
#m "backcolor " ; kl$
#m "color " ; kl$
#m "down"
#m "ellipsefilled "; dd ; " " ; dd / 4
#m "up"
end if
end sub
sub egg x1 , y1 , z1 , d1 , x2 , y2 , z2 , d2 , dm , kl$ , no
af = sqr( ( x1 - x2 ) ^ 2 _
+ ( y1 - y2 ) ^ 2 + ( z1 - z2 ) ^ 2 + 1 )
dx = ( x2 - x1 ) / af
dy = ( y2 - y1 ) / af
dz = ( z2 - z1 ) / af
dd = ( d2 - d1 ) / af
dh = ( d1 + d2 ) / 2
if no < 2 then no = af
if no > af then no = af
for i = 0 to af step af / no
call sphere x1 + dx * i _
, y1 + dy * i , z1 + dz * i _
, d1 + dd * i + sin( i * pi / af ) _
* ( dm - dh ) , kl$
next i
end sub
but when i split it it does not work . why ?
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #25 on: Feb 8th, 2015, 10:10am » |
|
on Feb 8th, 2015, 10:03am, bluatigro wrote:| @but when i split it it does not work . why ? |
|
I do not believe it. Splitting a program into multiple modules makes no difference; when you run it, it is the same program (apart from the line numbers).
I listed in an earlier post a fully working 'sphere' program split into multiple modules. If necessary go back to that:
http://lbb.conforums.com/index.cgi?board=general&action=display&num=1402220363&start=17
Richard.
|
|
|
|
bluatigro
Full Member
member is offline


Gender: 
Posts: 111
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #26 on: Feb 9th, 2015, 09:08am » |
|
@richard : - done what you sugested
got same smal white screen
title : sphere_test.lbb.tmp
|
|
Logged
|
|
|
|
bluatigro
Full Member
member is offline


Gender: 
Posts: 111
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #27 on: Feb 14th, 2015, 11:43am » |
|
a try at OOP Code:
new p as t3d 255 , 3 , 6
new p1 as t3d 4 , 4 , 4
print p::toStr$()
print p1::toStr$()
''next line goes also wrong whit "!" in front
''p = p::add( p1 )
print p::toStr$()
discard p
discard p1
end
class t3d
dim x , y , z
sub t3d
x = 0
y = 0
z = 0
end sub
sub t3d nx , ny , nz
x = nx
y = ny
z = nz
end sub
function get.x
get.x = x
end function
function get.y
get.y = y
end function
function get.z
get.z = z
end function
! function add( a as t3d ) as t3d
new q as t3d x+a::get.x() , y+a::get.y() , z+a::get.z()
add = q
discard q
end function
function toStr$()
''this is now right
toStr$ = "( " + str$( this::get.x() ) _
+ " , " + str$( this::get.y() ) _
+ " , " + str$( this::get.z() ) + " )"
end function
end class
|
|
Logged
|
|
|
|
bluatigro
Full Member
member is offline


Gender: 
Posts: 111
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #28 on: Feb 28th, 2015, 3:06pm » |
|
i tryed this Code:
''bluatigro 14 feb 2015
''mod-test.bas
'include t3d.bas
print "now in mod test bas"
new a as t3d 1 , 2 , 3
print a::toStr$()
Code:
''bluatigro 14 feb 2015
''t3d.bas
new p as t3d 255 , 3 , 6
new p1 as t3d 4 , 4 , 4
print p::toStr$()
print p1::toStr$()
''next line goes also wrong whit "!" in front
''p = p::add( p1 )
print p::toStr$()
discard p
discard p1
end
class t3d
dim a , b , c
sub t3d
a = 0
b = 0
c = 0
end sub
sub t3d x , y , z
a = x
b = y
c = z
end sub
function x
x = a
end function
function y
y = b
end function
function z
z = c
end function
! FUNCTION add( d AS t3d ) AS t3d
new q as t3d a + d::x() , b + d::y() , c + d::z()
add = q
discard q
end function
function toStr$()
''this is now right
toStr$ = "( " + str$( this::x() ) _
+ " , " + str$( this::y() ) _
+ " , " + str$( this::z() ) + " )"
end function
end class
''t3d.bas
error : - t3d.bas output corect - mod test.bas only t3d.bas output
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #29 on: Feb 28th, 2015, 3:29pm » |
|
on Feb 28th, 2015, 3:06pm, bluatigro wrote:- t3d.bas output corect - mod test.bas only t3d.bas output |
|
t3d.bas includes an END statement (and other code which must come after the main program) so, of course, anything following the 'include t3d.bas will not be executed:
Code: print "This is executed" ' this is in the included file
end ' this is in the included file
print "This isn't executed" ' this is in the base program Sometimes I think the 'include directive has been misunderstood. It quite literally 'includes' the specified file at that point in the program; nothing 'clever' or 'magic' happens!
Richard.
|
|
|
|
bluatigro
Full Member
member is offline


Gender: 
Posts: 111
|
 |
Re: Object Oriented Liberty BASIC?
« Reply #30 on: Mar 1st, 2015, 08:47am » |
|
i tryed Code:
''bluatigro 14 feb 2015
''mod-test.bas
print "now in mod test"
new a as t3d 1 , 2 , 3
print a::toStr$()
end
'include t3d.bas
Code:
''bluatigro 14 feb 2015
''t3d.bas
class t3d
dim a , b , c
sub t3d
a = 0
b = 0
c = 0
end sub
sub t3d x , y , z
a = x
b = y
c = z
end sub
function x
x = a
end function
function y
y = b
end function
function z
z = c
end function
! FUNCTION add( d AS t3d ) AS t3d
new q as t3d a + d::x() , b + d::y() , c + d::z()
add = q
discard q
end function
function toStr$()
''this is now right
toStr$ = "( " + str$( this::x() ) _
+ " , " + str$( this::y() ) _
+ " , " + str$( this::z() ) + " )"
end function
end class
''t3d.bas
i got a 'mistake' in the include line
|
|
Logged
|
|
|
|
|