Hi…,
I am new to C++. I would like to initialize my “board” object in testApp.cpp, but how?
e.g.
board = new board2D(10,12);
doesn’t work.
The testApp.h code follows here:
#pragma once
#include "ofMain.h"
class cell {
public:
cell(){
}
int dir;
};
class board2D{
public:
board2D(){}
board2D(int c, int r){
columns = c;
rows = r;
cellPtr = new cell[c*r];
}
~board2D(){
delete[] cellPtr;
}
private:
int columns;
int rows;
cell *cellPtr;
};
class testApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed (int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
int debug;
board2D board;
};
Thanks,
Mike