123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|596|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Basic Basement -> Types in FreeBasic

Tue, 13 Nov 2007, 17:13
dna
Why does this code not index the W pointer?
I have initialized it incorrectly but I cannot figure it out.



Thanks in Advance

-=-=-
DNA
Tue, 13 Nov 2007, 17:21
Jayenkai
You have "myVector.v = Callocate(numvectors, Sizeof(Vector))"
but not "myVector.w = Callocate(numvectors, Sizeof(Vector))"
(or at least, that's a 10 second quicky-guess anyway)

-=-=-
''Load, Next List!''
Tue, 13 Nov 2007, 17:24
dna

That was it thanks Jay.

It's funny those type declarations.

-=-=-
DNA
Tue, 13 Nov 2007, 18:15
power mousey

Jay did his job.
And did done his duty.

I was going to help.
But I'll say this and be short and concise for a change.

I like structures in C.
And I like types...the variables within the type with a '.'
rather than with a '\'. Syntax to me is just wierd.
I'm so used of this of doing structures in C and many years ago.


Tue, 13 Nov 2007, 18:20
dna

There apparently is no definitive manual for explaining types. That or the person teaching types are not good teachers.

-=-=-
DNA
Tue, 13 Nov 2007, 18:29
power mousey

I have a few books and in C/C++
that go over structures(a sorta structured type. )
One really good author is Perry.
Greg Perry.

mouseys' short and concise definition:

a type is a data structure where you can
place variables and even arrays and pointers/handles within the data structure.
you first define or blueprint the type.
then you can declare a type or multiple types. Even arrays of types too.
you access,assign,change the items within the type
with the name of the declared type and with either a '.' or a '\' and then the variable name itself.

basically dna,
a type is like a structure. they are both data containers.
like a jar that contains these data items.

short and concise.
Tue, 13 Nov 2007, 18:34
power mousey
think of it this way...

you can define arrays and use them
for a sprite. the handle/pointer to image, its x,y coordinates, animated or not, action status, health or hitpoints,name, level of experience etc.

it would be long,complex and messy using individual arrays for lets say your hero or fighter type. But it could be done.
However, create a jar for a hero type.
then place the attributes inside the jar for a blueprint.
then create or declare the type: load and assign the image and other attriubutes and personal characteristics of this hero or fighter type the data items.
Tue, 13 Nov 2007, 18:44
dna


Yes but the syntax is never explained well. I may need a better graphical explanation.

-=-=-
DNA
Tue, 13 Nov 2007, 19:25
power mousey
dna,

what is there to explain graphically
except with the fonts of alphanumeric characters.
Letters,words and sentences my friend.

Your code up there is a good explanation.
You wrote an embedded type...type within type and in Free Basic.
Encountered a problem and Jay helped you.

what more is there for you??
Type-->get ready for a particular data structure
vector-->the name of the blueprint.
variables within this type: x and y both as Single.
End Type-->the end of the blueprint or design of the data
structure.

now...
just using this type blueprint alone
declare a type of vector

Dim avector AS vector.
this is the declaration. you now have a newly creatd type
in Free Basic called avector that follows the designs or blueprint of vector

Now you can access the data items in avector.
assign,change,modify.
Its all there for you dude.

ENDL-->a Fortran statement meaning the end of
a line or program too.
In other words GenerateEvent, Exit Fortran.

so again, I hope this helps.
And I exit this topic.

Wed, 14 Nov 2007, 13:32
dna

That does help.

The other thing had to do with the indexing.


-=-=-
DNA