Code: Select all
struct sector
{
sector() : height(1){}
ISceneNode* cube;
int height;
};
sector nMap[10][10];
int main() {
nMap[5][3].height = 3;
nMap[2][4].height = 3;
nMap[3][3].height = 3;
nMap[6][3].height = 3;
nMap[6][2].height = 3;
nMap[7][5].height = 3;
nMap[5][4].height = 4;
nMap[5][7].height = 3;
nMap[3][9].height = 5;
nMap[2][6].height = 3;
// The primary Irrlicht device. Using OpenGL at 800x600 resolution.
IrrlichtDevice* device = createDevice(EDT_OPENGL, core::dimension2d<s32>(800,600));
// A pointer referencing the video device driver.
IVideoDriver* video = device->getVideoDriver();
// The primary scene manager for this app.
ISceneManager* smgr = device->getSceneManager();
ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS();
for (int x=0; x<10; x++)
for (int y=0; y<10; y++) {
nMap[x][y].cube = smgr->addCubeSceneNode(10.0f, NULL, -1, core::vector3df(x*10,nMap[x][y].height/2,y*10));
nMap[x][y].cube->setScale(vector3df(1,nMap[x][y].height,1));
nMap[x][y].cube->getMaterial(0).setTexture(0,video->getTexture("square.bmp"));
nMap[x][y].cube->getMaterial(0).Lighting = false;
}
// Main game loop.
while(device->run() && device) {
video->beginScene(true, true, video::SColor(255,0,0,255));
smgr->drawAll();
video->endScene();
}
}