Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualagentultra

Posted 12 February 2013 - 05:30 PM

I figured it out (I was using a forward declaration and forgot to include the header in my implementation of the derived class).

 

Only now I have to figure out how to push new scenes from a scene...

 

void BlankScene::onKeyDown(SDLKey key, SDLMod mod, Uint16 unicode)
{
    switch (key) {
        case SDLK_SPACE:
            std::cout << "You pressed space in the blank scene!" << std::endl;
            app->pushScene(ScenePtr(new YellowScene()));
            break;
            
        default:
            break;
    }
}

 

This will throw EXC_BAD_ACCESS.

 

I'm going to assume it has something to do with my implementation of pushScene and unique_ptr?

void App::pushScene(ScenePtr scene)
{   
    scene_stack.push(std::move(current_scene)); // current_scene becomes NULL
    next_scene = std::move(scene);
    next_scene->app = this;
}

#3agentultra

Posted 12 February 2013 - 05:06 PM

I figured it out (I was using a forward declaration and forgot to include the header in my implementation of the derived class).

 

Only now I have to figure out how to push new scenes from a scene...

 

void BlankScene::onKeyDown(SDLKey key, SDLMod mod, Uint16 unicode)
{
    switch (key) {
        case SDLK_SPACE:
            std::cout << "You pressed space in the blank scene!" << std::endl;
            app->pushScene(ScenePtr(new YellowScene()));
            break;
            
        default:
            break;
    }
}

 

This will throw EXC_BAD_ACCESS .


#2agentultra

Posted 12 February 2013 - 04:54 PM

I figured it out (I was using a forward declaration and forgot to include the header in my implementation of the derived class).

 

Only now I have to figure out how to yield events from the main loop to the scene. The rabbit hole keeps going.


#1agentultra

Posted 12 February 2013 - 04:49 PM

I figured it out (I was using a forward declaration and forgot to include the header in my implementation of the derived class).


PARTNERS