Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DIM AT -- feature request
#3
Hi @Jack

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.
grymmjack (gj!)
GitHubYouTube | Soundcloud | 16colo.rs
Reply


Messages In This Thread
DIM AT -- feature request - by Jack - 08-14-2023, 03:49 PM
RE: DIM AT -- feature request - by mnrvovrfc - 08-14-2023, 04:28 PM
RE: DIM AT -- feature request - by grymmjack - 08-15-2023, 12:15 AM



Users browsing this thread: 3 Guest(s)