|
Post by Tom Mulgrew on Jan 2, 2008 3:51:09 GMT -5
Here's the BETA of what is going to be v2.5.0 www.basic4gl.net/unofficial/SetupBasic4GLv250Beta.exeThis is basically a proper bundling of the "Basic4GL with functions" release that I put out before. The only thing likely to change between this and the official 2.5.0 release is there's a memory leak that occurs whenever you pass a string to/from a user function or sub, which I still need to fix. But otherwise it should be stable, complete and functional. The "create standalone exe" feature should also work. If y'all want to install it and start using it, and let me know if you find any problems... Would be much appreciated. Cheers, -Tom
|
|
|
Post by James :) (aka Madcow) on Jan 2, 2008 15:06:34 GMT -5
could you add an function to get the length of an array. also could you allow the findfile function to operate outide of the current directory.
for 2.5.6:
you could add a feature to detct a folder from a file a feature to delete or make a folder edit id3 tags functions to help make visulations to music (volume/bass levels from music) feature to detect what drives are connected. allow basic4gl to show icon files.
|
|
|
Post by Nicky Peter Hollyoake on Jan 2, 2008 16:17:10 GMT -5
could you add an function to get the length of an array. also could you allow the findfile function to operate outide of the current directory. for 2.5.6: you could add a feature to detct a folder from a file a feature to delete or make a folder edit id3 tags functions to help make visulations to music (volume/bass levels from music) feature to detect what drives are connected. allow basic4gl to show icon files. if you mean amount of alements in the array, you can with the command "ArrayMax(Array)" he made with this version. With the features your asking for I agree with the "findfirstfile" going outside the current dictionary, would come useful. For music it could do with the functions "MusicRewind, MusicFastForward". And the delete & create, you can delete, and yeah I agree with he should maked a create.
|
|
|
Post by James :) (aka Madcow) on Jan 2, 2008 19:15:46 GMT -5
for 2.5.1:
instead of vec2(),vec3() etc
array$("hi","bob")
shorthand commands
the ability for the arg() command to return a value when their is no argument.
and the ability to construct dim commands like this:
Dim variable$ = "BOB" [Done]
and the abillty to do this:
variable = variable2 = 0
|
|
|
Post by James :) (aka Madcow) on Jan 3, 2008 18:43:25 GMT -5
basic4gl has almost more versions than python.
|
|
|
Post by Tom Mulgrew on Jan 4, 2008 6:03:05 GMT -5
This isn't really the thread for feature requests. (And to be honest I'm not hugely keen on adding C/C++ style shortcuts to the language.. They tend to make code harder to read for beginning programmers, which goes against my view of what a BASIC language should be).
I would really like to know if anyone is using the new subs and functions, whether they are working as expected and whether they seem to have caused any instability. I've put a lot of work into this one, and I'd really like to know if there are any problems before I put out an official release, incase I have to go back and change the syntax etc.
Cheers, -Tom
|
|
|
Post by James :) (aka Madcow) on Jan 4, 2008 6:18:51 GMT -5
what's the diffrence between subs and functons.
it would be nice if you could tell basic4gl to make a certain keyword red so custom functions would turn red if entered in.
also you should be able to return more than just numbers and variables (string etc)
when you call a varible or function that don't exsist it should say
"varible or function don't exsist" not "variable don't exsist"
|
|
|
Post by Supermonkey on Jan 4, 2008 6:39:26 GMT -5
Thats good to hear, finally someone who has the same views as me!
subs don't return a value (or shouldn't atleast) whereas functions do.
|
|
|
Post by steven522 on Jan 4, 2008 14:17:00 GMT -5
I have tested out functions and subs a little and have found no problems so far. I don't have a lot of time to make anything intensive, but so-far-so-good.
|
|
|
Post by James :) (aka Madcow) on Jan 4, 2008 14:47:42 GMT -5
basicly subs are void functions
|
|
|
Post by Tom Mulgrew on Jan 4, 2008 19:26:01 GMT -5
also you should be able to return more than just numbers and variables (string etc) Yep, you can do that. To declare a function that returns a string, you have to put a $ after the function name (like with a variable). You can also do arrays and structures. function ReturnsAString$() return "A string" end function
function ReturnsAVector#() () dim vec#(3) vec#(0) = 1 vec#(1) = 0.5 vec#(2) = -2 vec#(3) = 0 return vec# end function
struc TestStructure name$ shoeSize endstruc
function TestStructure ReturnsAStructure() dim TestStructure s s.name$ = "Tom" s.shoeSize = 11 return s end function Cheers, -Tom
|
|
|
Post by xenovacivus on Jan 4, 2008 23:34:59 GMT -5
Yay! Functions! Recursion! Tree walking! wait, a struct can't contain itself? maybe no trees... But still recursion! Here's a small demo which recursively divides up points with horizontal lines, ensuring there are no more than 10 points between each line (the white part of the line represents the depth of recursion - the shorter the line, the deeper the recursion). The points follow the mouse in a black hole fashion... dim i
const PointCount = 100
dim points#(PointCount)(1)
function DividePoints (bottom#, top#, recursionLevel) dim a dim count for a = 0 to PointCount if (points#(a)(1)< top# and points# (a)(1)>= bottom#) then count = count + 1 endif next ' if there's more than 10 points... if count > 10 then dim halfway# : halfway# = (bottom# + top#) *.5 glBegin (GL_LINES) glColor3f (.8, .5, .2) glVertex2f (0, halfway#) glVertex2f (100, halfway#) glColor3f (1, 1, 1) glVertex2f (0, halfway#) glVertex2f (100/(recursionLevel+1), halfway#) glEnd () ' limit the number of recursions to 10 if (recursionLevel < 10) then DividePoints (halfway#, top#, recursionLevel+1) DividePoints (bottom#, halfway#, recursionLevel+1) endif endif
return count end function glMatrixMode (GL_PROJECTION) glLoadIdentity () glOrtho (0, 100, 0, 100, 0, 1) glMatrixMode (GL_MODELVIEW)
TextMode (TEXT_OVERLAID)
for i = 0 to PointCount points# (i) = vec2 (rnd () % 100, rnd () % 100) next
dim mousePoint# (1) dim draw#
while true glClear (GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) cls
mousePoint# = vec2 (Mouse_X ()*100, (1-Mouse_Y ())*100) while syncTimer (10)
for i = 0 to PointCount draw# = pow (Length (mousePoint# - points# (i)), 2) if (draw# > .5) then draw# = .1/draw# else draw# = 10 endif points# (i) = points# (i) + draw# * (mousePoint# - points# (i)) glBegin (GL_POINTS) glVertex2fv (points# (i)) glEnd () next
wend
' Divide the points from 0 to 100 into blocks of 10 DividePoints (0, 100, 0)
DrawText () SwapBuffers ()
wend
Recursion like this would be useful to divide up a 3D world into smaller boxes (making an OctTree) to speed up collision detection. So far everything seems to be in order, the local variables behave just as I expect they would. I will do some more testing of functions, particularly related to recursion, when I get time... In my current work with c#, I do a lot of things with recursion. I like that Basic4gl is able to teach that concept to peeps new to coding!
|
|
|
Post by Tom Mulgrew on Jan 5, 2008 0:18:15 GMT -5
Here's an example using structures that contain pointers to other structures of the same type to store a binary tree, plus a couple of recursive subroutines to build and traverse it: struc SNode dim value# dim SNode& left dim SNode& right endstruc dim leafValue
sub MakeTree(SNode& root, depth) if depth > 1 then alloc root.left alloc root.right MakeTree(root.left, depth - 1) MakeTree(root.right, depth - 1) else root.value# = leafValue leafValue = leafValue + 1 endif end sub
sub Traverse(SNode& node) if &node.left <> null then Traverse(node.left) Traverse(node.right) else printr node.value# endif end sub
dim SNode root MakeTree(root, 5) Traverse(root) Octrees and other spatial hierarchies should well and truely be possible now
|
|
|
Post by James :) (aka Madcow) on Jan 5, 2008 19:00:06 GMT -5
dose alloc still have memory issues
|
|
|
Post by Linkage on Jan 6, 2008 21:24:08 GMT -5
By the way, when can we expect the full release? I figured I'd rather wait for that than download the Beta.
|
|