HumanView scene in constructor

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • HumanView scene in constructor

      How is it possible for the scene to be used in the constructor here? As far as I can see, it hasn't been instantiated anywhere, and it's not global.

      I unfortunately can't compile everything to run it using VS2012 and Win8.1.

      Source Code

      1. //
      2. // HumanView::HumanView - Chapter 10, page 272
      3. //
      4. HumanView::HumanView(shared_ptr<IRenderer> renderer)
      5. {
      6. InitAudio();
      7. m_pProcessManager = GCC_NEW ProcessManager;
      8. m_PointerRadius = 1; // we assume we are on a mouse enabled machine - if this were a tablet we should detect it here.
      9. m_ViewId = gc_InvalidGameViewId;
      10. // Added post press for move, new, and destroy actor events and others
      11. RegisterAllDelegates();
      12. m_BaseGameState = BGS_Initializing; // what is the current game state
      13. if (renderer)
      14. {
      15. // Moved to the HumanView class post press
      16. m_pScene.reset(GCC_NEW ScreenElementScene(renderer));
      17. Frustum frustum;
      18. frustum.Init(GCC_PI/4.0f, 1.0f, 1.0f, 100.0f);
      19. m_pCamera.reset(GCC_NEW CameraNode(&Mat4x4::g_Identity, frustum));
      20. GCC_ASSERT(m_pScene && m_pCamera && _T("Out of memory"));
      21. m_pScene->VAddChild(INVALID_ACTOR_ID, m_pCamera);
      22. m_pScene->SetCamera(m_pCamera);
      23. }
      24. }
      Display All