It is currently Sun Feb 25, 2018 8:41 pm

All times are UTC - 5 hours

 Page 1 of 1 [ 2 posts ] 
Author Message
 Post subject: Ghost VMK 17 - Pickup Object Class
PostPosted: Mon Jun 01, 2009 6:51 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1106
Location: Ontario Canada
The generic pickup object class is defined in this VMK. We will be using this class to derive classes used for the health packs, arrows and energy pickup's within the game.

I made some fundamental changes to the game engine in VMK 17B to make things a little easier to work with. In VMK17B you'll see that the ErrorHandler can now be accessed from anywhere, GameOGL is updated and I clean up all the virtual keywords throughout the program.

 Post subject: An Extra Added Feature
PostPosted: Fri Feb 19, 2010 10:23 am 

Joined: Sat Aug 16, 2008 7:58 am
Posts: 452
I noticed that when you created the static variable in ErrorHandler with its Get() function, that you also created a static varible for the GameOGL Class.

After I changed all the constructors and function calls that used the old way of using the ErrorHandler, I did this with the GameOGL class with in the Scene class.

First I created the same Get() function in GameOGL and in doing so, now
I can remove the Scene's GameOGL pointer and member variable in the Header File and Constructor

So the new Constructor looks like this:

and in the Scene.cpp file

I removed the pointer in the constructor as well

these are the few changes in the constructor in the .cpp file

Here is the new Scene's Constructor
// ------------------------------------------------------------------------------- //
// Name: Scene()
// Desc: Default Constructor
// ------------------------------------------------------------------------------- //
Scene::Scene() :
m_Player( 0.5f ),
m_guiTextureID( GROUP_1, 0 ),
m_mapTextureID( GROUP_1, 0 ),
m_guiHudTextureID( GROUP_2, 0 ),
m_fontSmall( GROUP_1, 0 ),
m_fontHiScore( GROUP_1, 0 ),
m_fontNumbers( GROUP_2, 0 )
   m_pUserSettings   = GameOGL::Get()->m_pUserSettings;
   Integrator1::s_fTimeStep = GameOGL::Get()->GetPhysicsTimeStep();
   Integrator2::s_fTimeStep = GameOGL::Get()->GetPhysicsTimeStep();

   m_fTimeChange       = 0;
   m_bChangeActionKey = false;

   _snprintf_s( m_szGUI_Info, 128, 128, "" );   

   m_consoleParam.fWidth      = (float)m_pUserSettings->GetWindowWidth();
   m_consoleParam.fYPosition   = (float)m_pUserSettings->GetWindowHeight();
   m_consoleParam.fYMax      = (float)m_pUserSettings->GetWindowHeight();
   m_consoleParam.fYMin      = (float)m_pUserSettings->GetWindowHeight() - m_consoleParam.fHeight;
   // Assign Static Pointer In SceneGraph To Point To
   // The Container In This Scene Class
   Node::s_vpAlphaObjects = &m_vpAlphaObjects;

   // Assign Static Pointer Of TextureManager To GUIControl   
   GUIControl::s_pTextureManager      = &m_TextureManager;
   // Temp -----
   //ObjectDynamic2D::s_bKeys = &m_pUserSettings->m_bKeys[0];
   // Ghost Toast Specific
   m_fMapScale         = 1.0f;
   m_fMapHalfScale      = m_fMapScale * 0.5f;
   m_fCollisionBuffer  = m_fMapScale * 0.1f;

} // Scene

Then I did a Find and Replace in the Scene.cpp file only for this
Find: m_pGameOGL
Replace: GameOGL::Get()

The only other changes are calls where the Scene's Constructor are being used throughout the code... Ony one I think I found Was in GameOGL.cpp and you just need to remove any parameters in the constructor.

You do have to keep #include "GameOGL.h" in Scene.h

Every thing works :)

Display posts from previous:  Sort by  
 Page 1 of 1 [ 2 posts ] 

All times are UTC - 5 hours

Who is online

Users browsing this forum: No registered users and 0 guests

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: