I seem to have forgotten but I’ve added srand and time: You will have to call this if you want a random seed…
srand (time)
I seem to have forgotten but I’ve added srand and time: You will have to call this if you want a random seed…
srand (time)
vector v
vector_init v 1 2 3 4 5
number a b c d
explode v a b c d
print "% % % %\n" a b c d
; prints 1 2 3 4
Almost or about half of everything will become an expression operator. Almost any builtin function returning a value will become and expression op. So instead of:
number n
vector_get v n 10
You do:
number n
= n (vector_get v 10)
This allows easier inlining for function calls etc.
However not everything will be treated this way. Like vector_add/vector_set/etc remain the same, it’s mainly things returning a value that benefit from it.
toptr will return NULL (a new constant)if the variable doesn’t exist. == and != now support comparing pointers.
This is the new toptr.boo example which checks if the function exists before calling:
number f
file_open f "word.txt" "r"
string s
file_read f s
file_close f
pointer p
= p (toptr s)
if (!= p NULL) go nope
call `p
:go
print "NOPE!\n"
:nope
function foo
{
print "foo!\n"
}
function bar
{
print "bar!\n"
}
function baz
{
print "baz!"
}
The next version of BooBoo will have toptr which gives you a pointer from a string with a variable name in it.
number f
file_open f "word.txt" "r"
string s
file_read f s
file_close f
call `(toptr s)
function foo
{
print "foo!\n"
}
function bar
{
print "bar!\n"
}
function baz
{
print "baz!"
}
Now if word.txt contains “foo”, “bar” or “baz” the appropriate function is called.
For example:
number x
= x 100
string s
= s (varname x)
print "%\n" s ; prints "x"
= `(tovar s) 777 ; x is now 777
OpenGL uses upside down textures, D3D uses right side up. BooBoo/Shim has sheltered this for the most part, but it’s a pain in the arse so I’m storing textures in lib dependent format from now on. The 3D examples change, it will need to have a if (== TRUE D3D9) block where texture coordinates are used, and flip them vertically. Or I might just drop D3D altogether…
image_read_texture reads an image into a BooBoo vector for manipulation. image_to_texture creates a new texture from such a vector (which can be fully created oneself or gotten from image_read_texture) and image_update updates an existing texture with new data (faster.)
This isn’t live yet… next version will have these 3 functions.