It is currently Thu Apr 27, 2017 9:44 am

All times are UTC - 5 hours




 Page 1 of 1 [ 3 posts ] 
Author Message
 Post subject: VMK 8 Camera class member variables
PostPosted: Wed Feb 24, 2010 9:57 pm 

Joined: Wed Feb 24, 2010 9:39 pm
Posts: 2
First of all let me say "Hi to all!"
I'm new here and I've recently bought a copy of the GameEngine DVD and I hope it will arrive soon!
In the meanwhile I've been able to follow the tutorial until VMK 8, the ones who talks about the Camera and I have to say that they are very easy to follow, even for a non C++ programmer like me.
I'm a Java programmer so I've never had to deal with pointers and there is this question that keeps bugging me.
Sometimes class member variables are declared as non pointer and sometimes they are declared as pointers.
I've thought that you declare a member variable as pointer when you cannot foresee how the memory will be allocated for that specific member variable. As a rule, I thought that most classes used as member variables of other classes need to be declare as pointers, like ErrorHandler.
But in the VMK 8 you have declared the Vector3 as non pointer variable (for example "Vector3 m_v3LookDirectionHome") and I really can't understand how do you determine when a member variable needs to be declared as a pointer and when not.
Probably it's a stupid question for an average C++ programmer but I really can't understand it.
Thanks in advance for any answer you'll send me and sorry for my poor English . :D


Offline
 Profile  
 
 Post subject:
PostPosted: Mon Mar 15, 2010 2:23 am 

Joined: Sun Jan 31, 2010 7:37 am
Posts: 2
Location: Russia, Murom
Quote:
But in the VMK 8 you have declared the Vector3 as non pointer variable (for example "Vector3 m_v3LookDirectionHome") and I really can't understand how do you determine when a member variable needs to be declared as a pointer and when not.


ErrorHandler is a singleton (we need only one copy of this class), that why we declared pointer to ErrorHandler in all other classes.

In most cases you can determine how declare member on your own.



_________________
My english bad, very bad
Offline
 Profile  
 
 Post subject:
PostPosted: Sat May 08, 2010 7:17 pm 

Joined: Wed Feb 24, 2010 9:39 pm
Posts: 2
Thanks a lot for your answer and sorry for being so late but I couldn't get online. Thinking about singleton now it makes sense to declare ErrorHandler as a pointer.
You helped me a lot, not only for the game engine but for C++ in general.
Thanks again!


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

cron