in a recent version of blitz mark was having some compatibility issues with DirectInput on some computers, so he switched input to windows messages instead, which are a bit slower but mroe compatible. EnableDirectInput uses the old DInput instead, you might want to have this as an option in your games.
Object and Handle are 2 useful (somewhat) functions, i've never actually used them but they have their uses. i forget who posted this, it was from BC:
You know what a type pointer is, right? a.mytype = New mytype... a is the
type pointer which points to a new type. Unfortunately, you can only
store the value of "a" in another type pointer. (eg b.mytype = a.. b now
points to the same type that a does.) It would really be beneficial if
you could find a numeric value of the type that "a" points to.
Help is at hand. Or rather, at Handle! (aha I just made that one up!)
Handle(a.mytype) returns a numeric value of the index number of the type.
In otherwords, an integer equivalent of the type pointer!! Woot!! You can
then convert back with the following syntax: a.mytype = Object.mytype
(id)
where id is the numeric value.
What are the uses of this? Well, for starters, you can store this numeric
value in lots more places. I have done it here to store a kind of pointer
to a type using the EntityName() paremeter of an entity. Handle(sprite)
converts the sprite type into a numeric value and stores it in the
entity. You can then find the type pointer by saying: Object.Mysprite(EntityName(spr))
where spr is the name of the sprite entity.
Another use? Great for polymorphic functions! A polymorphic function is a
function that decides what to do depending on the type of data you give
it. Consider this:
Function DoStuff(id)
If Object.nose(id)<>Null
; ID is a "nose" type pointer
n.nose = Object.nose(id)
n\sniffing = True...
Elseif Object.eye(id)<>Null
; ID is an "eye" type pointer
e.eye = Object.eye(id)
e\blinking = True ...
ElseIf Object.mouth(id)<>Null
; ID is a "mouth" type pointer
m.mouth = Object.mouth(id)
m\yapping = True ...
Else
; ID is not recognised.
End If
End Function
If your Object.type(id) is null, then that type either does not exist, or
the ID number is pointing to another type, because each type has a unique ID.
Another use? Storing types in banks. Banks are resizable and so they can
act a bit like a redimensionable array. (For example, if you have a map
editor and you want the user to be able to resize the map at his/her
whim!) If your map data has lots of little bits of info, you might want
to store it in an array of types. Very useful, but if you want to start
resizing the map you might come into some problems. The best way is to
PokeInt the handle of the types in a bank.
For t.type = each type
PokeInt(bank, cnt*4, Handle(t))
cnt=cnt+1
Next
For i=0 To BankSize(bank) Step 4
t.type = Object.type(PeekInt(bank,i))
If t<>Null ; (check, just in case..)
; Do what you like with t.
End If
Next
The 4 is because Peek/PokeInt takes up FOUR bytes
This is quite advanced stuff, but it's very useful if you can
understand it!!
finally there are some other functions you haven't heard of, like VectorYaw, VectorPitch, and GetMatElement. those 3 are documented in the online help here:
http://www.blitzbasic.com/b3ddocs/command_list_3d_cat.phpsome of these hidden commands get turned into real commands later.