08-15-2023, 12:15 AM
(This post was last modified: 08-15-2023, 12:18 AM by grymmjack.
Edit Reason: Fixing quote and code
)
Hi @Jack
I just stumbled onto this in the issue tracker:
https://github.com/QB64-Phoenix-Edition/...1611346466
This might help you as it helped me.
I just stumbled onto this in the issue tracker:
https://github.com/QB64-Phoenix-Edition/...1611346466
mechatronic3000 Wrote:I ran into a similar issue with my 2d physics engine. What I ended up doing is making the arrays into _MEM's (essentially making it a pointer) and I created some getters and setters to extract my data from the _MEM array.
Here is an example of what I did. You can make "test" and array in itself, however you have to do a _memnew for each element in the array.
Code: (Select All)
TYPE Example
Parameter1 AS INTEGER
Parameter2 AS INTEGER
Parameter3 AS _MEM
END TYPE
DIM test AS Example: test.Parameter3 = _MEMNEW(2 * 10) ' sizeof Integer * Number of elements
setter test, 2, 5
setter test, 6, 3
setter test, 9, 1
PRINT getter(test, 2)
PRINT getter(test, 6)
PRINT getter(test, 9)
SUB setter (test AS Example, index AS LONG, value AS INTEGER)
_MEMPUT test.Parameter3, test.Parameter3.OFFSET + (index * 2), value AS INTEGER
END SUB
FUNCTION getter% (test AS Example, index AS LONG)
getter = _MEMGET(test.Parameter3, test.Parameter3.OFFSET + (index * 2), INTEGER)
END FUNCTION
This might help you as it helped me.