Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 29 Mar 2011
Offline Last Active Sep 16 2016 07:31 PM

#5270461 C++ without pointers

Posted by on 10 January 2016 - 05:56 PM

New question as I'm trying to use the new pointer features...


if I have in my class:

std::shared_ptr<Scene> CurrentScene;
std::shared_ptr<Scene> NextScene;


and a function like so:

void SetNextScene(std::shared_ptr<Scene> nextScene) {
   NextScene = nextScene;
void Update() {
   if (NextScene != null) {
      NextScene = CurrentScene;
      CurrentScene = NULL;


I set the scene like this:



Is this a proper way to 'flip' pointers?

#5268671 C++ without pointers

Posted by on 31 December 2015 - 10:18 PM

Yeah, I've done a lot of C so malloc/realloc/free is more natural to me than new/delete, and other C++y things. I also use C# a lot, which has GC, which is a very different beast. C++ feels like a weird middle of the road, not quiet C#, not quite C. I do realize references are pointers, as the only things that actually exist are 64 bit values (or smaller depending on the architecture). You can't actually represent "MyClass" as anything more than a pointer to a block of memory that contains atomic values (int/byte/etc) or pointers (struct/class/etc) as far as passing goes -- it just pushes a pointer to the object onto the stack before calling the method.


So I'll read up on smart pointers, but honestly at this point I might as well just stick with new/delete as it is closer to malloc/free that I'm used to.


Thanks guys!



Yup I switch to standard pointers where it makes sense. I'll use visual leak detector and keep an eye out on things!

#5024187 Comments on level design?

Posted by on 21 January 2013 - 11:07 PM

I am working on some areas for my game and wanted to get feedback on the general layout of things. It is a mix between an RPG and platformer. You can see an example of how the game plays here: 


And what I have so far of one of my areas is here:

http://img833.imageshack.us/img833/8852/startingarea.png (warning: large image!)


Please note that the background is white because in-game it renders the background (as per the video). Also note all in-game assets are NOT present in the image export because that layer also contains collision data and is very hard to see the actual layout if I show it as well -- this includes vertical platforms (as hinted by the rails), doors, enemies, flame pipes, item boxes, etc. And of course, the left part of the lower drop is not done yet.


I just want to know if the general flow of the areas makes sense or if I will cause too much confusion for the players. I want to lead them somewhat, but give them freedom without them feeling totally lost.


Any feedback would be greatly appreciated!