I wrote a script called Collision Maps which takes an image, parses its pixels, and caches the results in a Table object, where each (x,y) has a one-to-one correspondence with each pixel on the image.
I do something silly like looping over every pixel and calling get_pixel, which is very slow for sufficiently large images.
I could probably avoid doing this by simply accessing the pixel when I need it, but I figured I might as well figure out how to update a Table using pointers and stuff cause I would like to use images for a variety of things to enhance mapping functionality.
How would I do this?
The approach I'm thinking is to first create a table in Ruby, then pass a pointer to that table to some dll function, which will then update the values by offsetting the pointer and writing a new value. Then when the function is done, I should see that my table has been updated.
However I don't know how the table is stored in memory.
Has anyone worked with Table objects?
I do something silly like looping over every pixel and calling get_pixel, which is very slow for sufficiently large images.
I could probably avoid doing this by simply accessing the pixel when I need it, but I figured I might as well figure out how to update a Table using pointers and stuff cause I would like to use images for a variety of things to enhance mapping functionality.
How would I do this?
The approach I'm thinking is to first create a table in Ruby, then pass a pointer to that table to some dll function, which will then update the values by offsetting the pointer and writing a new value. Then when the function is done, I should see that my table has been updated.
However I don't know how the table is stored in memory.
Has anyone worked with Table objects?