Jump to content

Dynamic Allocation of Vectors/Maps


photo

Recommended Posts

You can use Unigine::Vector and Unigine::Map class. You have to include #include <core/scripts/array.h> file.

 

int grid_num = 3;
Unigine::Vector grid_nodes[0];

       /*
        */
       void init() {
     forloop(int i = 0; grid_num) {
          grid_nodes.append(new Unigine::Vector(grid_num));
          grid_nodes_temp.append(new Unigine::Vector(grid_num));
     }
       }

       /*
        */
       void shutdown() {
         forloop(int i = 0; grid_num) {
      forloop(int j = 0; grid_num) {
	    delete grid_nodes[i].get(j);
      }
  }
       }

Link to comment

Right, I know that the Vector and Map classes exists, and behave like classes.

 

However, if existing code uses basic vectors and maps, and I'd like to construct a vector externally and assign it, I would need dynamic allocation. I guess this is not possible. Any chance of this being added? Dynamic allocation... is pretty useful?

 

Alright, well thanks for the response! :)

Link to comment
×
×
  • Create New...