I have a vector of names. Each time the user does a mouse interaction, I want to add an element to my vector and have the user name it. Using the cinder framework parameters as the GUI. Here's the code:
#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
#include "cinder/params/Params.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class TestParamsApp : public App {
public:
void setup() override;
void mouseUp( MouseEvent event ) override;
void draw() override;
params::InterfaceGlRef mParams;
vector<std::string> names;
int nameIdx = 0;
};
void TestParamsApp::setup()
{
mParams = params::InterfaceGl::create(getWindow(), "Test Params", toPixels(ivec2(200, 200)));
}
void TestParamsApp::mouseUp(MouseEvent event) {
names.push_back("");
mParams->addParam("Actor " + std::to_string(nameIdx), &names[nameIdx]);
nameIdx++;
}
void TestParamsApp::draw()
{
gl::clear( Color( 0, 0, 0 ) );
mParams->draw();
}
CINDER_APP( TestParamsApp, RendererGl )
However, after adding the 2nd element i get Exception thrown: read access violation. _First was 0xDDDDDDDD.