Question about Basic Tutorial 6 and mRoot

Problems building or running the engine, queries about how to use features etc.
Post Reply
sabyogre3d
Gnoblar
Posts: 9
Joined: Thu Mar 03, 2016 8:54 pm
x 1

Question about Basic Tutorial 6 and mRoot

Post by sabyogre3d »

Hello!

It's the stupid-newbie-questions guy again :).

I was working with Basic Tutorial 6 and there is something I don't understand, something that I hint it also has to do with how C++ deals with OOP.

We have this:

Code: Select all

Ogre::Root* mRoot;
which from my understanding, Root is a class and mRoot should be an object instantiated from Root but the explanation says
The first thing we'll do is add an Ogre::Root member to our class
So my totally newbie question is:

What is mRoot ? Is it a pointer object? Is it a data member type Root ?

Thanks and sorry again for such silly question but I really want to understand this stuff!
I
User avatar
Kohedlo
Orc
Posts: 435
Joined: Fri Nov 27, 2009 3:34 pm
Location: Ukraine, Sumy
x 32
Contact:

Re: Question about Basic Tutorial 6 and mRoot

Post by Kohedlo »

this is an instances names that in defaoult is NULL.

mRoot is not instanced without = operator.

for instancing need call:

Code: Select all

Ogre::Root::getSingleton(). (select function that you need);

for instancing need:

Code: Select all

Ogre::Root* mRoot = Ogre::Root::getSingletonPtr();
"Ptr" - is for "*" instances that selects throught "->"

and

Code: Select all

Ogre::Root mRoot = Ogre::Root::getSingleton();
c++ game developer.
current project: Imperial Game Engine 2.5
Image
sabyogre3d
Gnoblar
Posts: 9
Joined: Thu Mar 03, 2016 8:54 pm
x 1

Re: Question about Basic Tutorial 6 and mRoot

Post by sabyogre3d »

Thanks!
Post Reply