Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17070

Get element in cocos2d vector

$
0
0

@iaprogramsUP wrote:

So i n my project I need to put some sprites into vector. But I need to interact with elements. So I need to select one element(sprite) from vector. SInce cc2d vector doesn't overload operator [] , I thought there are 2 ways to to that.
1th using that wierd foor loop for (const String& sprite_name : frames)
but it doesn0t do what I want, cause I need to get previus element of that that I am selecting , etc (vector[a-1], ,...) I also need to select element outside the foor loop.
So I thought of a at() function. Function description.
I use it like vector.at(a)
But the app crahses at the point of usage. I tried just simple code, without any hard lifting, so there were 99,9% no mistakes in the code, but It always chrases when it went to at() function..
SO how else can I do that!? Am I missing sth?

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 17070

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>