I would like to implement something like this because my application is divided into scenes and this gets sort of messy:
glEngine.scene[glEngine.current.currentScene].layer[glEngine.scene[glEngine.current.currentScene].currentLayer].Shapes.push_back(CGlShape());
instead I’d want to be able to do something like this:
glEngine.Scene().layer[glEngine.Scene().currentLayer].Shapes.push_back(CGlShape());
How could I make a function like this?
Thanks
We have no idea what your classes are, but just make a function:
You can also do this for
Scene, returning the current layer:Giving:
You might also consider splitting the line up merely for the sake of readability:
Lastly, the naming convention seems a bit weird, maybe rename the
SceneandLayerfunctions tocurrent_sceneandcurrent_layer.