The Game Creators
The Game Creators Home Online Shop Click to Login
  Hot: Christmas CompetitionNovember NewsletterModel Pack 36DB Pro Pack 2009DGS BonanzaCharacter PackFPS Creator Bonanza;
The Game Creators
Dark GDK .NET / Initialising an array of Structures

Go to the first page of this board Return to the Forum Menu Post Message
2 Messages - Page   of 1   
Bookmark and Share Search the Forum

Author Message
BatVink

TGC Newsletter Editor


Joined: Fri Apr 4th 2003
Location: Chilling
Posted: 7th Nov 2009 05:02     Edited: 7th Nov 2009 05:05     | link | toggle

let's hope I can explain this clearly! I have a Structure, and I am having trouble initialising it. Specifically when I try to populate the Vector3 variables, it tells me that they are Nothing, so I need to make them New when the array of this structure is declared.

+ Code Snippet
Structure tTrackPoint
        Dim id
        Dim obj As DarkGDK.Basic3D.Cube
        Dim pos As DarkGDK.Math.Vector3
        Dim handle1 As DarkGDK.Math.Vector3
        Dim handle2 As DarkGDK.Math.Vector3
        Dim handle1Obj As DarkGDK.Basic3D.Cube
        Dim handle2Obj As DarkGDK.Basic3D.Cube
        Dim width As Double

    End Structure


Next, I added a Sub New to the structure:

+ Code Snippet
        Public Sub New()
            pos = New DarkGDK.Math.Vector3
            handle1 = New DarkGDK.Math.Vector3
            handle2 = New DarkGDK.Math.Vector3
        End Sub


Now my problem is that I must supply a parameter, the syntax error being:

Structures cannot declare a non-shared 'Sub New' with no parameters.

I have no parameter to supply, and this will be an array so I'm not even sure how I would supply it.
The second option to fix the error is to make the Sub New shared, but then I get other errors:

Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.


Does anyone know how I can resolve this. My end goal is to have an array of this structure type with the Vector3s ready to use

Back to top
The Biglaugh
Report this message as abusive
Google Ad
Back to top
 
BatVink

TGC Newsletter Editor


Joined: Fri Apr 4th 2003
Location: Chilling
Posted: 7th Nov 2009 06:23           | link | toggle
Back to top
The Biglaugh
Report this message as abusive

Go to the first page of this board Return to the Forum Menu Post Message
2 Messages - Page   of 1   
Search the Forum

You must be logged-in to post messages to this forum. You can register an account for free. Or click here to login.
Forum Search

Enter a word or phrase to search our Forum for:

Thread Subject Search
Search Phrase:
Search Scope: Entire forum
Just this board
 
Google Forum Search
Search Phrase:
 
Apollo v2.02


Game Creator Store
Privacy Policy AUP Top of Page