Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Dec 2012
Offline Last Active Nov 27 2015 03:32 PM

#5040299 2d/text, will it get me/us anywhere?

Posted by on 07 March 2013 - 02:36 AM

Think of 2D and 3D just like the viewpoint you're looking at your game world. If the game idea is good and the realization as well, then you have nothing to worry about. I'm not saying if you make a good game, you'll get rich. No one can guarantee that. Just that, people categorize games by all kinds of criteria ( 3D, 2D, OpenGL, D3D, XNA, Unity, ugly, racing ...), what they are actually missing is that realization of an idea is more important than anything else, in my opinion.

#5018499 Can you return a class member object as a pointer?

Posted by on 07 January 2013 - 01:50 AM

What does pointer contain as a VALUE? An address. Therefore - just return the address.

#5012702 Design recommendations for multiple map<> of objects

Posted by on 19 December 2012 - 10:33 PM

Matrias is right. Consider this:

You: "Hey device, what can you do?"
Device: "I can do function1(), tellMeWhoYouAre() and veryComplicatedFunction()"
You: "But who actually are you? Are you a IDeviceA? IDeviceB?"
Device: "That is not of your concern. I told you what functionalities I provide."
You: "So you guarantee that whoever is hiding behind you, can provide those functionalities aswell in it's own way?"
Device: "Exactly. "

Lets go over the keywords real quickly:

1. Providing functionalities
[source lang="cpp"]class Device{public: Device(); ~Device(); // virtual basically means that subclasses can override this function // =0 means this function has no implementation making this class an abstract class virtual void function1()= 0; virtual std::string tellMeWhoYouAre(){ return "Device"; } void veryComplicatedFunction(){ // complicated stuff }};[/source]

When you look at device class you know what functionalities it, or it's subclasses provides.

2. Hiding

As polymorphism.
[source lang="cpp"]Device* device= new DeviceImplementationA();device->function1();[/source]

When calling function1, you don't generally care and most of the time you don't know if DeviceImplementation1 or DeviceImplementationX is hidden behind that device.

3. Handling things it's own way
[source lang="cpp"]class DeviceImplementation1 : public Device{public: DeviceImplementation1(); ~DeviceImplementation1(); // no '=0' since we have an implementation here virtual void function1(){ // do Implementation1 specific stuff } // again, tellMeWhoYouAre() needs a specific implementation virtual std::string tellMeWhoYouAre(){ return "DeviceImplementation1"; }};[/source]