home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 06 General Architectures / 06 Rabin / main.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-12-10  |  1.5 KB  |  61 lines

  1. /* Copyright (C) Steve Rabin, 2001. 
  2.  * All rights reserved worldwide.
  3.  *
  4.  * This software is provided "as is" without express or implied
  5.  * warranties. You may freely copy and compile this source into
  6.  * applications you distribute provided that the copyright text
  7.  * below is included in the resulting source code, for example:
  8.  * "Portions Copyright (C) Steve Rabin, 2001"
  9.  */
  10.  
  11. #include "time.h"
  12. #include "robot.h"
  13. #include "database.h"
  14. #include "msgroute.h"
  15. #include "debuglog.h"
  16. #include "stdafx.h"
  17.  
  18.  
  19. //---------------------------------------------------------------------------
  20. int APIENTRY WinMain(HINSTANCE hInstance,
  21.                      HINSTANCE hPrevInstance,
  22.                      LPSTR     lpCmdLine,
  23.                      int       nCmdShow)
  24. {
  25.  
  26.     //Create Singletons
  27.     Time* master_time = new Time();
  28.     Database* master_database = new Database();
  29.     MsgRoute* master_msgroute = new MsgRoute();
  30.     DebugLog* master_debuglog = new DebugLog();
  31.  
  32.  
  33.     //Create game object
  34.     GameObject myGameObject( g_database.GetNewObjectID() );
  35.     g_database.Store( myGameObject );
  36.  
  37.     //Give the game object a state machine
  38.     myGameObject.SetStateMachine( new Robot( &myGameObject ) );
  39.     myGameObject.GetStateMachine()->Initialize();
  40.  
  41.  
  42.     // Game Loop
  43.     while(1)
  44.     {
  45.         g_time.MarkTimeThisTick();
  46.  
  47.         myGameObject.GetStateMachine()->Update();
  48.  
  49.         g_msgroute.DeliverDelayedMessages();
  50.     }
  51.  
  52.     delete( master_time );
  53.     delete( master_database );
  54.     delete( master_msgroute );
  55.     delete( master_debuglog );
  56.  
  57.  
  58.     return(0);
  59. }
  60.  
  61.